Inspired by a thread on Func (clicky), here's a handler for multi-line comments in save games and other files that are parsed by COM_Parse. Pop this after the "skip // comments" section and you can load DarkPlaces save games now.
Hmm, I find it hard to imagine that this would cause any compatibility issues, so it's probably a good thing to spread through the various engines.
However, I see a minor bug: "/*/" is treated as a complete comment because you skip over only the opening "/" but not the opening "*".
The double increment after the check for "*/" seemed suspicious, but then I realized it's skipping the closing "*/". I'm not 100% certain (~98%), but I think you can get away with "if (data[0]) data += 2;" because the only way to get there is for data[0] to be 0, or for data[0..1] to be "*/".
I was a bit suspicious of the double data++ myself (it's been a coupla years after all) but I've double-checked against the way DarkPlaces handles this and can see that my code was almost a direct copy & paste from it (which I obviously did and then completely forgot about) so I'll leave everything stand.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
I don't disagree. I'm just being wary of the fact that LordHavoc never added a comment explaining his reasons for doing it this way, and am wondering if there was some obscure bug it was intended to fix, or was he just having a brainfart that day? Since the double "if (data[0])" does no harm I'm more inclined to leave it be on account of that.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
It definitely seems wrong and unnecessary to me too. I can only guess that LH did it because the "handle quoted strings specially" part also does it - but that's all it is, a guess.
Just for reference, here's the relevant section from Q3A:
// skip /*..*/ comments
if (data[0] == '/' && data[1] == '*') {
data += 2; // skip over the leading /*
while (data[0] && (data[0] != '*' && data[1] != '/'))
data++;
if (data[0])
data +=2; // skip over the trailing */
goto skipwhite;
}