Author: alink
Date: Mon May 18 01:19:45 2009
New Revision: 35724

URL: http://svn.gna.org/viewcvs/wesnoth?rev=35724&view=rev
Log:
Fix assert-crash spotted by loonycyborg in test-scenario
(dismissing troll after a move leaving the undo-stack not empty)
Current fix has the small flaw that a unit WML-killed by an event will not
clear the shroud explored by its previous move (if delay shroud is on)

Modified:
    trunk/src/actions.cpp

Modified: trunk/src/actions.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/actions.cpp?rev=35724&r1=35723&r2=35724&view=diff
==============================================================================
--- trunk/src/actions.cpp (original)
+++ trunk/src/actions.cpp Mon May 18 01:19:45 2009
@@ -2576,7 +2576,11 @@
 
                // Make a temporary unit move in map and hide the original
                unit_map::iterator unit_itor = 
units.find(un->affected_unit.underlying_id());
-               assert(unit_itor != units.end());
+               // check if the unit is still existing (maybe killed by an 
event)
+               // FIXME: A wml-killed unit will not update the shroud explored 
before its death
+               if(unit_itor == units.end())
+                       continue;
+               
                unit temporary_unit(unit_itor->second);
                // We're not really going to mutate the unit, just temporarily
                // set its moves to maximum, but then switch them back.


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to