This commit is contained in:
Dominic Bolin 2006-07-10 20:56:03 +00:00
parent 8384364c4c
commit 4d43c2c85c
2 changed files with 9 additions and 1 deletions

View file

@ -492,7 +492,7 @@ battle_context::unit_stats::unit_stats(const unit &u, const gamemap::location& u
// Get the current state of the unit.
attack_num = u_attack_num;
if (attack_num >= 0) {
weapon = &u.attacks()[attack_num];
weapon = new attack_type(u.attacks()[attack_num]);
} else {
weapon = NULL;
}
@ -594,6 +594,13 @@ battle_context::unit_stats::unit_stats(const unit &u, const gamemap::location& u
}
}
battle_context::unit_stats::~unit_stats()
{
if(weapon) {
delete weapon;
}
}
void battle_context::unit_stats::dump() const
{
printf("==================================\n");

View file

@ -90,6 +90,7 @@ public:
const unit_map& units,
const std::vector<team>& teams,
const gamestatus& status, const gamemap& map, const game_data& gamedata);
~unit_stats();
// This method dumps the statistics of a unit on stdout. Remove it eventually.
void dump() const;