Skip to content

Commit f11a1e6

Browse files
committed
Fix GeneralsMD ReadParameterJSON to use KindOfMaskType::getBitNames() instead of TheKindOf
1 parent ae4c0b4 commit f11a1e6

File tree

1 file changed

+48
-29
lines changed
  • GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine

1 file changed

+48
-29
lines changed

GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp

Lines changed: 48 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2562,46 +2562,65 @@ Parameter *Parameter::ReadParameterJSON(JSONChunkInput &file)
25622562

25632563
if (pParm->getParameterType() == KIND_OF_PARAM)
25642564
{
2565-
Bool found = false;
2566-
const char* const* kindofNames = TheKindOf->getKindOfNames();
2567-
Int i;
2568-
for( i = 0; kindofNames[i]; ++i )
2569-
{
2570-
if (pParm->m_string.compareNoCase(kindofNames[i]) == 0)
2571-
{
2572-
pParm->setInt(i);
2573-
found = true;
2574-
break;
2575-
}
2576-
}
2577-
if (!found)
2565+
const char* const* kindofNames = KindOfMaskType::getBitNames();
2566+
if (!pParm->m_string.isEmpty())
25782567
{
2579-
if (pParm->m_string.compareNoCase("MISSILE") == 0)
2568+
Bool found = false;
2569+
for (int i = 0; kindofNames[i]; ++i)
25802570
{
2581-
pParm->m_string.format( "SMALL_MISSILE" );
2582-
for( i = 0; kindofNames[i]; ++i )
2571+
if (pParm->m_string.compareNoCase(kindofNames[i]) == 0)
2572+
{
2573+
pParm->setInt(i);
2574+
found = true;
2575+
break;
2576+
}
2577+
if( !pParm->m_string.compareNoCase( "CRUSHER" ) )
2578+
{
2579+
pParm->setInt(i);
2580+
found = true;
2581+
DEBUG_CRASH(( "Kindof CRUSHER no longer exists -- in order to get your map to load, it has been switched to OBSTACLE, please call Kris (x36844).", pParm->m_string.str()));
2582+
break;
2583+
}
2584+
else if( !pParm->m_string.compareNoCase( "CRUSHABLE" ) )
2585+
{
2586+
pParm->setInt(i);
2587+
found = true;
2588+
DEBUG_CRASH(( "Kindof CRUSHABLE no longer exists -- in order to get your map to load, it has been switched to OBSTACLE, please call Kris (x36844).", pParm->m_string.str()));
2589+
break;
2590+
}
2591+
else if( !pParm->m_string.compareNoCase( "OVERLAPPABLE" ) )
2592+
{
2593+
pParm->setInt(i);
2594+
found = true;
2595+
DEBUG_CRASH(( "Kindof OVERLAPPABLE no longer exists -- in order to get your map to load, it has been switched to OBSTACLE, please call Kris (x36844).", pParm->m_string.str()));
2596+
break;
2597+
}
2598+
else if( !pParm->m_string.compareNoCase( "MISSILE" ) )
25832599
{
2584-
if (pParm->m_string.compareNoCase("SMALL_MISSILE") == 0)
2600+
pParm->m_string.format( "SMALL_MISSILE" );
2601+
for( i = 0; kindofNames[i]; ++i )
25852602
{
2586-
pParm->setInt(i);
2587-
found = true;
2588-
break;
2603+
if (pParm->m_string.compareNoCase("SMALL_MISSILE") == 0)
2604+
{
2605+
pParm->setInt(i);
2606+
found = true;
2607+
break;
2608+
}
25892609
}
2610+
DEBUG_CRASH(("Unable to find Kindof SMALL_MISSILE, please call KrisM (x36844)."));
25902611
}
2591-
DEBUG_CRASH(("Unable to find Kindof SMALL_MISSILE, please call KrisM (x36844)."));
2612+
}
2613+
if (!found)
2614+
{
2615+
DEBUG_CRASH(("Unable to find Kindof '%s', please call JKM (x36872).", pParm->m_string.str()));
2616+
throw ERROR_BUG;
25922617
}
25932618
}
2594-
if (!found)
2619+
else
25952620
{
2596-
DEBUG_CRASH(("Unable to find Kindof '%s', please call JKM (x36872).", pParm->m_string.str()));
2597-
throw ERROR_BUG;
2621+
pParm->m_string = kindofNames[pParm->m_int];
25982622
}
25992623
}
2600-
else
2601-
{
2602-
const char* const* kindofNames = TheKindOf->getKindOfNames();
2603-
pParm->m_string = kindofNames[pParm->m_int];
2604-
}
26052624

26062625
return pParm;
26072626
}

0 commit comments

Comments
 (0)