Do not try to load a definition directly from within .ocf and .ocs folders.

Definitions should be only in .ocd files. Although it might be nice e.g. to have mesh material directly in the scenario instead of in a .ocd subfolder, the engine tried to load the map image files as potential textures. It was also undocumented behavior.
shapetextures
Sven Eberhardt 2015-09-22 23:46:26 -04:00
parent 08f4d29d02
commit 28fab953f5
1 changed files with 14 additions and 6 deletions

View File

@ -83,10 +83,11 @@ int32_t C4DefList::Load(C4Group &hGroup, DWORD dwLoadWhat,
C4Group hChild;
bool fPrimaryDef=false;
bool fThisSearchMessage=false;
bool can_be_primary_def = SEqualNoCase(GetExtension(hGroup.GetName()), "ocd");
// This search message
if (fSearchMessage)
if (SEqualNoCase(GetExtension(hGroup.GetName()),"ocd")
if (can_be_primary_def
|| SEqualNoCase(GetExtension(hGroup.GetName()),"ocs")
|| SEqualNoCase(GetExtension(hGroup.GetName()),"ocf"))
{
@ -97,12 +98,19 @@ int32_t C4DefList::Load(C4Group &hGroup, DWORD dwLoadWhat,
if (fThisSearchMessage) { LogF("%s...",GetFilename(hGroup.GetName())); }
// Load primary definition
if ((nDef=new C4Def))
if (can_be_primary_def)
{
if (nDef->Load(hGroup, *SkeletonLoader, dwLoadWhat, szLanguage, pSoundSystem) && Add(nDef, fOverload))
{ iResult++; fPrimaryDef=true; }
else
{ delete nDef; }
if ((nDef = new C4Def))
{
if (nDef->Load(hGroup, *SkeletonLoader, dwLoadWhat, szLanguage, pSoundSystem) && Add(nDef, fOverload))
{
iResult++; fPrimaryDef = true;
}
else
{
delete nDef;
}
}
}
// Load sub definitions