ref: ca93f90c5522955b57f63430f2c728edf812331a
parent: df34acd44e62ce727cc85ee48b3c3bb7567e831d
author: Simon Howard <[email protected]>
date: Fri Apr 20 19:00:36 EDT 2018
net: Improve game mismatch error messages. If game mode/mission don't match then the client can't connect to the server. But give some details about the mismatch in the error message to aid in debugging. Thanks to AgitationSkeleton and GuyNamedErick for help with this.
--- a/src/d_mode.c
+++ b/src/d_mode.c
@@ -210,3 +210,20 @@
}
}
+const char *D_GameModeString(GameMode_t mode)
+{
+ switch (mode)
+ {
+ case shareware:
+ return "shareware";
+ case registered:
+ return "registered";
+ case commercial:
+ return "commercial";
+ case retail:
+ return "retail";
+ case indetermined:
+ return "indetermined";
+ }
+}
+
--- a/src/d_mode.h
+++ b/src/d_mode.h
@@ -103,6 +103,7 @@
int D_GetNumEpisodes(GameMission_t mission, GameMode_t mode);
boolean D_IsEpisodeMap(GameMission_t mission);
const char *D_GameMissionString(GameMission_t mission);
+const char *D_GameModeString(GameMode_t mode);
#endif /* #ifndef __D_MODE__ */
--- a/src/net_server.c
+++ b/src/net_server.c
@@ -688,7 +688,15 @@
// the other clients
if (data.gamemode != sv_gamemode || data.gamemission != sv_gamemission)
{
- NET_SV_SendReject(addr, "You are playing the wrong game!");
+ char msg[128];
+ M_snprintf(msg, sizeof(msg),
+ "Game mismatch: server is %s (%s), client is %s (%s)",
+ D_GameMissionString(sv_gamemission),
+ D_GameModeString(sv_gamemode),
+ D_GameMissionString(data.gamemission),
+ D_GameModeString(data.gamemode));
+
+ NET_SV_SendReject(addr, msg);
return;
}