XQF / xqf

XQF game server browser
http://xqf.github.io
GNU General Public License v2.0
37 stars 12 forks source link

Handle string gametype from engines that don’t use numeric gametype #72

Open illwieckz opened 9 years ago

illwieckz commented 9 years ago

as Zack Middleton saids in #28 about his spearmint engine:

"gametype" is a string without spaces (e.g., FFA, Tournament, TeamDM, CTF, 1FCTF, Overload, Harvester), new games/mods can use others however.

Warsow seems to use string gametype too.

zturtleman commented 9 years ago

I've done some testing and looking through XQF code since then.

Background: Q3 server info vars are from two different requests. "gametype" is sent in info response. "g_gametype" is sent in status response. These are in a combined list in q3_analyze_serverinfo.

XQF uses "g_gametype" instead of "gametype" (which doesn't matter for Q3, because they're the same). For Spearmint, g_gametype is an integer and gametype is name. I don't know if all games provide both, so simply changing XQF to use "gametype" might not be a good idea.

XQF has handling for separate variables that hold the gametype string, which I was able to confirm works by modifying XQF to use sv_gametypeNetName var used by Spearmint status response (using gametype should work too). Warsow is supposedly handled as well (I haven't verified it). Edit: Ah, Warsow doesn't include the var XQF checks, Warsow only has "gametype" var.

The one issue I noticed was that q3_decode_gametype would read "1CTF" as 1 instead of ignoring it. See online code test. I think false positives could be fixed by returning if *endptr != '\0'. This wasn't an issue for my Spearmint testing because it didn't use q3_decode_gametype for SERVER_SPEARMINT.