Author: suokko
Date: Thu Sep 18 19:09:33 2008
New Revision: 29535

URL: http://svn.gna.org/viewcvs/wesnoth?rev=29535&view=rev
Log:
Fixed 2nd invalid iterator crash in clear_shourd

Modified:
    trunk/src/actions.cpp

Modified: trunk/src/actions.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/actions.cpp?rev=29535&r1=29534&r2=29535&view=diff
==============================================================================
--- trunk/src/actions.cpp (original)
+++ trunk/src/actions.cpp Thu Sep 18 19:09:33 2008
@@ -43,6 +43,8 @@
 #include "serialization/parser.hpp"
 
 #include <cassert>
+
+#include <boost/scoped_ptr.hpp>
 
 #define DBG_NG LOG_STREAM(debug, engine)
 #define LOG_NG LOG_STREAM(info, engine)
@@ -2563,12 +2565,16 @@
 
                std::vector<gamemap::location>::const_iterator step;
                for(step = un->route.begin(); step != un->route.end(); ++step) {
-                       // we search where is the unit now, before placing its 
temporary clone
-
+                       // we skip places where
+
+                       if (*step != unit_itor->first
+                               && units.find(*step) != units.end())
+                               continue;
                        // We have to swap out any unit that is already in the 
hex,
                        // so we can put our unit there, then we'll swap back 
at the end.
-                       // FIXME: in other move functions, we are blind when 
traversing occupied hex
-                       const temporary_unit_placer unit_placer(units,*step, 
temporary_unit);
+                       boost::scoped_ptr<temporary_unit_placer> unit_placer;
+                       if (*step != unit_itor->first)
+                               unit_placer.reset(new 
temporary_unit_placer(units,*step, temporary_unit));
 
                        // In theory we don't know this clone, but
                        // - he can't be in newly cleared locations


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

Reply via email to