Minor fixup to e8c7d72
* Removed unnecessary reset() call * Used a ternary operator for an assignment (I forgot unique_ptr accepts `nullptr` as a reset() argument).
This commit is contained in:
parent
c14f8160e5
commit
a3d5b9d603
1 changed files with 4 additions and 11 deletions
|
@ -437,17 +437,11 @@ battle_context& battle_context::operator=(const battle_context& other)
|
|||
attacker_stats_.reset(new battle_context_unit_stats(*other.attacker_stats_));
|
||||
defender_stats_.reset(new battle_context_unit_stats(*other.defender_stats_));
|
||||
|
||||
if(other.attacker_combatant_) {
|
||||
attacker_combatant_.reset(new combatant(*other.attacker_combatant_, *attacker_stats_));
|
||||
} else {
|
||||
attacker_combatant_.reset();
|
||||
}
|
||||
attacker_combatant_.reset(other.attacker_combatant_
|
||||
? new combatant(*other.attacker_combatant_, *attacker_stats_) : nullptr);
|
||||
|
||||
if(other.defender_combatant_) {
|
||||
defender_combatant_.reset(new combatant(*other.defender_combatant_, *defender_stats_));
|
||||
} else {
|
||||
defender_combatant_.reset();
|
||||
}
|
||||
defender_combatant_.reset(other.defender_combatant_
|
||||
? new combatant(*other.defender_combatant_, *defender_stats_) : nullptr);
|
||||
}
|
||||
|
||||
return *this;
|
||||
|
@ -575,7 +569,6 @@ int battle_context::choose_attacker_weapon(const unit& attacker,
|
|||
attacker, attacker_loc, choices[0], true, defender, defender_loc, def_weapon, units));
|
||||
|
||||
if(attacker_stats_->disable) {
|
||||
attacker_stats_.reset();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue