diff --git a/libs/util/script.c b/libs/util/script.c index 4513f1cd1..48be776d2 100644 --- a/libs/util/script.c +++ b/libs/util/script.c @@ -157,9 +157,16 @@ Script_GetToken (script_t *script, qboolean crossline) dstring_copysubstr (script->token, token_p, script->p - token_p); script->p++; } else { + const char *single = "{}()':"; + token_p = script->p; - while (*script->p && !isspace ((unsigned char) *script->p)) + if (strchr (single, *script->p)) { script->p++; + } else { + while (*script->p && !isspace ((unsigned char) *script->p) + && !strchr (single, *script->p)) + script->p++; + } dstring_copysubstr (script->token, token_p, script->p - token_p); } diff --git a/tools/qfbsp/source/map.c b/tools/qfbsp/source/map.c index 069aba3c2..bbd6db7d8 100644 --- a/tools/qfbsp/source/map.c +++ b/tools/qfbsp/source/map.c @@ -191,7 +191,8 @@ ParseVerts (int *n_verts) if (map_script->token->str[0] != ':') map_error ("parsing brush"); - *n_verts = atoi (map_script->token->str + 1); + Script_GetToken (map_script, false); + *n_verts = atoi (map_script->token->str); verts = malloc (sizeof (vec3_t) * *n_verts); for (i = 0; i < *n_verts; i++) { diff --git a/tools/qfcc/source/qfcc.c b/tools/qfcc/source/qfcc.c index 9d0b08f98..9571b8857 100644 --- a/tools/qfcc/source/qfcc.c +++ b/tools/qfcc/source/qfcc.c @@ -834,7 +834,8 @@ progs_src_compile (void) else dsprintf (qc_filename, "%s", script->token->str); if (options.verbosity >= 2) - printf ("%s:%d: compiling %s\n", script->file, script->line, qc_filename->str); + printf ("%s:%d: compiling %s\n", script->file, script->line, + qc_filename->str); if (single) { fprintf (single, "$frame_reset\n"); diff --git a/tools/qflight/source/entities.c b/tools/qflight/source/entities.c index 3c0c94926..4c727c243 100644 --- a/tools/qflight/source/entities.c +++ b/tools/qflight/source/entities.c @@ -186,7 +186,7 @@ LoadEntities (void) // go through all the entities while (Script_GetToken (script, 1)) { // parse the opening brace - if (script->token->str[0] != '{') + if (!strcmp (script->token->str, "{")) fprintf (stderr, "LoadEntities: found %s when expecting {", script->token->str); @@ -220,7 +220,7 @@ LoadEntities (void) // FIXME shouldn't cross line if (!Script_GetToken (script, 1)) fprintf (stderr, "LoadEntities: EOF without closing brace"); - if (script->token->str[0] == '}') + if (!strcmp (script->token->str, "}")) fprintf (stderr, "LoadEntities: closing brace without data"); epair = calloc (1, sizeof (epair_t));