From 2f1ae66898fd4834d2a0b9cd7634a9b7a228515a Mon Sep 17 00:00:00 2001 From: Ben Millwood Date: Sat, 3 Oct 2009 13:06:54 +0000 Subject: * Fix a parser bug relating to whitespace at the end of scripts --- src/qcommon/parse.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/qcommon') diff --git a/src/qcommon/parse.c b/src/qcommon/parse.c index c3b6e0ce..9ad5b5fd 100644 --- a/src/qcommon/parse.c +++ b/src/qcommon/parse.c @@ -1235,13 +1235,22 @@ static int Parse_ReadSourceToken(source_t *source, token_t *token) { token_t *t; script_t *script; - int type, skip; + int type, skip, lines; + lines = 0; //if there's no token already available while(!source->tokens) { //if there's a token to read from the script - if (Parse_ReadScriptToken(source->scriptstack, token)) return qtrue; + if( Parse_ReadScriptToken( source->scriptstack, token ) ) + { + token->linescrossed += lines; + return qtrue; + } + + // if lines were crossed before the end of the script, count them + lines += source->scriptstack->line - source->scriptstack->lastline; + //if at the end of the script if (Parse_EndOfScript(source->scriptstack)) { -- cgit