mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-18 10:02:12 +00:00
Merge pull request #758 from BjossiAlfreds/lateargs
Fixed incorrect handling of - in late args and simplified code
This commit is contained in:
commit
b16b1b13d0
1 changed files with 7 additions and 16 deletions
|
@ -300,9 +300,9 @@ Cbuf_AddLateCommands(void)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
int s;
|
int s;
|
||||||
char *text, *build, c;
|
char *text, c;
|
||||||
int argc;
|
int argc;
|
||||||
qboolean ret;
|
qboolean has_args = false;
|
||||||
|
|
||||||
/* build the combined string to parse from */
|
/* build the combined string to parse from */
|
||||||
s = 0;
|
s = 0;
|
||||||
|
@ -332,9 +332,6 @@ Cbuf_AddLateCommands(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* pull out the commands */
|
/* pull out the commands */
|
||||||
build = Z_Malloc(s + 1);
|
|
||||||
build[0] = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < s - 1; i++)
|
for (i = 0; i < s - 1; i++)
|
||||||
{
|
{
|
||||||
if (text[i] == '+')
|
if (text[i] == '+')
|
||||||
|
@ -348,24 +345,18 @@ Cbuf_AddLateCommands(void)
|
||||||
c = text[j];
|
c = text[j];
|
||||||
text[j] = 0;
|
text[j] = 0;
|
||||||
|
|
||||||
strcat(build, text + i);
|
Cbuf_AddText(text + i);
|
||||||
strcat(build, "\n");
|
Cbuf_AddText("\n");
|
||||||
|
|
||||||
|
has_args = true;
|
||||||
text[j] = c;
|
text[j] = c;
|
||||||
i = j - 1;
|
i = j - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = (build[0] != 0);
|
|
||||||
|
|
||||||
if (ret)
|
|
||||||
{
|
|
||||||
Cbuf_AddText(build);
|
|
||||||
}
|
|
||||||
|
|
||||||
Z_Free(text);
|
Z_Free(text);
|
||||||
Z_Free(build);
|
|
||||||
|
|
||||||
return ret;
|
return has_args;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue