// now store all the stuff
bufstr_set(_MapInfo_Cache_Buf_IndexToMapData, i, MapInfo_Map_bspname);
bufstr_set(_MapInfo_Cache_Buf_IndexToMapData, ++i, MapInfo_Map_title);
+ bufstr_set(_MapInfo_Cache_Buf_IndexToMapData, ++i, MapInfo_Map_titlestring);
bufstr_set(_MapInfo_Cache_Buf_IndexToMapData, ++i, MapInfo_Map_description);
bufstr_set(_MapInfo_Cache_Buf_IndexToMapData, ++i, MapInfo_Map_author);
bufstr_set(_MapInfo_Cache_Buf_IndexToMapData, ++i, ftos(MapInfo_Map_supportedGametypes));
// now retrieve all the stuff
MapInfo_Map_bspname = bufstr_get(_MapInfo_Cache_Buf_IndexToMapData, i);
MapInfo_Map_title = bufstr_get(_MapInfo_Cache_Buf_IndexToMapData, ++i);
+ MapInfo_Map_titlestring = bufstr_get(_MapInfo_Cache_Buf_IndexToMapData, ++i);
MapInfo_Map_description = bufstr_get(_MapInfo_Cache_Buf_IndexToMapData, ++i);
MapInfo_Map_author = bufstr_get(_MapInfo_Cache_Buf_IndexToMapData, ++i);
MapInfo_Map_supportedGametypes = stof(bufstr_get(_MapInfo_Cache_Buf_IndexToMapData, ++i));
void _MapInfo_Map_Reset()
{
MapInfo_Map_title = "<TITLE>";
+ MapInfo_Map_titlestring = "<TITLE>";
MapInfo_Map_description = "<DESCRIPTION>";
MapInfo_Map_author = "<AUTHOR>";
MapInfo_Map_supportedGametypes = 0;
}
}
+float MapInfo_isRedundant(string fn, string t)
+{
+ // normalize file name
+ fn = strreplace("_", "-", fn);
+
+ // normalize visible title
+ t = strreplace(": ", "-", t);
+ t = strreplace(":", "-", t);
+ t = strreplace(" ", "-", t);
+ t = strreplace("_", "-", t);
+
+ if(!strcasecmp(fn, t))
+ return TRUE;
+
+ // we allow the visible title to have punctuation the file name does
+ // not, but not vice versa
+ t = strreplace("-", "", t);
+
+ if(!strcasecmp(fn, t))
+ return TRUE;
+
+ return FALSE;
+}
+
// load info about a map by name into the MapInfo_Map_* globals
float MapInfo_Get_ByName(string pFilename, float pAllowGenerate, float pGametypeToSet)
{
}
}
- MapInfo_Cache_Store();
+ if(MapInfo_Map_titlestring == "<TITLE>")
+ MapInfo_Map_titlestring = MapInfo_Map_bspname;
+ else if(MapInfo_isRedundant(MapInfo_Map_bspname, MapInfo_Map_title))
+ MapInfo_Map_titlestring = MapInfo_Map_title;
+ else
+ MapInfo_Map_titlestring = sprintf(_("%s: %s"), MapInfo_Map_bspname, MapInfo_Map_title);
+
+ MapInfo_cache_Store();
if(MapInfo_Map_supportedGametypes != 0)
return r;
dprint("Map ", pFilename, " supports no game types, ignored\n");
{
MapInfo_Map_bspname = string_null;
MapInfo_Map_title = string_null;
+ MapInfo_Map_titlestring = string_null;
MapInfo_Map_description = string_null;
MapInfo_Map_author = string_null;
MapInfo_Map_clientstuff = string_null;
draw_Picture(me.columnPreviewOrigin * eX, strcat("/maps/", MapInfo_Map_bspname), me.columnPreviewSize * eX + eY, '1 1 1', theAlpha);
if(included)
draw_Picture(me.checkMarkOrigin, "checkmark", me.checkMarkSize, '1 1 1', 1);
- s = draw_TextShortenToWidth(strcat(MapInfo_Map_bspname, ": ", MapInfo_Map_title), me.columnNameSize, 0, me.realFontSize);
+ s = draw_TextShortenToWidth(MapInfo_Map_titlestring, me.columnNameSize, 0, me.realFontSize);
draw_Text(me.realUpperMargin1 * eY + (me.columnNameOrigin + 0.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, SKINCOLOR_MAPLIST_TITLE, theAlpha, 0);
s = draw_TextShortenToWidth(MapInfo_Map_author, me.columnNameSize, 0, me.realFontSize);
draw_Text(me.realUpperMargin2 * eY + (me.columnNameOrigin + 1.00 * (me.columnNameSize - draw_TextWidth(s, 0, me.realFontSize))) * eX, s, me.realFontSize, SKINCOLOR_MAPLIST_AUTHOR, theAlpha, 0);