Defensive programming.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
93b3847b31
commit
08ef84f6d6
|
@ -14,10 +14,15 @@ void TurnHandler::RunTurn(ArbUt::BorrowedPtr<ChoiceQueue> queue) {
|
|||
}
|
||||
while (queue->HasNext()) {
|
||||
auto item = queue->Dequeue();
|
||||
AssertNotNull(item)
|
||||
AssertNotNull(item->GetUser())
|
||||
AssertNotNull(item->GetUser()->GetBattle())
|
||||
AssertNotNull(item->GetUser()->GetBattleSide())
|
||||
auto index = (uint32_t)item->GetUser()->GetBattleSide()->GetCreatureIndex(item->GetUser());
|
||||
|
||||
try_creature(ExecuteChoice(item.get()),
|
||||
"Executing choice failed for choice by mon on side "
|
||||
<< ((uint32_t)item.get()->GetUser()->GetBattleSide()->GetSideIndex()) << " and index "
|
||||
<< ((uint32_t)item.get()->GetUser()->GetBattleSide()->GetCreatureIndex(item->GetUser()))
|
||||
<< ((uint32_t)item->GetUser()->GetBattleSide()->GetSideIndex()) << " and index " << index
|
||||
<< ". Choice had choice kind "
|
||||
<< CreatureLib::Battling::TurnChoiceKindHelper::ToString(item->GetKind()) << " "
|
||||
<< " with message");
|
||||
|
@ -106,7 +111,7 @@ void TurnHandler::ExecuteAttackChoice(ArbUt::BorrowedPtr<AttackTurnChoice> choic
|
|||
|
||||
for (uint8_t i = 0; i < attack.GetTargetCount(); i++) {
|
||||
auto target = attack.GetTargets()[i];
|
||||
try_creature(HandleAttackForTarget(&attack, target), "Exception occured during handling attack for target");
|
||||
try_creature(HandleAttackForTarget(&attack, target), "Exception occurred during handling attack for target");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue