Skip to content

Commit

Permalink
- fixed UMAPINFO episode parsing
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
alexey-lysiuk committed Jul 16, 2019
1 parent 454fd28 commit 36ed7e5
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/gamedata/umapinfo.cpp
Expand Up @@ -82,10 +82,13 @@ static FString ParseMultiString(FScanner &scanner, int error)
}
}

bool first = true;

do
{
scanner.MustGetToken(TK_StringConst);
if (build.Len() > 0) build += "\n";
if (first) first = false;
else build += "\n";
build += scanner.String;
}
while (scanner.CheckToken(','));
Expand Down Expand Up @@ -224,10 +227,21 @@ static int ParseStandardProperty(FScanner &scanner, UMapEntry *mape)
// add the given episode
FEpisode epi;

epi.mEpisodeName = strbin1(split[1]);
if (split.Size() > 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.mPicName = split[0];
epi.mShortcut = split[2][0];
epi.mNoSkill = false;

unsigned i;
Expand Down

0 comments on commit 36ed7e5

Please sign in to comment.