r4245 - in trunk/data/qcsrc: common server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Aug 29 14:19:01 EDT 2008
Author: div0
Date: 2008-08-29 14:19:01 -0400 (Fri, 29 Aug 2008)
New Revision: 4245
Modified:
trunk/data/qcsrc/common/campaign_setup.qc
trunk/data/qcsrc/common/gamecommand.qc
trunk/data/qcsrc/server/campaign.qc
trunk/data/qcsrc/server/clientcommands.qc
trunk/data/qcsrc/server/g_world.qc
trunk/data/qcsrc/server/gamecommand.qc
trunk/data/qcsrc/server/teamplay.qc
trunk/data/qcsrc/server/vote.qc
Log:
get rid of some old unused code
Modified: trunk/data/qcsrc/common/campaign_setup.qc
===================================================================
--- trunk/data/qcsrc/common/campaign_setup.qc 2008-08-29 18:13:58 UTC (rev 4244)
+++ trunk/data/qcsrc/common/campaign_setup.qc 2008-08-29 18:19:01 UTC (rev 4245)
@@ -1,8 +1,5 @@
void CampaignSetup(float n)
{
-#ifndef MAPINFO
- localcmd("exec game_reset.cfg\n");
-#endif
localcmd("exec mutator_reset.cfg\n");
localcmd("set g_campaign 1\n");
localcmd("set _campaign_name \"");
@@ -13,15 +10,6 @@
localcmd("\n");
localcmd(campaign_mutators[n]);
localcmd("\n");
-#ifdef MAPINFO
MapInfo_SwitchGameType(MapInfo_Type_FromString(campaign_gametype[n]));
- //print(">>", cvar_string("g_tdm"), "<<\n");
MapInfo_LoadMap(campaign_mapname[n]);
-#else
- localcmd("exec maps/"); // can't use strcat here in current fteqcc
- localcmd(campaign_gametype[n]);
- localcmd("_");
- localcmd(campaign_mapname[n]);
- localcmd(".mapcfg\n");
-#endif
}
Modified: trunk/data/qcsrc/common/gamecommand.qc
===================================================================
--- trunk/data/qcsrc/common/gamecommand.qc 2008-08-29 18:13:58 UTC (rev 4244)
+++ trunk/data/qcsrc/common/gamecommand.qc 2008-08-29 18:19:01 UTC (rev 4245)
@@ -86,7 +86,6 @@
{
if(argv(1) == "add" && argc == 3)
{
-#ifdef MAPINFO
f = fopen(strcat("maps/", argv(2), ".bsp"), FILE_READ);
if(f != -1)
fclose(f);
@@ -98,50 +97,26 @@
cvar_set("g_maplist", argv(2));
else
cvar_set("g_maplist", strcat(argv(2), " ", cvar_string("g_maplist")));
-#else
- f = fopen(strcat("maps/", argv(2), ".mapcfg"), FILE_READ);
- if(f != -1)
- fclose(f);
- else {
- print("maplist: ERROR: ", argv(2), " does not exist!\n");
- return TRUE;
- }
- cvar_set("g_maplist", strcat("'", argv(2), "'", cvar_string("g_maplist")));
-#endif
return TRUE;
}
else if(argv(1) == "remove" && argc == 3)
{
s = argv(2);
-#ifdef MAPINFO
n = tokenizebyseparator(cvar_string("g_maplist"), " ");
-#else
- n = tokenize(cvar_string("g_maplist"));
-#endif
s2 = "";
for(i = 0; i < n; ++i)
if(argv(i) != s)
{
-#ifdef MAPINFO
s2 = strcat(s2, " ", argv(i));
-#else
- s2 = strcat(s2, "'", argv(i), "'");
-#endif
}
-#ifdef MAPINFO
s2 = substring(s2, 1, strlen(s2) - 1);
-#endif
cvar_set("g_maplist", s2);
return TRUE;
}
else if(argv(1) == "shuffle" && argc == 2)
{
s = cvar_string("g_maplist");
-#ifdef MAPINFO
for(i = 1; i < (n = tokenizebyseparator(s, " ")); ++i)
-#else
- for(i = 1; i < (n = tokenize(s)); ++i)
-#endif
{
// swap i-th item at a random position from 0 to i
// proof for even distribution:
@@ -158,13 +133,8 @@
s2 = "";
for(j = 0; j < n; ++j)
-#ifdef MAPINFO
s2 = strcat(s2, " ", argv((j == i) ? f : (j == f) ? i : j));
s = substring(s2, 1, strlen(s2) - 1);
-#else
- s2 = strcat(s2, "'", argv((j == i) ? f : (j == f) ? i : j), "'");
- s = s2;
-#endif
}
cvar_set("g_maplist", s);
return TRUE;
Modified: trunk/data/qcsrc/server/campaign.qc
===================================================================
--- trunk/data/qcsrc/server/campaign.qc 2008-08-29 18:13:58 UTC (rev 4244)
+++ trunk/data/qcsrc/server/campaign.qc 2008-08-29 18:19:01 UTC (rev 4245)
@@ -50,14 +50,9 @@
string thismapname, wantedmapname;
thismapname = GetMapname();
wantedmapname = campaign_gametype[0];
-#ifdef MAPINFO
- // TODO check game type
if(MapInfo_CurrentGametype() != MapInfo_Type_FromString(wantedmapname))
return CampaignBailout("wrong game type!");
wantedmapname = campaign_mapname[0];
-#else
- wantedmapname = strcat(wantedmapname, "_", campaign_mapname[0]);
-#endif
if(wantedmapname != thismapname)
return CampaignBailout(strcat("wrong map: ", wantedmapname, " != ", thismapname));
cvar_set("fraglimit", ftos(campaign_fraglimit[0]));
Modified: trunk/data/qcsrc/server/clientcommands.qc
===================================================================
--- trunk/data/qcsrc/server/clientcommands.qc 2008-08-29 18:13:58 UTC (rev 4244)
+++ trunk/data/qcsrc/server/clientcommands.qc 2008-08-29 18:19:01 UTC (rev 4245)
@@ -299,7 +299,6 @@
}
}
sprint(self, "\n");
-#ifdef MAPINFO
} else if(argv(0) == "lsmaps") {
sprint(self, "^7Maps available: ");
for(i = 0; i < MapInfo_count; ++i)
@@ -311,7 +310,6 @@
sprint(self, strcat(col, MapInfo_BSPName_ByID(i), " "));
}
sprint(self, "\n");
-#endif
} else if(argv(0) == "voice") {
VoiceMessage(argv(1));
} else if(argv(0) == "say") {
Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc 2008-08-29 18:13:58 UTC (rev 4244)
+++ trunk/data/qcsrc/server/g_world.qc 2008-08-29 18:19:01 UTC (rev 4245)
@@ -140,19 +140,12 @@
cvar_set("_sv_init", "0");
if(cvar("g_maplist_shuffle"))
ShuffleMaplist();
-#ifdef MAPINFO
tokenizebyseparator(cvar_string("g_maplist"), " ");
-#else
- tokenize(cvar_string("g_maplist"));
- if(argv(0) != GetMapname())
-#endif
{
cvar_set("nextmap", argv(0));
-#ifdef MAPINFO
MapInfo_Enumerate();
MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0);
-#endif
if(!DoNextMapOverride())
GotoNextMap();
@@ -272,11 +265,7 @@
{
s = strcat(cvar_string("sv_eventlog_files_counter"), ".");
s = strcat(s, ftos(random()));
-#ifdef MAPINFO
GameLogEcho(strcat(":gamestart:", GetGametype(), "_", GetMapname(), ":", s), FALSE);
-#else
- GameLogEcho(strcat(":gamestart:", GetMapname(), ":", s), FALSE);
-#endif
s = ":gameinfo:mutators:LIST";
if(cvar("g_grappling_hook"))
s = strcat(s, ":grappling_hook");
@@ -319,10 +308,8 @@
sys_ticrate = cvar("sys_ticrate");
orig_slowmo = cvar("slowmo");
-#ifdef MAPINFO
MapInfo_Enumerate();
MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 1);
-#endif
//if tourney is used map starts in warmup mode. if this mode shall stay unlimited, reset timelimit, but save the original one
if(g_tourney && cvar("g_tourney_warmup_unlimited_time")) {
@@ -395,29 +382,10 @@
return GametypeNameFromType(game);
}
-float IsSameGametype(string mapcfgname)
-{
-#ifdef MAPINFO
- return TRUE; // can't change game type by map name here
-#else
- string gt;
- gt = GetGametype();
- if(substring(mapcfgname, 0, strlen(gt) + 1) == strcat(gt, "_"))
- return TRUE;
- return FALSE;
-#endif
-}
-
string getmapname_stored;
string GetMapname()
{
-#ifdef MAPINFO
return mapname;
-#else
- if(getmapname_stored == "")
- getmapname_stored = strzone(strcat(GetGametype(), "_", mapname));
- return getmapname_stored;
-#endif
}
float Map_Count, Map_Current;
@@ -491,11 +459,7 @@
string Map_Filename(float position)
{
-#ifdef MAPINFO
return strcat("maps/", argv(position), ".bsp");
-#else
- return strcat("maps/", argv(position), ".mapcfg");
-#endif
}
string strwords(string s, float w)
@@ -537,11 +501,7 @@
return 0;
}
filename = Map_Filename(position);
-#ifdef MAPINFO
if(MapInfo_CheckMap(map_next))
-#else
- if(TryFile(filename))
-#endif
{
if(pass == 2)
return 1;
@@ -573,31 +533,17 @@
void GameResetCfg()
{
-#ifdef MAPINFO
// settings persist, except...
if(cvar("g_campaign"))
localcmd("\nexec mutator_reset.cfg\n");
localcmd("\nsettemp_restore\n");
-#else
- // if an exit cfg is defined by exiting map, exec it.
- string exit_cfg;
- exit_cfg = cvar_string("exit_cfg");
- if(exit_cfg != "")
- localcmd(strcat("exec \"", exit_cfg, "\"\n"));
-
- localcmd("exec game_reset.cfg\n");
-#endif
};
void Map_Goto()
{
Map_MarkAsRecent(getmapname_stored);
GameResetCfg();
-#ifdef MAPINFO
MapInfo_LoadMap(getmapname_stored);
-#else
- localcmd(strcat("exec \"maps/", getmapname_stored ,".mapcfg\"\n"));
-#endif
}
// return codes of map selectors:
@@ -663,26 +609,14 @@
// insert the current map there
newlist = "";
-#ifdef MAPINFO
for(j = 1; j < insertpos; ++j) // i == 1: no loop, will be inserted as first; however, i == 1 has been excluded above
newlist = strcat(newlist, " ", argv(j));
newlist = strcat(newlist, " ", argv(0)); // now insert the just selected map
for(j = insertpos; j < Map_Count; ++j) // i == Map_Count: no loop, has just been inserted as last
newlist = strcat(newlist, " ", argv(j));
newlist = substring(newlist, 1, strlen(newlist) - 1);
-#else
- for(j = 1; j < insertpos; ++j) // i == 1: no loop, will be inserted as first; however, i == 1 has been excluded above
- newlist = strcat(newlist, "'", argv(j), "'");
- newlist = strcat(newlist, "'", argv(0), "'"); // now insert the just selected map
- for(j = insertpos; j < Map_Count; ++j) // i == Map_Count: no loop, has just been inserted as last
- newlist = strcat(newlist, "'", argv(j), "'");
-#endif
cvar_set("g_maplist", newlist);
-#ifdef MAPINFO
Map_Count = tokenizebyseparator(cvar_string("g_maplist"), " ");
-#else
- Map_Count = tokenize(newlist);
-#endif
// NOTE: the selected map has just been inserted at (insertpos-1)th position
Map_Current = insertpos - 1; // this is not really valid, but this way the fallback has a chance of working
@@ -696,22 +630,13 @@
{
string temp;
temp = cvar_string("g_maplist");
-#ifdef MAPINFO
- Map_Count = tokenizebyseparator(cvar_string("g_maplist"), " ");
-#else
- Map_Count = tokenize(temp);
-#endif
+ Map_Count = tokenizebyseparator(temp, " ");
if(Map_Count == 0)
{
bprint( "Maplist is empty! Resetting it to default map list.\n" );
-#ifdef MAPINFO
cvar_set("g_maplist", temp = MapInfo_ListAllowedMaps());
localcmd("\nmenu_cmd sync\n");
Map_Count = tokenizebyseparator(temp, " ");
-#else
- cvar_set("g_maplist", temp = cvar_string("g_maplist_defaultlist"));
- Map_Count = tokenize(temp);
-#endif
}
if(Map_Count == 0)
error("empty maplist, cannot select a new map");
@@ -788,11 +713,7 @@
return TRUE;
}
if(cvar_string("nextmap") != "")
-#ifdef MAPINFO
if(MapInfo_CheckMap(cvar_string("nextmap")))
-#else
- if(TryFile(strcat("maps/", cvar_string("nextmap"), ".mapcfg")))
-#endif
{
Map_Goto_SetStr(cvar_string("nextmap"));
Map_Goto();
@@ -831,12 +752,8 @@
if(allowReset)
{
bprint( "Maplist contains no single playable map! Resetting it to default map list.\n" );
-#ifdef MAPINFO
cvar_set("g_maplist", MapInfo_ListAllowedMaps());
localcmd("\nmenu_cmd sync\n");
-#else
- cvar_set("g_maplist", cvar_string("g_maplist_defaultlist"));
-#endif
}
else
{
@@ -966,11 +883,7 @@
s = ":scores:";
else
s = ":status:";
-#ifdef MAPINFO
s = strcat(s, GetGametype(), "_", GetMapname(), ":", ftos(rint(time)));
-#else
- s = strcat(s, GetMapname(), ":", ftos(rint(time)));
-#endif
if(to_console)
ServerConsoleEcho(s, FALSE);
@@ -1441,11 +1354,7 @@
float i;
result = cvar_string("g_maplist");
-#ifdef MAPINFO
litems = tokenizebyseparator(result, " ");
-#else
- litems = tokenize(result);
-#endif
for(start = 0; start < litems - 1; ++start)
{
@@ -1455,7 +1364,6 @@
selected = ceil(random() * (litems - start) + start) - 1;
// shift this item to the place start
-#ifdef MAPINFO
for(i = 0; i < start; ++i)
result = strcat(result, " ", argv(i));
result = strcat(result, " ", argv(selected));
@@ -1465,17 +1373,7 @@
result = substring(result, 1, strlen(result) - 1);
litems = tokenizebyseparator(result, " ");
-#else
- for(i = 0; i < start; ++i)
- result = strcat(result, "'", argv(i), "'");
- result = strcat(result, "'", argv(selected), "'");
- for(i = start; i < litems; ++i)
- if(i != selected)
- result = strcat(result, "'", argv(i), "'");
- litems = tokenize(result);
-#endif
-
//dprint(result, "\n");
}
@@ -1789,26 +1687,15 @@
return "Suggestions are not accepted on this server.";
if(mapvote_initialized)
return "Can't suggest - voting is already in progress!";
-#ifdef MAPINFO
m = MapInfo_FixName(m);
if(!m)
return "The map you suggested is not available on this server.";
-#else
- if(!cvar("g_maplist_votable_suggestions_change_gametype"))
- if(!IsSameGametype(m))
- return "This server does not allow changing the game type by map suggestions.";
-#endif
if(!cvar("g_maplist_votable_override_mostrecent"))
if(Map_IsRecent(m))
return "This server does not allow for recent maps to be played again. Please be patient for some rounds.";
-#ifdef MAPINFO
if(!MapInfo_CheckMap(m))
return "The map you suggested does not support the current game mode.";
-#else
- if(!TryFile(strcat("maps/", m, ".mapcfg")))
- return "The map you suggested is not available on this server.";
-#endif
for(i = 0; i < mapvote_suggestion_ptr; ++i)
if(mapvote_suggestions[i] == m)
return "This map was already suggested.";
@@ -1872,12 +1759,8 @@
if(mapvote_count == 0)
{
bprint( "Maplist contains no single playable map! Resetting it to default map list.\n" );
-#ifdef MAPINFO
cvar_set("g_maplist", MapInfo_ListAllowedMaps());
localcmd("\nmenu_cmd sync\n");
-#else
- cvar_set("g_maplist", cvar_string("g_maplist_defaultlist"));
-#endif
for(i = 0; i < 100 && mapvote_count < nmax; ++i)
MapVote_AddVotable(GetNextMap(), FALSE);
}
@@ -2250,10 +2133,8 @@
if(mapvote_run)
return;
-#ifdef MAPINFO
MapInfo_Enumerate();
if(MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 1))
-#endif
mapvote_run = TRUE;
}
void MapVote_Think()
@@ -2288,11 +2169,7 @@
string GotoMap(string m)
{
-#ifdef MAPINFO
if(!MapInfo_CheckMap(m))
-#else
- if(!TryFile(strcat("maps/", m, ".mapcfg")))
-#endif
return "The map you chose is not available on this server.";
cvar_set("nextmap", m);
cvar_set("timelimit", "-1");
@@ -2387,11 +2264,9 @@
ServerProgsDB = db_load("server.db");
// Mapinfo
-#ifdef MAPINFO
MapInfo_Shutdown();
MapInfo_Enumerate();
MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 1);
-#endif
}
void SV_Shutdown()
Modified: trunk/data/qcsrc/server/gamecommand.qc
===================================================================
--- trunk/data/qcsrc/server/gamecommand.qc 2008-08-29 18:13:58 UTC (rev 4244)
+++ trunk/data/qcsrc/server/gamecommand.qc 2008-08-29 18:19:01 UTC (rev 4245)
@@ -77,7 +77,6 @@
return;
}
-#ifdef MAPINFO
if(argv(0) == "gametype") if(argc == 2)
{
float t, tsave;
@@ -104,7 +103,6 @@
bprint("Game type switch to ", s, " failed: this type does not exist!\n");
return;
}
-#endif
if(argv(0) == "adminmsg") if(argc == 3)
{
Modified: trunk/data/qcsrc/server/teamplay.qc
===================================================================
--- trunk/data/qcsrc/server/teamplay.qc 2008-08-29 18:13:58 UTC (rev 4244)
+++ trunk/data/qcsrc/server/teamplay.qc 2008-08-29 18:19:01 UTC (rev 4245)
@@ -172,14 +172,12 @@
ReadGameCvars();
WriteGameCvars();
-#ifdef MAPINFO
MapInfo_LoadMapSettings(mapname);
clientstuff = strzone(MapInfo_Map_clientstuff);
MapInfo_ClearTemps();
// in case mapinfo switched the type
ReadGameCvars();
-#endif
// set both here, gamemode can override it later
timelimit_override = cvar("timelimit_override");
Modified: trunk/data/qcsrc/server/vote.qc
===================================================================
--- trunk/data/qcsrc/server/vote.qc 2008-08-29 18:13:58 UTC (rev 4244)
+++ trunk/data/qcsrc/server/vote.qc 2008-08-29 18:19:01 UTC (rev 4245)
@@ -348,40 +348,23 @@
string ValidateMap(string m, entity e)
{
-#ifdef MAPINFO
m = MapInfo_FixName(m);
if(!m)
{
print_to(e, "This map is not available on this server.");
return string_null;
}
-#else
- if(!cvar("sv_vote_change_gametype"))
- if(!IsSameGametype(m))
- {
- print_to(e, "This server does not allow changing the game type by map votes.");
- return string_null;
- }
-#endif
if(!cvar("sv_vote_override_mostrecent"))
if(Map_IsRecent(m))
{
print_to(e, "This server does not allow for recent maps to be played again. Please be patient for some rounds.");
return string_null;
}
-#ifdef MAPINFO
if(!MapInfo_CheckMap(m))
{
print_to(e, strcat("^1Invalid mapname, \"^3", m, "^1\" does not support the current game mode."));
return string_null;
}
-#else
- if(!TryFile(strcat("maps/", m, ".mapcfg")))
- {
- print_to(e, strcat("^1Invalid mapname, \"^3", m, "^1\" does not exist on this server."));
- return string_null;
- }
-#endif
return m;
}
More information about the nexuiz-commits
mailing list