diff --git a/src/fheroes2/maps/maps_tiles.cpp b/src/fheroes2/maps/maps_tiles.cpp index fdcf2c6b5..91a6db4ba 100644 --- a/src/fheroes2/maps/maps_tiles.cpp +++ b/src/fheroes2/maps/maps_tiles.cpp @@ -1292,8 +1292,26 @@ void Maps::Tile::_updateRoadFlag() } } -void Maps::Tile::fixMP2MapTileObjectType( Tile & tile ) +void Maps::Tile::fixMP2MapTileObjects( Tile & tile ) { + const auto fixMandrakeObjectPart = []( Maps::ObjectPart & part ) { + if ( part.icnType != MP2::OBJ_ICN_TYPE_OBJNSWMP ) { + return; + } + + if ( part.icnIndex == 131 || part.icnIndex == 137 ) { + part.layerType = Maps::OBJECT_LAYER; + } + else if ( part.icnIndex == 130 || part.icnIndex == 136 ) { + part.layerType = Maps::SHADOW_LAYER; + } + }; + + fixMandrakeObjectPart( tile.getMainObjectPart() ); + for ( auto & part : tile.getGroundObjectParts() ) { + fixMandrakeObjectPart( part ); + } + const MP2::MapObjectType originalObjectType = tile.getMainObjectType( false ); // Left tile of a skeleton on Desert should be marked as non-action tile. diff --git a/src/fheroes2/maps/maps_tiles.h b/src/fheroes2/maps/maps_tiles.h index 14378b50b..ae5c6387b 100644 --- a/src/fheroes2/maps/maps_tiles.h +++ b/src/fheroes2/maps/maps_tiles.h @@ -328,8 +328,8 @@ namespace Maps _fogDirection = fogDirection; } - // Some tiles have incorrect object type. This is due to original Editor issues. - static void fixMP2MapTileObjectType( Tile & tile ); + // Some tiles have objects being set. This is due to original Editor issues. + static void fixMP2MapTileObjects( Tile & tile ); static int32_t getIndexOfMainTile( const Tile & tile ); diff --git a/src/fheroes2/world/world_loadmap.cpp b/src/fheroes2/world/world_loadmap.cpp index 4158b6bfc..8c02ef57e 100644 --- a/src/fheroes2/world/world_loadmap.cpp +++ b/src/fheroes2/world/world_loadmap.cpp @@ -1258,7 +1258,7 @@ bool World::loadResurrectionMap( const std::string & filename ) bool World::ProcessNewMP2Map( const std::string & filename, const bool checkPoLObjects ) { for ( Maps::Tile & tile : vec_tiles ) { - Maps::Tile::fixMP2MapTileObjectType( tile ); + Maps::Tile::fixMP2MapTileObjects( tile ); if ( !updateTileMetadata( tile, tile.getMainObjectType(), checkPoLObjects ) ) { ERROR_LOG( "Failed to load The Price of Loyalty map '" << filename << "' which is not supported by this version of the game." )