From f49d5c3d08215bd03b55aa5647a9db2e139ac73e Mon Sep 17 00:00:00 2001 From: Renato Machado Date: Fri, 8 Nov 2024 20:29:20 -0300 Subject: [PATCH] cleanup --- src/creatures/creature.cpp | 4 +--- src/game/game.cpp | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/creatures/creature.cpp b/src/creatures/creature.cpp index fadff668f8d..4fe9b6c998a 100644 --- a/src/creatures/creature.cpp +++ b/src/creatures/creature.cpp @@ -154,9 +154,7 @@ void Creature::checkCreatureAttack(bool now) { g_dispatcher().addEvent([self = std::weak_ptr(getCreature())] { if (const auto &creature = self.lock()) { - if (creature->isAlive()) { - creature->onAttacking(0); - } + creature->checkCreatureAttack(true); } }, "Creature::checkCreatureAttack"); } diff --git a/src/game/game.cpp b/src/game/game.cpp index f97084c406e..49bfc3813c2 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -6425,7 +6425,7 @@ void Game::checkCreatures() { static size_t index = 0; std::erase_if(checkCreatureLists[index], [this](const std::shared_ptr creature) { - if (creature->creatureCheck && creature->isAlive()) { + if (creature && creature->creatureCheck && creature->isAlive()) { creature->onThink(EVENT_CREATURE_THINK_INTERVAL); creature->onAttacking(EVENT_CREATURE_THINK_INTERVAL); creature->executeConditions(EVENT_CREATURE_THINK_INTERVAL);