Fix tokenizebyseparator with ',,,,' returning 3 tokens instead of 5.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5766 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2020-09-21 10:34:00 +00:00
parent b040358b54
commit e5f358ee5e
1 changed files with 6 additions and 6 deletions

View File

@ -5634,7 +5634,7 @@ void QCBUILTIN PF_tokenizebyseparator (pubprogfuncs_t *prinst, struct globalvar
int seps = 0, s; int seps = 0, s;
const char *start = str; const char *start = str;
int tlen; int tlen;
qboolean found = true; int found;
while (seps < prinst->callargc - 1 && seps < 7) while (seps < prinst->callargc - 1 && seps < 7)
{ {
@ -5671,7 +5671,7 @@ void QCBUILTIN PF_tokenizebyseparator (pubprogfuncs_t *prinst, struct globalvar
if (!*str) if (!*str)
{ {
qctoken[qctoken_count].end = str - start; qctoken[qctoken_count].end = str - start;
found = true; found = -1;
} }
else else
{ {
@ -5704,12 +5704,12 @@ void QCBUILTIN PF_tokenizebyseparator (pubprogfuncs_t *prinst, struct globalvar
qctoken = n; qctoken = n;
} }
if (*str) if (found==-1)
qctoken[qctoken_count].start = str - start;
else
break; break;
qctoken[qctoken_count].start = str - start;
} }
str++; else
str++;
} }
G_FLOAT(OFS_RETURN) = qctoken_count; G_FLOAT(OFS_RETURN) = qctoken_count;
} }