Skip to content

Commit

Permalink
Remove additional passability marks on the bottom part of tiles (#9410)
Browse files Browse the repository at this point in the history
  • Loading branch information
ihhub authored Jan 5, 2025
1 parent b83008d commit 33c6233
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions src/fheroes2/maps/maps_tiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,24 +790,29 @@ void Maps::Tile::updatePassability()
const MP2::MapObjectType correctedObjectType = MP2::getBaseActionObjectType( bottomTileObjectType );

if ( MP2::isOffGameActionObject( bottomTileObjectType ) || MP2::isOffGameActionObject( correctedObjectType ) ) {
if ( ( bottomTile.getTileIndependentPassability() & Direction::TOP ) == 0 ) {
if ( isShortObject( bottomTileObjectType ) || isShortObject( correctedObjectType ) ) {
_tilePassabilityDirections &= ~Direction::BOTTOM;
}
else {
_tilePassabilityDirections = 0;
return;
}
if ( ( bottomTile.getTileIndependentPassability() & Direction::TOP ) != 0 ) {
// This is an action object with unrestricted access from top.

// Only main action object parts can have unrestricted access.
assert( MP2::isOffGameActionObject( bottomTileObjectType ) );
return;
}

if ( !isShortObject( bottomTileObjectType ) && !isShortObject( correctedObjectType ) ) {
// Since the object on the tile below is considered as tall we must mark this tile as impassable.
_tilePassabilityDirections = 0;
}

return;
}
else if ( isShortObject( bottomTileObjectType )
|| ( !bottomTile.containsAnyObjectIcnType( getValidObjectIcnTypes() )
&& ( isCombinedObject( objectType ) || isCombinedObject( bottomTileObjectType ) ) ) ) {
_tilePassabilityDirections &= ~Direction::BOTTOM;

if ( isShortObject( bottomTileObjectType )
|| ( !bottomTile.containsAnyObjectIcnType( getValidObjectIcnTypes() ) && ( isCombinedObject( objectType ) || isCombinedObject( bottomTileObjectType ) ) ) ) {
// If this assertion blows up then the above checks are invalid!
assert( ( bottomTile.getTileIndependentPassability() & Direction::TOP ) == 0 );
}
else {
_tilePassabilityDirections = 0;
return;
}
}
}
Expand Down

0 comments on commit 33c6233

Please sign in to comment.