diff --git a/src/creature.cpp b/src/creature.cpp index 81278e888a125..11b257baa79e1 100644 --- a/src/creature.cpp +++ b/src/creature.cpp @@ -168,12 +168,7 @@ Creature::Creature( Creature && ) noexcept( map_is_noexcept &&list_is_noexcept ) Creature &Creature::operator=( const Creature & ) = default; Creature &Creature::operator=( Creature && ) noexcept = default; -Creature::~Creature() -{ - if( g ) { - get_map().remove_creature_from_reachability( this ); - } -} +Creature::~Creature() = default; tripoint Creature::pos() const { diff --git a/src/monster.cpp b/src/monster.cpp index 427c71995eb4d..34c5c0ed34fc3 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -3703,6 +3703,7 @@ bool monster::will_join_horde( int size ) void monster::on_unload() { last_updated = calendar::turn; + get_map().remove_creature_from_reachability( this ); } void monster::on_load() diff --git a/src/npc.cpp b/src/npc.cpp index a467497c68164..e48cc66d2f53e 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -3196,6 +3196,7 @@ void npc::add_new_mission( class mission *miss ) void npc::on_unload() { + get_map().remove_creature_from_reachability( this ); } // A throtled version of player::update_body since npc's don't need to-the-turn updates.