- 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.
This commit is contained in:
Christoph Oelckers 2020-07-22 22:27:51 +02:00
parent 7d414fcfa5
commit 253dea7610

View file

@ -722,7 +722,6 @@ void ConCompiler::checkforkeyword()
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int ConCompiler::parsecommand() int ConCompiler::parsecommand()
{ {
const char* fn = fileSystem.GetFileFullName(currentsourcefile); const char* fn = fileSystem.GetFileFullName(currentsourcefile);
@ -1499,6 +1498,7 @@ int ConCompiler::parsecommand()
// case concmd_ifpupwind: // case concmd_ifpupwind:
if_common: // this code is identical for all 'if...'instructions. if_common: // this code is identical for all 'if...'instructions.
{
tempscrptr = scriptpos(); tempscrptr = scriptpos();
reservescriptspace(1); //Leave a spot for the fail location reservescriptspace(1); //Leave a spot for the fail location
@ -1506,10 +1506,15 @@ int ConCompiler::parsecommand()
parsecommand(); parsecommand();
setscriptvalue(tempscrptr, scriptpos()); 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++; checking_ifelse++;
return 0; return 0;
}
case concmd_leftbrace: case concmd_leftbrace:
num_squigilly_brackets++; num_squigilly_brackets++;
do do