Skip to content

Commit

Permalink
Remove updateEmpty() method. Use its code in the only place where i…
Browse files Browse the repository at this point in the history
…t is used
  • Loading branch information
Districh-ru committed Jul 13, 2024
1 parent ab6c643 commit ba65a24
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
7 changes: 0 additions & 7 deletions src/fheroes2/maps/maps_tiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1454,13 +1454,6 @@ void Maps::Tiles::updateTileObjectIcnIndex( Maps::Tiles & tile, const uint32_t u
tile._updateRoadFlag();
}

void Maps::Tiles::updateEmpty()
{
if ( _mainObjectType == MP2::OBJ_NONE ) {
updateObjectType();
}
}

void Maps::Tiles::updateObjectType()
{
// After removing an action object there could be some other object part in the main addon.
Expand Down
3 changes: 0 additions & 3 deletions src/fheroes2/maps/maps_tiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,6 @@ namespace Maps
Heroes * getHero() const;
void setHero( Heroes * hero );

// If tile is empty (MP2::OBJ_NONE) then update tile's object type if needed.
void updateEmpty();

// Set tile's object type according to the object's sprite if there is any, otherwise
// it is set to coast (MP2::OBJ_COAST) if it's near water or to empty (MP2::OBJ_NONE).
void updateObjectType();
Expand Down
6 changes: 5 additions & 1 deletion src/fheroes2/world/world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,11 @@ void World::resetPathfinder()
void World::updatePassabilities()
{
for ( Maps::Tiles & tile : vec_tiles ) {
tile.updateEmpty();
// If tile is empty then update tile's object type if needed.
if ( tile.isSameMainObject( MP2::OBJ_NONE ) ) {
tile.updateObjectType();
}

tile.setInitialPassability();
}

Expand Down

0 comments on commit ba65a24

Please sign in to comment.