mirror of
https://github.com/ihhub/fheroes2.git
synced 2026-10-11 21:59:51 +00:00
Fix Mandrake object passability
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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." )
|
||||
|
||||
Reference in New Issue
Block a user