Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mehah committed Nov 8, 2024
1 parent a230d90 commit f49d5c3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/creatures/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ void Creature::checkCreatureAttack(bool now) {

g_dispatcher().addEvent([self = std::weak_ptr<Creature>(getCreature())] {
if (const auto &creature = self.lock()) {
if (creature->isAlive()) {
creature->onAttacking(0);
}
creature->checkCreatureAttack(true);
} }, "Creature::checkCreatureAttack");
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6425,7 +6425,7 @@ void Game::checkCreatures() {
static size_t index = 0;

std::erase_if(checkCreatureLists[index], [this](const std::shared_ptr<Creature> 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);
Expand Down

0 comments on commit f49d5c3

Please sign in to comment.