wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src actions.cpp


From: David White
Subject: [Wesnoth-cvs-commits] wesnoth/src actions.cpp
Date: Fri, 22 Apr 2005 17:41:13 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     David White <address@hidden>    05/04/22 21:41:12

Modified files:
        src            : actions.cpp 

Log message:
        fixed bug where 'sighted' events could crash the server if they killed 
the unit that was sighted

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/actions.cpp.diff?tr1=1.207&tr2=1.208&r1=text&r2=text

Patches:
Index: wesnoth/src/actions.cpp
diff -u wesnoth/src/actions.cpp:1.207 wesnoth/src/actions.cpp:1.208
--- wesnoth/src/actions.cpp:1.207       Thu Apr 21 12:28:14 2005
+++ wesnoth/src/actions.cpp     Fri Apr 22 21:41:12 2005
@@ -1,4 +1,4 @@
-/* $Id: actions.cpp,v 1.207 2005/04/21 12:28:14 Sirp Exp $ */
+/* $Id: actions.cpp,v 1.208 2005/04/22 21:41:12 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1782,7 +1782,13 @@
                        for(std::set<gamemap::location>::const_iterator i = 
seen_units.begin(); i != seen_units.end(); ++i) {
                                LOG_NG << "processing unit at " << (i->x+1) << 
"," << (i->y+1) << "\n";
                                const unit_map::const_iterator u = 
units.find(*i);
-                               wassert(u != units.end());
+
+                               //unit may have been removed by an event.
+                               if(u == units.end()) {
+                                       LOG_NG << "was removed\n";
+                                       continue;
+                               }
+
                                if(team.is_enemy(u->second.side())) {
                                        ++nenemies;
                                } else {
@@ -1840,10 +1846,6 @@
                disp->recalculate_minimap();
        }
 
-       for(std::set<gamemap::location>::const_iterator seen = 
seen_units.begin(); seen != seen_units.end(); ++seen) {
-               game_events::fire("sighted",*seen,steps.back());
-       }
-
        wassert(steps.size() <= route.size());
 
        return steps.size();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]