r2006 - branches/nexuiz-2.0/data/qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Dec 8 02:20:50 EST 2006
Author: div0
Date: 2006-12-08 02:20:50 -0500 (Fri, 08 Dec 2006)
New Revision: 2006
Modified:
branches/nexuiz-2.0/data/qcsrc/server/g_world.qc
Log:
more intelligence for maplist editing
Modified: branches/nexuiz-2.0/data/qcsrc/server/g_world.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/g_world.qc 2006-12-08 07:19:58 UTC (rev 2005)
+++ branches/nexuiz-2.0/data/qcsrc/server/g_world.qc 2006-12-08 07:20:50 UTC (rev 2006)
@@ -1228,18 +1228,18 @@
result = strcat(result, "'", argv(i), "'");
}
if(found)
- {
cvar_set("g_maplist", result);
- localcmd("set _g_maplist_have_shuffled 0\n");
- }
ServerConsoleEcho(strcat("Removed ", ftos(found), " items."), FALSE);
}
void AddToMaplist(string m)
{
+ string result;
float found;
float litems;
float i;
+ float ipos;
+ float inserted;
if(!TryFile(strcat("maps/", m, ".mapcfg")))
{
@@ -1248,14 +1248,29 @@
}
litems = tokenize(cvar_string("g_maplist"));
+ if(cvar("g_maplist_shuffle"))
+ ipos = ceil(random() * (litems + 1)) - 1;
+ else
+ ipos = litems;
found = 0;
+ inserted = 0;
for(i = 0; i < litems; ++i)
+ {
+ m = strcat(m);
+ if(i == ipos)
+ {
+ result = strcat(result, "'", m, "'");
+ inserted = 1;
+ }
+ result = strcat(result, "'", argv(i), "'");
if(argv(i) == m)
found += 1;
+ }
+ if(!inserted)
+ result = strcat(result, "'", m, "'");
if(!found)
{
- cvar_set("g_maplist", strcat(cvar_string("g_maplist"), "'", m, "'"));
- localcmd("set _g_maplist_have_shuffled 0\n");
+ cvar_set("g_maplist", result);
ServerConsoleEcho("Map added.", FALSE);
}
else
More information about the nexuiz-commits
mailing list