From fafedb271d27587db7975dccc2aa145f758a5fb7 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 24 Jul 2014 15:00:31 -0500 Subject: [PATCH] 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. --- parse.c | 8 ++++++++ pcode.c | 5 ----- strlist.c | 4 ---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/parse.c b/parse.c index 43d2843..fa84bf4 100644 --- a/parse.c +++ b/parse.c @@ -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; diff --git a/pcode.c b/pcode.c index 0124430..847bcdb 100644 --- a/pcode.c +++ b/pcode.c @@ -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; diff --git a/strlist.c b/strlist.c index b79b29a..dab89a6 100644 --- a/strlist.c +++ b/strlist.c @@ -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); }