mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2024-12-26 06:45:31 +03:00
Added support for nested instances relative to their parents, which is what Hammer uses to display them
This commit is contained in:
parent
b2116d07e9
commit
7e96be39b2
@ -2603,6 +2603,27 @@ void CMapFile::MergeEntities( entity_t *pInstanceEntity, CMapFile *Instance, Vec
|
|||||||
SetKeyValue( entity, szKey, epInstance->value );
|
SetKeyValue( entity, szKey, epInstance->value );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the parent instance is within a relative path and no file relative to the main map exists, change it to be relative to the parent
|
||||||
|
char *pParentInstanceFile = ValueForKey( pInstanceEntity, "file" );
|
||||||
|
if ( pParentInstanceFile[ 0 ] && (strchr( pParentInstanceFile, '\\' ) || strchr( pParentInstanceFile, '/' )) )
|
||||||
|
{
|
||||||
|
char *pInstanceFile = ValueForKey( entity, "file" );
|
||||||
|
if ( pInstanceFile[ 0 ] )
|
||||||
|
{
|
||||||
|
char InstancePath[ MAX_PATH ];
|
||||||
|
|
||||||
|
if ( !DeterminePath( g_MainMapPath, pInstanceFile, InstancePath ) )
|
||||||
|
{
|
||||||
|
strcpy( InstancePath, pParentInstanceFile );
|
||||||
|
V_StripFilename( InstancePath );
|
||||||
|
V_strncat( InstancePath, "\\", sizeof( InstancePath ) );
|
||||||
|
V_strncat( InstancePath, pInstanceFile, sizeof( InstancePath ) );
|
||||||
|
|
||||||
|
SetKeyValue( entity, "file", InstancePath );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user