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()) {
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits