Fix bug #6327
This commit is contained in:
parent
8384364c4c
commit
4d43c2c85c
2 changed files with 9 additions and 1 deletions
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue