r2980 - in trunk/data/qcsrc: common menu-div0test menu-div0test/nexuiz server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sat Nov 17 06:13:56 EST 2007
Author: div0
Date: 2007-11-17 06:13:55 -0500 (Sat, 17 Nov 2007)
New Revision: 2980
Modified:
trunk/data/qcsrc/common/mapinfo.qc
trunk/data/qcsrc/common/mapinfo.qh
trunk/data/qcsrc/menu-div0test/menu.qc
trunk/data/qcsrc/menu-div0test/nexuiz/maplist.c
trunk/data/qcsrc/server/g_world.qc
trunk/data/qcsrc/server/gamecommand.qc
Log:
handle aborting when a mapinfo has been generated in a better way
Modified: trunk/data/qcsrc/common/mapinfo.qc
===================================================================
--- trunk/data/qcsrc/common/mapinfo.qc 2007-11-17 11:03:56 UTC (rev 2979)
+++ trunk/data/qcsrc/common/mapinfo.qc 2007-11-17 11:13:55 UTC (rev 2980)
@@ -73,7 +73,7 @@
// filter the info by game type mask (updates MapInfo_count)
string _MapInfo_filtered;
-string MapInfo_FilterGametype_Recursive(float pGametype, float pFeatures, float pBegin, float pEnd)
+string MapInfo_FilterGametype_Recursive(float pGametype, float pFeatures, float pBegin, float pEnd, float pAbortOnGenerate)
{
float m, valid;
string l, r;
@@ -83,13 +83,14 @@
m = floor((pBegin + pEnd) / 2);
- l = MapInfo_FilterGametype_Recursive(pGametype, pFeatures, pBegin, m);
+ l = MapInfo_FilterGametype_Recursive(pGametype, pFeatures, pBegin, m, pAbortOnGenerate);
if not(l)
return string_null; // BAIL OUT
if(MapInfo_Get_ByName(_MapInfo_GlobItem(m), 1, 0) == 2) // if we generated one... BAIL OUT and let the caller continue in the next frame.
- return string_null; // BAIL OUT
+ if(pAbortOnGenerate)
+ return string_null; // BAIL OUT
valid = (((MapInfo_Map_supportedGametypes & pGametype) != 0) && ((MapInfo_Map_supportedFeatures & pFeatures) == pFeatures));
- r = MapInfo_FilterGametype_Recursive(pGametype, pFeatures, m + 1, pEnd);
+ r = MapInfo_FilterGametype_Recursive(pGametype, pFeatures, m + 1, pEnd, pAbortOnGenerate);
if not(r)
return string_null; // BAIL OUT
@@ -98,11 +99,11 @@
else
return HugeSetOfIntegers_concat(l, r);
}
-float MapInfo_FilterGametype(float pGametype, float pFeatures)
+float MapInfo_FilterGametype(float pGametype, float pFeatures, float pAbortOnGenerate)
{
if(_MapInfo_filtered)
strunzone(_MapInfo_filtered);
- _MapInfo_filtered = MapInfo_FilterGametype_Recursive(pGametype, pFeatures, 0, _MapInfo_globcount);
+ _MapInfo_filtered = MapInfo_FilterGametype_Recursive(pGametype, pFeatures, 0, _MapInfo_globcount, pAbortOnGenerate);
if not(_MapInfo_filtered)
{
dprint("Autogenerated a .mapinfo, doing the rest later.\n");
@@ -138,6 +139,7 @@
float fh;
string s, v;
vector o;
+ float i;
float inWorldspawn, l;
float r;
float twoBaseModes;
@@ -183,7 +185,14 @@
for(l = strlen(v) - 1; l > 0; --l)
if(substring(v, l, 1) == "\"")
break;
- MapInfo_Map_title = substring(v, 0, l);
+ i = strstrofs(substring(v, 0, l), " by ", 0);
+ if(MapInfo_Map_author == "He-Who-Must-Not-Be-Named" && i >= 0)
+ {
+ MapInfo_Map_title = substring(v, 0, i);
+ MapInfo_Map_author = substring(v, i + 4, l - (i + 4));
+ }
+ else
+ MapInfo_Map_title = substring(v, 0, l);
}
}
else
@@ -520,9 +529,7 @@
// to make absolutely sure:
MapInfo_Enumerate();
- for(;;)
- if(MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures()))
- break;
+ MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0);
out = "";
for(i = 0; i < MapInfo_count; ++i)
Modified: trunk/data/qcsrc/common/mapinfo.qh
===================================================================
--- trunk/data/qcsrc/common/mapinfo.qh 2007-11-17 11:03:56 UTC (rev 2979)
+++ trunk/data/qcsrc/common/mapinfo.qh 2007-11-17 11:13:55 UTC (rev 2980)
@@ -29,7 +29,7 @@
void MapInfo_Enumerate();
// filter the info by game type mask (updates MapInfo_count)
-float MapInfo_FilterGametype(float gametype, float features); // 1 on success, 0 on temporary failure (call it again next frame then)
+float MapInfo_FilterGametype(float gametype, float features, float pAbortOnGenerate); // 1 on success, 0 on temporary failure (call it again next frame then)
float MapInfo_CurrentFeatures(); // retrieves currently required features from cvars
float MapInfo_CurrentGametype(); // retrieves current gametype from cvars
Modified: trunk/data/qcsrc/menu-div0test/menu.qc
===================================================================
--- trunk/data/qcsrc/menu-div0test/menu.qc 2007-11-17 11:03:56 UTC (rev 2979)
+++ trunk/data/qcsrc/menu-div0test/menu.qc 2007-11-17 11:13:55 UTC (rev 2980)
@@ -26,7 +26,7 @@
menuLoadedMaplist = 0;
MapInfo_Enumerate();
- if(!MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0))
+ if(!MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 1))
return;
menuLoadedMaplist = 1;
Modified: trunk/data/qcsrc/menu-div0test/nexuiz/maplist.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/maplist.c 2007-11-17 11:03:56 UTC (rev 2979)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/maplist.c 2007-11-17 11:13:55 UTC (rev 2980)
@@ -190,7 +190,7 @@
float gt, f;
gt = MapInfo_CurrentGametype();
f = MapInfo_CurrentFeatures();
- MapInfo_FilterGametype(gt, f);
+ MapInfo_FilterGametype(gt, f, 0);
me.nItems = MapInfo_count;
for(i = 0; i < MapInfo_count; ++i)
draw_PreloadPicture(strcat("/maps/", MapInfo_BSPName_ByID(i)));
@@ -222,7 +222,7 @@
{
float i;
string s;
- MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0); // all
+ MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 0); // all
s = "";
for(i = 0; i < MapInfo_count; ++i)
s = strcat(s, " ", MapInfo_BSPName_ByID(i));
Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc 2007-11-17 11:03:56 UTC (rev 2979)
+++ trunk/data/qcsrc/server/g_world.qc 2007-11-17 11:13:55 UTC (rev 2980)
@@ -67,9 +67,7 @@
#ifdef MAPINFO
MapInfo_Enumerate();
- while(!MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures()))
- {
- }
+ MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0);
#endif
if(!DoNextMapOverride())
@@ -360,7 +358,7 @@
#ifdef MAPINFO
MapInfo_Enumerate();
- MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures());
+ MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 1);
#endif
}
@@ -2090,7 +2088,7 @@
#ifdef MAPINFO
MapInfo_Enumerate();
- if(MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures()))
+ if(MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 1))
#endif
mapvote_run = TRUE;
}
Modified: trunk/data/qcsrc/server/gamecommand.qc
===================================================================
--- trunk/data/qcsrc/server/gamecommand.qc 2007-11-17 11:03:56 UTC (rev 2979)
+++ trunk/data/qcsrc/server/gamecommand.qc 2007-11-17 11:13:55 UTC (rev 2980)
@@ -2,7 +2,7 @@
void make_mapinfo_Think()
{
- if(MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0))
+ if(MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 1))
{
print("Done rebuiling mapinfos.\n");
remove(self);
More information about the nexuiz-commits
mailing list