From 9b0e09877e57ca2bf87fe798dc5d1c5b284e5999 Mon Sep 17 00:00:00 2001
From: MonsterIestyn <iestynjealous@ntlworld.com>
Date: Thu, 22 Jan 2015 17:57:26 +0000
Subject: [PATCH] gametype command now prints gametype NAMES instead of
 numbers. Even prints "Single player" when appropriate!

git-svn-id: https://code.orospakr.ca/svn/srb2/trunk@8997 6de4a73c-47e2-0310-b8c1-93d6ecd3f8cd
---
 src/d_netcmd.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/d_netcmd.c b/src/d_netcmd.c
index 266161c7ce..10605f20fd 100644
--- a/src/d_netcmd.c
+++ b/src/d_netcmd.c
@@ -3193,7 +3193,27 @@ static void Command_ModDetails_f(void)
 //
 static void Command_ShowGametype_f(void)
 {
-	CONS_Printf(M_GetText("Current gametype is %d\n"), gametype);
+	INT32 j;
+	const char *gametypestr = NULL;
+
+	if (!(netgame || multiplayer)) // print "Single player" instead of "Co-op"
+	{
+		CONS_Printf(M_GetText("Current gametype is %s\n"), M_GetText("Single player"));
+		return;
+	}
+	// find name string for current gametype
+	for (j = 0; gametype_cons_t[j].strvalue; j++)
+	{
+		if (gametype_cons_t[j].value == gametype)
+		{
+			gametypestr = gametype_cons_t[j].strvalue;
+			break;
+		}
+	}
+	if (gametypestr)
+		CONS_Printf(M_GetText("Current gametype is %s\n"), gametypestr);
+	else // string for current gametype was not found above (should never happen)
+		CONS_Printf(M_GetText("Unknown gametype set (%d)\n"), gametype);
 }
 
 /** Plays the intro.
-- 
GitLab