- fixed UMAPINFO episode parsing

* bounds checking for accessing episode tokens
* support empty tokens in episode definition
* handle upper cased episode shortcut

https://forum.zdoom.org/viewtopic.php?t=65364
This commit is contained in:
alexey.lysiuk 2019-07-16 12:39:11 +03:00
parent 454fd288a0
commit 36ed7e5182

View file

@ -82,10 +82,13 @@ static FString ParseMultiString(FScanner &scanner, int error)
} }
} }
bool first = true;
do do
{ {
scanner.MustGetToken(TK_StringConst); scanner.MustGetToken(TK_StringConst);
if (build.Len() > 0) build += "\n"; if (first) first = false;
else build += "\n";
build += scanner.String; build += scanner.String;
} }
while (scanner.CheckToken(',')); while (scanner.CheckToken(','));
@ -224,10 +227,21 @@ static int ParseStandardProperty(FScanner &scanner, UMapEntry *mape)
// add the given episode // add the given episode
FEpisode epi; FEpisode epi;
if (split.Size() > 1)
{
epi.mEpisodeName = strbin1(split[1]); epi.mEpisodeName = strbin1(split[1]);
}
if (split.Size() > 2 && split[2].IsNotEmpty())
{
split[2].ToLower();
epi.mShortcut = split[2][0];
}
else
{
epi.mShortcut = '\0';
}
epi.mEpisodeMap = mape->MapName; epi.mEpisodeMap = mape->MapName;
epi.mPicName = split[0]; epi.mPicName = split[0];
epi.mShortcut = split[2][0];
epi.mNoSkill = false; epi.mNoSkill = false;
unsigned i; unsigned i;