Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Create (and delete) defender_stats_ alongside attacker_stats_ (bug #2…

…1277)
  • Loading branch information...
commit d12a0f706e02841dc90a4a20dfb5b1c33ef5b973 1 parent b2b43a0
@AI0867 AI0867 authored
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/actions/attack.cpp
View
10 src/actions/attack.cpp
@@ -483,7 +483,15 @@ int battle_context::choose_attacker_weapon(const unit &attacker,
attacker_loc, defender_loc, prev_def);
attacker_stats_ = new battle_context_unit_stats(attacker, attacker_loc, choices[0],
true, defender, defender_loc, &defender.attacks()[*defender_weapon], units);
- return attacker_stats_->disable ? -1 : choices[0];
+ if (attacker_stats_->disable) {
+ delete attacker_stats_;
+ attacker_stats_ = NULL;
+ return -1;
+ }
+ const attack_type &att = attacker.attacks()[choices[0]];
+ defender_stats_ = new battle_context_unit_stats(defender, defender_loc, *defender_weapon, false,
+ attacker, attacker_loc, &att, units);
+ return choices[0];
}
// Multiple options: simulate them, save best.
Please sign in to comment.
Something went wrong with that request. Please try again.