Author: dfranke
Date: Mon Mar 30 01:01:10 2009
New Revision: 34271
URL: http://svn.gna.org/viewcvs/wesnoth?rev=34271&view=rev
Log:
Ignore healing due to levelup when computing damage statistics. Fixes bug
#13277.
Modified:
branches/1.6/src/actions.cpp
branches/1.6/src/attack_prediction.cpp
branches/1.6/src/attack_prediction.hpp
trunk/src/actions.cpp
trunk/src/attack_prediction.cpp
trunk/src/attack_prediction.hpp
Modified: branches/1.6/src/actions.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/branches/1.6/src/actions.cpp?rev=34271&r1=34270&r2=34271&view=diff
==============================================================================
--- branches/1.6/src/actions.cpp (original)
+++ branches/1.6/src/actions.cpp Mon Mar 30 01:01:10 2009
@@ -958,7 +958,7 @@
// Calculate stats for battle
combatant attacker(bc_->get_attacker_stats());
combatant defender(bc_->get_defender_stats());
- attacker.fight(defender);
+ attacker.fight(defender,false);
const double attacker_inflict =
static_cast<double>(d_.get_unit().hitpoints()) - defender.average_hp();
const double defender_inflict =
static_cast<double>(a_.get_unit().hitpoints()) - attacker.average_hp();
Modified: branches/1.6/src/attack_prediction.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/branches/1.6/src/attack_prediction.cpp?rev=34271&r1=34270&r2=34271&view=diff
==============================================================================
--- branches/1.6/src/attack_prediction.cpp (original)
+++ branches/1.6/src/attack_prediction.cpp Mon Mar 30 01:01:10 2009
@@ -761,7 +761,7 @@
// Of course, one could be a woman. Or both.
// And neither could be human, too.
// Um, ok, it was a stupid thing to say.
-void combatant::fight(combatant &opp)
+void combatant::fight(combatant &opp, bool levelup_considered)
{
unsigned int rounds = std::max<unsigned int>(u_.rounds, opp.u_.rounds);
@@ -837,8 +837,10 @@
opp.hp_dist[i] = opp.summary[0][i] + opp.summary[1][i];
}
- consider_levelup(opp);
- opp.consider_levelup(*this);
+ if(levelup_considered) {
+ consider_levelup(opp);
+ opp.consider_levelup(*this);
+ }
// Make sure we don't try to access the vectors out of bounds,
// drain increases HPs so we determine the number of HP here
Modified: branches/1.6/src/attack_prediction.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/branches/1.6/src/attack_prediction.hpp?rev=34271&r1=34270&r2=34271&view=diff
==============================================================================
--- branches/1.6/src/attack_prediction.hpp (original)
+++ branches/1.6/src/attack_prediction.hpp Mon Mar 30 01:01:10 2009
@@ -33,7 +33,7 @@
combatant(const combatant &that, const battle_context::unit_stats &u);
/** Simulate a fight! Can be called multiple times for cumulative
calculations. */
- void fight(combatant &opponent);
+ void fight(combatant &opponent,bool levelup_considered=true);
/** takes into account level up when calculating resulting HP after a
fight */
void consider_levelup(combatant &opponent);
Modified: trunk/src/actions.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/actions.cpp?rev=34271&r1=34270&r2=34271&view=diff
==============================================================================
--- trunk/src/actions.cpp (original)
+++ trunk/src/actions.cpp Mon Mar 30 01:01:10 2009
@@ -958,7 +958,7 @@
// Calculate stats for battle
combatant attacker(bc_->get_attacker_stats());
combatant defender(bc_->get_defender_stats());
- attacker.fight(defender);
+ attacker.fight(defender,false);
const double attacker_inflict =
static_cast<double>(d_.get_unit().hitpoints()) - defender.average_hp();
const double defender_inflict =
static_cast<double>(a_.get_unit().hitpoints()) - attacker.average_hp();
Modified: trunk/src/attack_prediction.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/attack_prediction.cpp?rev=34271&r1=34270&r2=34271&view=diff
==============================================================================
--- trunk/src/attack_prediction.cpp (original)
+++ trunk/src/attack_prediction.cpp Mon Mar 30 01:01:10 2009
@@ -761,7 +761,7 @@
// Of course, one could be a woman. Or both.
// And neither could be human, too.
// Um, ok, it was a stupid thing to say.
-void combatant::fight(combatant &opp)
+void combatant::fight(combatant &opp, bool levelup_considered)
{
unsigned int rounds = std::max<unsigned int>(u_.rounds, opp.u_.rounds);
@@ -837,8 +837,10 @@
opp.hp_dist[i] = opp.summary[0][i] + opp.summary[1][i];
}
- consider_levelup(opp);
- opp.consider_levelup(*this);
+ if(levelup_considered) {
+ consider_levelup(opp);
+ opp.consider_levelup(*this);
+ }
// Make sure we don't try to access the vectors out of bounds,
// drain increases HPs so we determine the number of HP here
Modified: trunk/src/attack_prediction.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/attack_prediction.hpp?rev=34271&r1=34270&r2=34271&view=diff
==============================================================================
--- trunk/src/attack_prediction.hpp (original)
+++ trunk/src/attack_prediction.hpp Mon Mar 30 01:01:10 2009
@@ -33,7 +33,7 @@
combatant(const combatant &that, const battle_context::unit_stats &u);
/** Simulate a fight! Can be called multiple times for cumulative
calculations. */
- void fight(combatant &opponent);
+ void fight(combatant &opponent, bool levelup_considered=true);
/** takes into account level up when calculating resulting HP after a
fight */
void consider_levelup(combatant &opponent);
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits