From 253dea7610bc862c53e4d165cae734d126bac549 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 22 Jul 2020 22:27:51 +0200 Subject: [PATCH] - removed parsing_ifelse sanity check because it breaks compilation in a few case. if there ever needed to be proof that CON is broken beyond repair this should be it, this will allow broken code to slip through the parser and apparently some scripts exploit this bug. NAM's soldiers won't work with the 'proper' code. --- source/games/duke/src/gamedef.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source/games/duke/src/gamedef.cpp b/source/games/duke/src/gamedef.cpp index 8a1214047..cc14ea3c1 100644 --- a/source/games/duke/src/gamedef.cpp +++ b/source/games/duke/src/gamedef.cpp @@ -722,7 +722,6 @@ void ConCompiler::checkforkeyword() // //--------------------------------------------------------------------------- - int ConCompiler::parsecommand() { const char* fn = fileSystem.GetFileFullName(currentsourcefile); @@ -1499,6 +1498,7 @@ int ConCompiler::parsecommand() // case concmd_ifpupwind: if_common: // this code is identical for all 'if...'instructions. + { tempscrptr = scriptpos(); reservescriptspace(1); //Leave a spot for the fail location @@ -1506,10 +1506,15 @@ int ConCompiler::parsecommand() parsecommand(); setscriptvalue(tempscrptr, scriptpos()); - if (keyword() == concmd_else) // only increment checking_ifelse if there actually is an else. Otherwise this would break the entire checking logic and render it non-functional + auto k = keyword(); + // Cannot be done - the code starts misbehaving with this check, it is especially noticeable on the soldiers in NAM. + // Unfortunately this means one less error check, but ultimately CON is too broken to begin with anyway +#if 0 + if (k == concmd_else) / only increment checking_ifelse if there actually is an else. Otherwise this would break the entire checking logic and render it non-functional +#endif checking_ifelse++; return 0; - + } case concmd_leftbrace: num_squigilly_brackets++; do