Improve error message when using functions in Hexen-compat mode

- When trying to define a function with the -h switch, you previously
  got two error messages on the token following the function, making it
  unclear what the problem was. There is now only one error message at the
  end of the function's parameter list.
This commit is contained in:
Randy Heit 2014-07-24 15:00:31 -05:00
parent ac678ff7b8
commit fafedb271d
3 changed files with 8 additions and 9 deletions

View file

@ -500,6 +500,10 @@ static void Outside(void)
{
MS_Message(MSG_DEBUG, "Allocations modified for exporting\n");
ImportMode = IMPORT_Exporting;
if(pc_EnforceHexen)
{
ERR_Error(ERR_HEXEN_COMPAT, YES);
}
}
else if(ImportMode == IMPORT_Importing)
{
@ -869,6 +873,10 @@ static void OuterFunction(void)
} while(tk_Token == TK_COMMA);
TK_TokenMustBe(TK_RPAREN, ERR_MISSING_RPAREN);
}
if(pc_EnforceHexen)
{
ERR_Error(ERR_HEXEN_COMPAT, YES);
}
sym->info.scriptFunc.sourceLine = defLine;
sym->info.scriptFunc.sourceName = tk_SourceName;

View file

@ -1529,11 +1529,6 @@ void PC_AddFunction(symbolNode_t *sym, int arrayCount, int *arraySizes)
{
ERR_Error(ERR_TOO_MANY_FUNCTIONS, YES, NULL);
}
else if(pc_EnforceHexen)
{
ERR_Error(ERR_HEXEN_COMPAT, YES);
}
function = &FunctionInfo[pc_FunctionCount];
function->hasReturnValue = (U_BYTE)sym->info.scriptFunc.hasReturnValue;
function->argCount = (U_BYTE)sym->info.scriptFunc.argCount;

View file

@ -269,10 +269,6 @@ int STR_AppendToList(int list, char *name)
StringLists[list] = MS_Alloc(sizeof(stringList_t), ERR_OUT_OF_MEMORY);
StringLists[list]->stringCount = 0;
NumStringLists++;
if(pc_EnforceHexen)
{
ERR_Error(ERR_HEXEN_COMPAT, YES);
}
}
return STR_PutStringInSomeList(StringLists[list], StringLists[list]->stringCount, name);
}