r3338 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Feb 7 10:42:31 EST 2008


Author: div0
Date: 2008-02-07 10:42:31 -0500 (Thu, 07 Feb 2008)
New Revision: 3338

Modified:
   trunk/data/qcsrc/server/gamecommand.qc
Log:
make gametype command refuse if there is no single map for it


Modified: trunk/data/qcsrc/server/gamecommand.qc
===================================================================
--- trunk/data/qcsrc/server/gamecommand.qc	2008-02-06 18:44:27 UTC (rev 3337)
+++ trunk/data/qcsrc/server/gamecommand.qc	2008-02-07 15:42:31 UTC (rev 3338)
@@ -80,15 +80,25 @@
 #ifdef MAPINFO
 	if(argv(0) == "gametype") if(argc == 2)
 	{
-		float t;
+		float t, tsave;
 		string s;
 		s = argv(1);
 		t = MapInfo_Type_FromString(s);
+		tsave = MapInfo_CurrentGametype();
 		if(t)
 		{
 			MapInfo_SwitchGameType(t);
 			MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0);
-			bprint("Game type successfully switched to ", s, "\n");
+			if(MapInfo_count > 0)
+			{
+				bprint("Game type successfully switched to ", s, "\n");
+			}
+			else
+			{
+				bprint("Cannot use this game type: no map for it found\n");
+				MapInfo_SwitchGameType(tsave);
+				MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0);
+			}
 		}
 		else
 			bprint("Game type switch to ", s, " failed: this type does not exist!\n");




More information about the nexuiz-commits mailing list