Fix Mandrake object passability

This commit is contained in:
Ihar Hubchyk
2025-01-05 14:55:14 +08:00
parent cf0a1ddb15
commit 22ade06e59
3 changed files with 22 additions and 4 deletions
+19 -1
View File
@@ -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.
+2 -2
View File
@@ -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 );
+1 -1
View File
@@ -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." )