Skip to content

Commit

Permalink
Fix passabilities of objects on map (#3756)
Browse files Browse the repository at this point in the history
  • Loading branch information
ihhub authored Jun 30, 2021
1 parent d0efeea commit dcf2992
Show file tree
Hide file tree
Showing 11 changed files with 411 additions and 685 deletions.
4 changes: 2 additions & 2 deletions src/fheroes2/dialog/dialog_quickinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,9 @@ void Dialog::QuickInfo( const Maps::Tiles & tile )
const Maps::Tiles & right = world.GetTiles( tile.GetIndex() + 1 );
const Maps::Tiles * center = nullptr;

if ( MP2::isGroundObject( left.GetObject( false ) ) )
if ( MP2::isActionObject( left.GetObject( false ) ) )
center = &left;
else if ( MP2::isGroundObject( right.GetObject( false ) ) )
else if ( MP2::isActionObject( right.GetObject( false ) ) )
center = &right;

if ( center ) {
Expand Down
2 changes: 1 addition & 1 deletion src/fheroes2/game/game_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ int32_t Interface::Basic::GetDimensionDoorDestination( const int32_t from, const
if ( valid ) {
const Maps::Tiles & tile = world.GetTiles( dst );

valid = ( ( spellROI & mp ) && MP2::isClearGroundObject( tile.GetObject() ) && water == world.GetTiles( dst ).isWater() );
valid = ( ( spellROI & mp ) && tile.isClearGround() && water == tile.isWater() );
}

cursor.SetThemes( valid ? ( water ? static_cast<int>( Cursor::CURSOR_HERO_BOAT ) : static_cast<int>( Cursor::CURSOR_HERO_MOVE ) )
Expand Down
4 changes: 2 additions & 2 deletions src/fheroes2/game/game_startgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ int Interface::Basic::GetCursorFocusShipmaster( const Heroes & from_hero, const

default:
if ( water ) {
if ( MP2::isWaterObject( tile.GetObject() ) )
if ( MP2::isWaterActionObject( tile.GetObject() ) )
return Cursor::DistanceThemes( Cursor::CURSOR_HERO_BOAT_ACTION, from_hero.GetRangeRouteDays( tile.GetIndex() ) );
else if ( tile.isPassable( Direction::CENTER, true, false, from_hero.GetColor() ) )
return Cursor::DistanceThemes( Cursor::CURSOR_HERO_BOAT, from_hero.GetRangeRouteDays( tile.GetIndex() ) );
Expand Down Expand Up @@ -506,7 +506,7 @@ int Interface::Basic::GetCursorFocusHeroes( const Heroes & from_hero, const Maps
default:
if ( from_hero.Modes( Heroes::GUARDIAN ) )
return Cursor::POINTER;
else if ( MP2::isGroundObject( tile.GetObject() ) ) {
else if ( MP2::isActionObject( tile.GetObject() ) ) {
bool protection = false;
if ( !MP2::isPickupObject( tile.GetObject() ) && !MP2::isAbandonedMine( tile.GetObject() ) ) {
protection = ( Maps::TileIsUnderProtection( tile.GetIndex() ) || ( !from_hero.isFriends( tile.QuantityColor() ) && tile.CaptureObjectIsProtection() ) );
Expand Down
2 changes: 1 addition & 1 deletion src/fheroes2/kingdom/kingdom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ void Kingdom::SetVisited( s32 index, int object )

bool Kingdom::isValidKingdomObject( const Maps::Tiles & tile, int objectID ) const
{
if ( !MP2::isGroundObject( objectID ) && objectID != MP2::OBJ_COAST )
if ( !MP2::isActionObject( objectID ) && objectID != MP2::OBJ_COAST )
return false;

if ( isVisited( tile.GetIndex(), objectID ) )
Expand Down
Loading

0 comments on commit dcf2992

Please sign in to comment.