[nexuiz-commits] r8323 - trunk/data/qcsrc/common

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Nov 27 07:07:32 EST 2009


Author: div0
Date: 2009-11-27 07:07:28 -0500 (Fri, 27 Nov 2009)
New Revision: 8323

Modified:
   trunk/data/qcsrc/common/mapinfo.qc
Log:
fix crash when allowing unsupported modes


Modified: trunk/data/qcsrc/common/mapinfo.qc
===================================================================
--- trunk/data/qcsrc/common/mapinfo.qc	2009-11-26 13:44:58 UTC (rev 8322)
+++ trunk/data/qcsrc/common/mapinfo.qc	2009-11-27 12:07:28 UTC (rev 8323)
@@ -878,12 +878,15 @@
 	}
 	fclose(fh);
 
-	if(!MapInfo_Map_supportedGametypes)
-		_MapInfo_Map_ApplyGametype("30 20", pGametypeToSet, MAPINFO_TYPE_DEATHMATCH);
-
 	if(pGametypeToSet)
+	{
 		if(!(MapInfo_Map_supportedGametypes & pGametypeToSet))
-			error("Can't select the requested game type. Bailing out.");
+		{
+			print("Can't select the requested game type. Trying anyway with stupid settings.\n");
+			_MapInfo_Map_ApplyGametype("0 0 0", pGametypeToSet, MAPINFO_TYPE_DEATHMATCH);
+		}
+	}
+
 	MapInfo_Cache_Store();
 	if(MapInfo_Map_supportedGametypes != 0)
 		return r;
@@ -1088,25 +1091,21 @@
 		}
 		// t is now a supported mode!
 		t0 = MapInfo_CurrentGametype();
-		switch(t0)
+		if(cvar("g_mapinfo_allow_unsupported_modes_and_let_stuff_break"))
 		{
-			case MAPINFO_TYPE_RUNEMATCH:
-			case MAPINFO_TYPE_TEAM_DEATHMATCH:
-			case MAPINFO_TYPE_LMS:
-			case MAPINFO_TYPE_ARENA:
-			case MAPINFO_TYPE_CA:
-			case MAPINFO_TYPE_KEYHUNT:
-			case MAPINFO_TYPE_DEATHMATCH:
-				print("EMERGENCY: can't play the selected map in the given game mode. Working with only the override settings.\n");
-				cvar_set("timelimit", "0");
-				cvar_set("fraglimit", "0");
-				cvar_set("g_keyhunt_teams", "3");
-				break;
-			default:
-				print("EMERGENCY: can't play the selected map in the given game mode. Falling back to a supported mode.\n");
-				MapInfo_SwitchGameType(t);
-				break;
+			print("EMERGENCY: can't play the selected map in the given game mode. Working with only the override settings.\n");
+			cvar_set("timelimit", "0");
+			cvar_set("fraglimit", "0");
+			cvar_set("g_tdm_teams", "2");
+			cvar_set("g_keyhunt_teams", "3");
+			cvar_set("g_race_qualifying_timelimit", "0");
+			cvar_set("leadlimit", "0");
 		}
+		else
+		{
+			print("EMERGENCY: can't play the selected map in the given game mode. Falling back to a supported mode.\n");
+			MapInfo_SwitchGameType(t);
+		}
 	}
 	cvar_settemp_restore();
 	MapInfo_Get_ByName(s, 1, MapInfo_CurrentGametype());



More information about the nexuiz-commits mailing list