Fix CON compiler line number accounting problem introduced with the optimization that transforms CON_SETVARVAR -> CON_SETVAR if the second parameter is a constant

git-svn-id: https://svn.eduke32.com/eduke32@7276 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-12-15 01:39:08 +00:00
parent b4404978d6
commit c287866954

View file

@ -3807,6 +3807,7 @@ setvar:
setvarvar: setvarvar:
auto ins = &g_scriptPtr[-1]; auto ins = &g_scriptPtr[-1];
auto tptr = textptr; auto tptr = textptr;
int const lnum = g_lineNumber;
C_GetNextVarType(GAMEVAR_READONLY); C_GetNextVarType(GAMEVAR_READONLY);
C_GetNextVar(); C_GetNextVar();
@ -3825,6 +3826,7 @@ setvarvar:
scriptWriteAtOffset(opcode | LINE_NUMBER, ins); scriptWriteAtOffset(opcode | LINE_NUMBER, ins);
g_scriptPtr = &ins[1]; g_scriptPtr = &ins[1];
textptr = tptr; textptr = tptr;
g_lineNumber = lnum;
goto setvar; goto setvar;
} }
@ -4120,7 +4122,7 @@ setvarvar:
continue; continue;
case CON_ACTIVATE: case CON_ACTIVATE:
g_scriptPtr[-1] = CON_OPERATEACTIVATORS; g_scriptPtr[-1] = CON_OPERATEACTIVATORS | LINE_NUMBER;
C_GetNextValue(LABEL_DEFINE); C_GetNextValue(LABEL_DEFINE);
scriptWriteValue(0); scriptWriteValue(0);
continue; continue;
@ -4253,6 +4255,8 @@ setvarvar:
{ {
C_ReportError(ERROR_FOUNDWITHIN); C_ReportError(ERROR_FOUNDWITHIN);
g_errorCnt++; g_errorCnt++;
scriptSkipLine();
continue;
} }
g_scriptPtr--; g_scriptPtr--;
@ -4265,6 +4269,7 @@ setvarvar:
{ {
C_ReportError(ERROR_EXCEEDSMAXTILES); C_ReportError(ERROR_EXCEEDSMAXTILES);
g_errorCnt++; g_errorCnt++;
scriptSkipLine();
continue; continue;
} }
@ -4290,6 +4295,8 @@ setvarvar:
{ {
C_ReportError(ERROR_EXCEEDSMAXTILES); C_ReportError(ERROR_EXCEEDSMAXTILES);
g_errorCnt++; g_errorCnt++;
scriptSkipLine();
continue;
} }
g_tile[j].cacherange = i; g_tile[j].cacherange = i;
@ -4324,6 +4331,7 @@ setvarvar:
auto const ins = &g_scriptPtr[-1]; auto const ins = &g_scriptPtr[-1];
auto const lastScriptPtr = &g_scriptPtr[-1] - apScript; auto const lastScriptPtr = &g_scriptPtr[-1] - apScript;
auto const lasttextptr = textptr; auto const lasttextptr = textptr;
int const lnum = g_lineNumber;
g_skipBranch = false; g_skipBranch = false;
@ -4347,6 +4355,7 @@ setvarvar:
tw = opcode; tw = opcode;
g_scriptPtr = &ins[1]; g_scriptPtr = &ins[1];
textptr = lasttextptr; textptr = lasttextptr;
g_lineNumber = lnum;
goto ifvar; goto ifvar;
} }
} }