From 11255cbf6a13089355316f2fc3edc9aa8220b1f8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 12 May 2020 23:19:01 +0200 Subject: [PATCH] - hack for buggy scripts in production code. --- source/games/duke/src/gamedef.cpp | 56 +++++++++++++++++-------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/source/games/duke/src/gamedef.cpp b/source/games/duke/src/gamedef.cpp index ce33ddf07..ff0107cdb 100644 --- a/source/games/duke/src/gamedef.cpp +++ b/source/games/duke/src/gamedef.cpp @@ -224,6 +224,33 @@ int findlabel(const char* text) return -1; } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +bool ispecial(char c) +{ + if (c == 0x0a) + { + line_number++; + return true; + } + + // oh joy - we need to skip some more characters here to allow running broken scripts. + if (c == ' ' || c == 0x0d || c == '(' || c == ')' || c == ',' || c == ';') + return true; + + return false; +} + +bool isaltok(char c) +{ + // isalnum pukes on negative input. + return c > 0 && (isalnum(c) || c == '{' || c == '}' || c == '/' || c == '*' || c == '-' || c == '_' || c == '.'); +} + //--------------------------------------------------------------------------- // // @@ -272,6 +299,9 @@ bool skipcomments() continue; } // stop if we got something else + + // this line got added to skip over a stray semicolon in RR's COOT.CON. + if (ispecial(*textptr)) textptr++; break; } return *textptr != 0; @@ -283,32 +313,6 @@ bool skipcomments() // //--------------------------------------------------------------------------- -bool ispecial(char c) -{ - if (c == 0x0a) - { - line_number++; - return true; - } - - if (c == ' ' || c == 0x0d) - return true; - - return false; -} - -bool isaltok(char c) -{ - // isalnum pukes on negative input. - return c > 0 && (isalnum(c) || c == '{' || c == '}' || c == '/' || c == '*' || c == '-' || c == '_' || c == '.'); -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - int keyword(void) { int i;