Ignore semicolons in comments inside console scripts.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2065 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
bdb177ea94
commit
b861dbba89
|
@ -328,7 +328,7 @@ void Cbuf_ExecuteLevel (int level)
|
||||||
int i;
|
int i;
|
||||||
char *text;
|
char *text;
|
||||||
char line[1024];
|
char line[1024];
|
||||||
int quotes;
|
qboolean quotes, comment;
|
||||||
|
|
||||||
while (cmd_text[level].buf.cursize)
|
while (cmd_text[level].buf.cursize)
|
||||||
{
|
{
|
||||||
|
@ -341,15 +341,25 @@ void Cbuf_ExecuteLevel (int level)
|
||||||
// find a \n or ; line break
|
// find a \n or ; line break
|
||||||
text = (char *)cmd_text[level].buf.data;
|
text = (char *)cmd_text[level].buf.data;
|
||||||
|
|
||||||
quotes = 0;
|
quotes = false;
|
||||||
|
comment = false;
|
||||||
for (i=0 ; i< cmd_text[level].buf.cursize ; i++)
|
for (i=0 ; i< cmd_text[level].buf.cursize ; i++)
|
||||||
{
|
{
|
||||||
if (text[i] == '"')
|
|
||||||
quotes++;
|
|
||||||
if ( !(quotes&1) && text[i] == ';')
|
|
||||||
break; // don't break if inside a quoted string
|
|
||||||
if (text[i] == '\n')
|
if (text[i] == '\n')
|
||||||
break;
|
break;
|
||||||
|
if (text[i] == '"')
|
||||||
|
{
|
||||||
|
quotes++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (comment || (quotes&1))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (text[i] == '/' && i+1 < cmd_text[level].buf.cursize && text[i+1] == '/')
|
||||||
|
comment = true;
|
||||||
|
else if (text[i] == ';')
|
||||||
|
break; // don't break if inside a quoted string
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i >= sizeof(line))
|
if (i >= sizeof(line))
|
||||||
|
|
Loading…
Reference in New Issue