From 822c9971c5beebf14fa8b691086c193addbaf6d1 Mon Sep 17 00:00:00 2001
From: biwa <6475593+biwa@users.noreply.github.com>
Date: Sat, 24 Jun 2023 11:19:09 +0200
Subject: [PATCH] ZScript: fixed a problem where state goto expressions were
 not parsed correctly. Fixes #913

---
 Source/Core/ZDoom/ZScriptStateGoto.cs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Source/Core/ZDoom/ZScriptStateGoto.cs b/Source/Core/ZDoom/ZScriptStateGoto.cs
index 82c88ebbe..46885ead3 100755
--- a/Source/Core/ZDoom/ZScriptStateGoto.cs
+++ b/Source/Core/ZDoom/ZScriptStateGoto.cs
@@ -36,12 +36,15 @@ namespace CodeImp.DoomBuilder.ZDoom
                     return;
             }
 
+            // TODO: Zscript allows complex mathematical opeartions, not use addition.
+            // example: Goto Spawn + 5 * 2 - 7;
+            // Values of identifies are not used right now and always use 0
             tokenizer.SkipWhitespace();
             token = tokenizer.ExpectToken(ZScriptTokenType.OpAdd);
             if (token != null && token.IsValid)
             {
                 tokenizer.SkipWhitespace();
-                token = tokenizer.ExpectToken(ZScriptTokenType.Integer);
+                token = tokenizer.ExpectToken(ZScriptTokenType.Integer, ZScriptTokenType.Identifier);
                 if (token == null || !token.IsValid)
                 {
                     parser.ReportError("Expected state offset, got " + ((Object)token ?? "<null>").ToString());
-- 
GitLab