[Top][All Lists]
[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: |
Mon, 20 Sep 2004 21:34:37 -0400 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: David White <address@hidden> 04/09/21 01:28:17
Modified files:
src : actions.cpp
Log message:
made it so units only die if they have 0 or less hitpoints after the
event has been fired
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/actions.cpp.diff?tr1=1.155&tr2=1.156&r1=text&r2=text
Patches:
Index: wesnoth/src/actions.cpp
diff -u wesnoth/src/actions.cpp:1.155 wesnoth/src/actions.cpp:1.156
--- wesnoth/src/actions.cpp:1.155 Sun Sep 19 11:53:39 2004
+++ wesnoth/src/actions.cpp Tue Sep 21 01:28:17 2004
@@ -1,4 +1,4 @@
-/* $Id: actions.cpp,v 1.155 2004/09/19 11:53:39 silene Exp $ */
+/* $Id: actions.cpp,v 1.156 2004/09/21 01:28:17 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -686,12 +686,13 @@
const int defender_side = d->second.side();
LOG_NG << "firing die event\n";
game_events::fire("die",loc,a->first);
- d = units.end();
+ d = units.find(loc);
a = units.end();
- //the handling of the event may have removed
the object
- //so we have to find it again
- units.erase(loc);
+ if(d != units.end() && d->second.hitpoints() <=
0) {
+ units.erase(d);
+ d = units.end();
+ }
//plague units make clones of themselves on the
target hex
//units on villages that die cannot be plagued
@@ -832,12 +833,13 @@
gamemap::location defender_loc = d->first;
const int attacker_side = a->second.side();
game_events::fire("die",loc,d->first);
- a = units.end();
+ a = units.find(loc);
d = units.end();
- //the handling of the event may have removed
the object
- //so we have to find it again
- units.erase(loc);
+ if(a != units.end() && a->second.hitpoints() <=
0) {
+ units.erase(a);
+ a = units.end();
+ }
//plague units make clones of themselves on the
target hex.
//units on villages that die cannot be plagued