]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
cl_parse: Fix Nehahra unmarked demo hack. Check protocol by number explicitly.
authorCloudwalk <cloudwalk009@gmail.com>
Tue, 22 Sep 2020 02:37:46 +0000 (22:37 -0400)
committerCloudwalk <cloudwalk009@gmail.com>
Tue, 22 Sep 2020 02:37:46 +0000 (22:37 -0400)
cl_parse.c
cl_protocol_basenq.h

index c797d0f1fe462c980c9244b3f2612a263d452e28..c70a3391eb98fefceba8962690d6bd8b94e6d6e3 100644 (file)
@@ -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);
index 1f5edbaf9c6e40a92aed9fd56da9c2574980c10d..f969245b4880ad7070966d126c6bbedc987aa45d 100644 (file)
@@ -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;
 }