From 86acb876f12fb62ed1a4c716999a8d42e51f3d12 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 7 Jan 2019 14:45:04 +0200 Subject: [PATCH] - fixed key number assignment during parsing of locks https://forum.zdoom.org/viewtopic.php?t=63171 --- src/g_inventory/a_keys.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/g_inventory/a_keys.cpp b/src/g_inventory/a_keys.cpp index f123e048c8..8173405791 100644 --- a/src/g_inventory/a_keys.cpp +++ b/src/g_inventory/a_keys.cpp @@ -229,7 +229,7 @@ static void PrintMessage (const char *str) // //=========================================================================== -static void ParseLock(FScanner &sc) +static void ParseLock(FScanner &sc, int ¤tnumber) { int i,r,g,b; int keynum; @@ -246,7 +246,6 @@ static void ParseLock(FScanner &sc) sc.MustGetStringName("{"); } - int currentnumber = 0; if (keynum == 0 || keynum < -1) { sc.ScriptError("Lock index %d out of range", keynum); @@ -418,7 +417,7 @@ static void CreateSortedKeyList() void P_InitKeyMessages() { - int lastlump, lump; + int lastlump, lump, currentnumber = 0; lastlump = 0; @@ -430,12 +429,13 @@ void P_InitKeyMessages() { if (sc.Compare("LOCK")) { - ParseLock(sc); + ParseLock(sc, currentnumber); } else if (sc.Compare("CLEARLOCKS")) { // clear all existing lock definitions and key numbers ClearLocks(); + currentnumber = 0; } else {