- fixed Dehacked parsing issues with weapon properties.

Due to a badly used string length check this code didn't really do what it was supposed to.
This commit is contained in:
Christoph Oelckers 2022-01-07 00:31:57 +01:00
parent 64ef03428d
commit 49ab6612cb

View file

@ -2059,13 +2059,12 @@ static int PatchWeapon (int weapNum)
{
int val = atoi (Line2);
if (strlen (Line1) >= 9)
{
if (stricmp (Line1 + strlen (Line1) - 6, " frame") == 0)
size_t len = strlen(Line1);
if (len > 6 && stricmp (Line1 + len - 6, " frame") == 0)
{
FState *state = FindState (val);
if (type != NULL && !patchedStates)
if (type != nullptr && !patchedStates)
{
statedef.MakeStateDefines(type);
patchedStates = true;
@ -2103,16 +2102,11 @@ static int PatchWeapon (int weapNum)
}
}
}
else
{
Printf (unknown_str, Line1, "Weapon", weapNum);
}
}
else if (stricmp (Line1, "Decal") == 0)
{
stripwhite (Line2);
const FDecalTemplate *decal = DecalLibrary.GetDecalByName (Line2);
if (decal != NULL)
if (decal != nullptr)
{
if (info) info->DecalGenerator = const_cast <FDecalTemplate *>(decal);
}