r3294 - in trunk/data/qcsrc: common menu/nexuiz
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Mon Jan 28 04:12:51 EST 2008
Author: div0
Date: 2008-01-28 04:12:33 -0500 (Mon, 28 Jan 2008)
New Revision: 3294
Modified:
trunk/data/qcsrc/common/mapinfo.qc
trunk/data/qcsrc/common/mapinfo.qh
trunk/data/qcsrc/common/util.qc
trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_create_mapinfo.c
trunk/data/qcsrc/menu/nexuiz/maplist.c
Log:
possibly kill the tempstring warnings when saving games, possibly break everything
Modified: trunk/data/qcsrc/common/mapinfo.qc
===================================================================
--- trunk/data/qcsrc/common/mapinfo.qc 2008-01-28 03:52:21 UTC (rev 3293)
+++ trunk/data/qcsrc/common/mapinfo.qc 2008-01-28 09:12:33 UTC (rev 3294)
@@ -1,4 +1,4 @@
-// internal toy
+ // internal toy
void cvar_settemp(string pKey, string pValue)
{
//localcmd(strcat("\nsettemp ", t, " \"", s, "\"\n"));
@@ -226,8 +226,7 @@
}
_MapInfo_filtered = strzone(_MapInfo_filtered);
MapInfo_count = HugeSetOfIntegers_length(_MapInfo_filtered);
- //print("Filter ", ftos(pGametype), "/", ftos(pFeatures), " has ", ftos(MapInfo_count), "\n");
- // TODO clear cache
+ MapInfo_ClearTemps();
return 1;
}
@@ -674,7 +673,7 @@
return MAPINFO_TYPE_DEATHMATCH;
}
-float MapInfo_CheckMap(string s) // returns 0 if the map can't be played with the current settings, 1 otherwise
+float _MapInfo_CheckMap(string s) // returns 0 if the map can't be played with the current settings, 1 otherwise
{
if(!MapInfo_Get_ByName(s, 1, 0))
return 0;
@@ -685,6 +684,14 @@
return 1;
}
+float MapInfo_CheckMap(string s) // returns 0 if the map can't be played with the current settings, 1 otherwise
+{
+ float r;
+ r = _MapInfo_CheckMap(s);
+ MapInfo_ClearTemps();
+ return r;
+}
+
void MapInfo_SwitchGameType(float t)
{
cvar_set("gamecfg", "0");
@@ -729,7 +736,7 @@
void MapInfo_LoadMapSettings(string s) // to be called from worldspawn
{
float t;
- if(!MapInfo_CheckMap(s))
+ if(!_MapInfo_CheckMap(s)) // with underscore, it keeps temps
{
if(MapInfo_Map_supportedGametypes <= 0)
error("Mapinfo system is not functional at all. BAILED OUT.\n");
@@ -746,4 +753,17 @@
}
cvar_settemp_restore();
MapInfo_Get_ByName(s, 1, MapInfo_CurrentGametype());
+ MapInfo_ClearTemps();
}
+
+void MapInfo_ClearTemps()
+{
+ MapInfo_Map_bspname = string_null;
+ MapInfo_Map_title = string_null;
+ MapInfo_Map_description = string_null;
+ MapInfo_Map_author = string_null;
+ MapInfo_Map_supportedGametypes = 0;
+ MapInfo_Map_supportedFeatures = 0;
+ MapInfo_Map_diameter = 0;
+ MapInfo_Map_spawnpoints = 0;
+}
Modified: trunk/data/qcsrc/common/mapinfo.qh
===================================================================
--- trunk/data/qcsrc/common/mapinfo.qh 2008-01-28 03:52:21 UTC (rev 3293)
+++ trunk/data/qcsrc/common/mapinfo.qh 2008-01-28 09:12:33 UTC (rev 3294)
@@ -63,3 +63,5 @@
void MapInfo_Cache_Destroy(); // disable caching
void MapInfo_Cache_Create(); // enable caching
void MapInfo_Cache_Invalidate(); // delete cache if any, but keep enabled
+
+void MapInfo_ClearTemps(); // call this when done with mapinfo for this frame
Modified: trunk/data/qcsrc/common/util.qc
===================================================================
--- trunk/data/qcsrc/common/util.qc 2008-01-28 03:52:21 UTC (rev 3293)
+++ trunk/data/qcsrc/common/util.qc 2008-01-28 09:12:33 UTC (rev 3294)
@@ -7,9 +7,12 @@
string wordwrap(string s, float l)
{
+ string r;
wordwrap_buffer = "";
wordwrap_cb(s, l, wordwrap_buffer_put);
- return wordwrap_buffer;
+ r = wordwrap_buffer;
+ wordwrap_buffer = "";
+ return r;
}
#ifndef MENUQC
@@ -29,6 +32,7 @@
wordwrap_cb(s, l, wordwrap_buffer_sprint);
if(wordwrap_buffer != "")
sprint(self, strcat(wordwrap_buffer, "\n"));
+ wordwrap_buffer = "";
return;
}
#endif
Modified: trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_create_mapinfo.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_create_mapinfo.c 2008-01-28 03:52:21 UTC (rev 3293)
+++ trunk/data/qcsrc/menu/nexuiz/dialog_multiplayer_create_mapinfo.c 2008-01-28 09:12:33 UTC (rev 3294)
@@ -76,6 +76,8 @@
me.typeAssaultLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ASSAULT);
if(me.typeOnslaughtLabel)
me.typeOnslaughtLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ONSLAUGHT);
+
+ MapInfo_ClearTemps();
}
void fillNexuizMapInfoDialog(entity me)
{
Modified: trunk/data/qcsrc/menu/nexuiz/maplist.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/maplist.c 2008-01-28 03:52:21 UTC (rev 3293)
+++ trunk/data/qcsrc/menu/nexuiz/maplist.c 2008-01-28 09:12:33 UTC (rev 3294)
@@ -182,6 +182,8 @@
draw_Text(me.realUpperMargin1 * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 0) * me.realFontSize_x)) * eX, s, me.realFontSize, SKINCOLOR_MAPLIST_TITLE, theAlpha, 0);
s = draw_TextShortenToWidth(MapInfo_Map_author, me.columnNameSize / me.realFontSize_x, 0);
draw_Text(me.realUpperMargin2 * eY + (me.columnNameOrigin + 1.00 * (me.columnNameSize - draw_TextWidth(s, 0) * me.realFontSize_x)) * eX, s, me.realFontSize, SKINCOLOR_MAPLIST_AUTHOR, theAlpha, 0);
+
+ MapInfo_ClearTemps();
}
void refilterNexuizMapList(entity me)
More information about the nexuiz-commits
mailing list