From: Cloudwalk Date: Tue, 22 Sep 2020 02:37:46 +0000 (-0400) Subject: cl_parse: Fix Nehahra unmarked demo hack. Check protocol by number explicitly. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=61abc64bd6055a70c1a319354631eb5f084efa3c;p=xonotic%2Fdarkplaces.git cl_parse: Fix Nehahra unmarked demo hack. Check protocol by number explicitly. --- diff --git a/cl_parse.c b/cl_parse.c index c797d0f1..c70a3391 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -1580,7 +1580,8 @@ void CL_ParseServerInfo (void) return; } // hack for unmarked Nehahra movie demos which had a custom protocol - if (protocol == &protocol_quakedp && cls.demoplayback && gamemode == GAME_NEHAHRA) + // FIXME: Remove hack once we get some .fmf-like system going? + if (protocol->num == PROTOCOL_QUAKE && cls.demoplayback && gamemode == GAME_NEHAHRA) protocol = &protocol_nehahramovie; cls.protocol = protocol; Con_Printf("Server protocol is %s\n", protocol->name); diff --git a/cl_protocol_basenq.h b/cl_protocol_basenq.h index 1f5edbaf..f969245b 100644 --- a/cl_protocol_basenq.h +++ b/cl_protocol_basenq.h @@ -31,10 +31,12 @@ static void Netmsg_svc_updatestat (protocol_t *protocol) static void Netmsg_svc_version (protocol_t *protocol) // [int] server version { int i = MSG_ReadLong(&cl_message); - if (!Protocol_ForNumber(i)) + protocol = Protocol_ForNumber(i); + if (!protocol) Host_Error("CL_ParseServerMessage: Server is unrecognized protocol number (%i)", i); // hack for unmarked Nehahra movie demos which had a custom protocol - if (protocol == &protocol_quakedp && cls.demoplayback && gamemode == GAME_NEHAHRA) + // FIXME: Remove hack once we get some .fmf-like system going? + if (protocol->num == PROTOCOL_QUAKE && cls.demoplayback && gamemode == GAME_NEHAHRA) protocol = &protocol_nehahramovie; cls.protocol = protocol; }