mail[Wesnoth-commits] r28704 - in /trunk/src: actions.cpp game_events.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by patrick_X99 on August 18, 2008 - 14:59:
Author: sapient
Date: Mon Aug 18 14:59:51 2008
New Revision: 28704

URL: http://svn.gna.org/viewcvs/wesnoth?rev=28704&view=rev
Log:
-deprecate the use of [store_unit] without [filter]
-check experience and type after firing "advance" event, and abort if 
necessary

Modified:
    trunk/src/actions.cpp
    trunk/src/game_events.cpp

Modified: trunk/src/actions.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/actions.cpp?rev=28704&r1=28703&r2=28704&view=diff
==============================================================================
--- trunk/src/actions.cpp (original)
+++ trunk/src/actions.cpp Mon Aug 18 14:59:51 2008
@@ -1771,6 +1771,7 @@
        if(!u.valid()) {
                return;
        }
+       std::string const& original_type =  u->second.type_id();
        LOG_NG << "firing advance event at " << loc <<"\n";
 
 /*     config test; // REMOVE ME
@@ -1779,7 +1780,9 @@
 
        game_events::fire("advance",loc);
 
-       if(!u.valid()) {
+       if(!u.valid() || u->second.experience() < u->second.max_experience()
+       || u->second.type_id() != original_type)
+       {
                LOG_NG << "WML has invalidated the advancing unit, abort\n";
                return;
        }

Modified: trunk/src/game_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_events.cpp?rev=28704&r1=28703&r2=28704&view=diff
==============================================================================
--- trunk/src/game_events.cpp (original)
+++ trunk/src/game_events.cpp Mon Aug 18 14:59:51 2008
@@ -2199,8 +2199,10 @@
        {
                const config empty_filter;
                vconfig filter = cfg.child("filter");
-               if(filter.null())
+               if(filter.null()) {
                        filter = &empty_filter;
+                       lg::wml_error << _("[store_unit] missing required 
[filter] tag\n");
+               }
 
                std::string variable = cfg["variable"];
                if(variable.empty()) {




Related Messages


Powered by MHonArc, Updated Mon Aug 18 16:21:29 2008