summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Millwood <thebenmachine@gmail.com>2009-10-03 13:06:54 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:16:28 +0000
commit2f1ae66898fd4834d2a0b9cd7634a9b7a228515a (patch)
tree9a75087273014b53d4b7de5bd6c83d36bd5523ea
parent11e37d5354d6945e2a4cbdc73ba650c78ade89a5 (diff)
* Fix a parser bug relating to whitespace at the end of scripts
-rw-r--r--src/qcommon/parse.c13
1 files changed, 11 insertions, 2 deletions
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))
{