Author: esr
Date: Tue Aug 26 23:10:28 2008
New Revision: 29003
URL: http://svn.gna.org/viewcvs/wesnoth?rev=29003&view=rev
Log:
Address bug #12233: Never push an invalid iterator onto the healers array.
Modified:
trunk/src/actions.cpp
Modified: trunk/src/actions.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/actions.cpp?rev=29003&r1=29002&r2=29003&view=diff
==============================================================================
--- trunk/src/actions.cpp (original)
+++ trunk/src/actions.cpp Tue Aug 26 23:10:28 2008
@@ -1633,11 +1633,15 @@
unit_map& units, unsigned int side,
const std::vector<team>& teams, bool update_display)
{
+ DBG_NG << "beginning of healing calculations\n";
+
// We look for all allied units, then we see if our healer is near them.
for (unit_map::iterator i = units.begin(); i != units.end(); ++i) {
if (!utils::string_bool(i->second.get_state("healable"),true))
continue;
+
+ DBG_NG << "found healable unit at (" << i->first << ")\n";
unit_map::iterator curer = units.end();
std::vector<unit_map::iterator> healers;
@@ -1703,6 +1707,10 @@
healers.push_back(units.find(heal_loc->loc));
}
+ if (healers.size() > 0)
+ DBG_NG << "Unit has " << healers.size() << " potential
healers\n";
+
+
if(i->second.side() == side) {
unit_ability_list regen =
i->second.get_abilities("regenerate",i->first);
unit_abilities::effect regen_effect(regen,0,false);
@@ -1740,11 +1748,13 @@
i->second.set_state("poisoned","");
healing = rest_healing;
healers.clear();
- healers.push_back(curer);
+ if (curer != units.end())
+ healers.push_back(curer);
} else if(curing == "slowed") {
healing = rest_healing;
healers.clear();
- healers.push_back(curer);
+ if (curer != units.end())
+ healers.push_back(curer);
} else {
healers.clear();
healing = rest_healing;
@@ -1770,6 +1780,10 @@
healing = neg_max;
}
+ if (healers.size() > 0)
+ DBG_NG << "Just before healing animations, unit has "
<< healers.size() << " potential healers\n";
+
+
if ( !recorder.is_skipping()
&& update_display
&& !(i->second.invisible(i->first,units,teams)
&&
@@ -1782,6 +1796,7 @@
i->second.take_hit(-healing);
disp.invalidate_unit();
}
+ DBG_NG << "end of healing calculations\n";
}
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits