- fixed key number assignment during parsing of locks

https://forum.zdoom.org/viewtopic.php?t=63171
This commit is contained in:
alexey.lysiuk 2019-01-07 14:45:04 +02:00 committed by Christoph Oelckers
parent 59d84296bf
commit 86acb876f1

View file

@ -229,7 +229,7 @@ static void PrintMessage (const char *str)
// //
//=========================================================================== //===========================================================================
static void ParseLock(FScanner &sc) static void ParseLock(FScanner &sc, int &currentnumber)
{ {
int i,r,g,b; int i,r,g,b;
int keynum; int keynum;
@ -246,7 +246,6 @@ static void ParseLock(FScanner &sc)
sc.MustGetStringName("{"); sc.MustGetStringName("{");
} }
int currentnumber = 0;
if (keynum == 0 || keynum < -1) if (keynum == 0 || keynum < -1)
{ {
sc.ScriptError("Lock index %d out of range", keynum); sc.ScriptError("Lock index %d out of range", keynum);
@ -418,7 +417,7 @@ static void CreateSortedKeyList()
void P_InitKeyMessages() void P_InitKeyMessages()
{ {
int lastlump, lump; int lastlump, lump, currentnumber = 0;
lastlump = 0; lastlump = 0;
@ -430,12 +429,13 @@ void P_InitKeyMessages()
{ {
if (sc.Compare("LOCK")) if (sc.Compare("LOCK"))
{ {
ParseLock(sc); ParseLock(sc, currentnumber);
} }
else if (sc.Compare("CLEARLOCKS")) else if (sc.Compare("CLEARLOCKS"))
{ {
// clear all existing lock definitions and key numbers // clear all existing lock definitions and key numbers
ClearLocks(); ClearLocks();
currentnumber = 0;
} }
else else
{ {