Support starting maps with '-' from commandline, fix #757

like ./quake2 +map sgc9-1
the problem was that everything from '-' to the next '+' (which starts
a command) was skipped; the intention of that (original Quake2) code
probably was to allow skipping something like "-datadir bla", though
Quake2 never supported arguments starting with '-' (until *we* added
-datadir and -portable); maybe that's a leftover from Quake1.
Anyway, the more correct way (that allows '-' in filenames) is to check
for a space before '-': so `quake2 +map base1 -portable` still works,
and now `quake2 +map sgc9-1` works as well
This commit is contained in:
Daniel Gibson 2021-10-30 17:04:18 +02:00
parent 9a11251740
commit 568602ab49

View file

@ -341,7 +341,7 @@ Cbuf_AddLateCommands(void)
{
i++;
for (j = i; (text[j] != '+') && (text[j] != '-') && (text[j] != 0); j++)
for (j = i; (text[j] != '+') && !(text[j] == '-' && text[j-1] == ' ') && (text[j] != 0); j++)
{
}