Fixes invalid pointers to a battle dangling when a battle is removed.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
@@ -6,11 +6,11 @@
|
||||
|
||||
using namespace CreatureLib::Battling;
|
||||
|
||||
void TurnHandler::RunTurn(ArbUt::BorrowedPtr<ChoiceQueue> queue) {
|
||||
void TurnHandler::RunTurn(ArbUt::BorrowedPtr<ChoiceQueue> queue, ArbUt::BorrowedPtr<Battle> battle) {
|
||||
for (auto choice : queue->GetInnerQueue()) {
|
||||
HOOK(OnBeforeTurn, choice, choice.get());
|
||||
}
|
||||
while (queue->HasNext()) {
|
||||
while (queue->HasNext() && !battle->HasEnded()) {
|
||||
auto item = queue->Dequeue();
|
||||
EnsureNotNull(item)
|
||||
Ensure(item->GetUser()->GetBattle().HasValue())
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace CreatureLib::Battling {
|
||||
static void ExecuteFleeChoice(ArbUt::BorrowedPtr<FleeTurnChoice> choice);
|
||||
|
||||
public:
|
||||
static void RunTurn(ArbUt::BorrowedPtr<ChoiceQueue> queue);
|
||||
static void RunTurn(ArbUt::BorrowedPtr<ChoiceQueue> queue, ArbUt::BorrowedPtr<Battle> battle);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user