Skip to content

Commit

Permalink
Move remove_creature_from_reachability calls from the destructor to o…
Browse files Browse the repository at this point in the history
…n_unload. The avatar never unloads. (CleverRaven#69368)
  • Loading branch information
prharvey authored Nov 14, 2023
1 parent 1cf0c0e commit e8f77ab
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
7 changes: 1 addition & 6 deletions src/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
1 change: 1 addition & 0 deletions src/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions src/npc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit e8f77ab

Please sign in to comment.