}
else
{
- Gametype type = MapInfo_Type_FromString(gt);
+ Gametype type = MapInfo_Type_FromString(gt, false);
mv_pk3[i] = strzone(MapInfo_Type_ToText(type));
mv_desc[i] = MapInfo_Type_Description(type);
}
}
}
-Gametype MapInfo_Type_FromString(string gtype)
+Gametype MapInfo_Type_FromString(string gtype, bool dowarn)
{
string replacement = "";
switch (gtype)
}
if (replacement != "")
{
- if (WARN_COND)
+ if (dowarn && WARN_COND)
LOG_WARNF("MapInfo_Type_FromString (probably %s): using deprecated name '%s'. Should use '%s'.", MapInfo_Map_bspname, gtype, replacement);
gtype = replacement;
}
else if(t == "type")
{
t = car(s); s = cdr(s);
- Gametype f = MapInfo_Type_FromString(t);
+ Gametype f = MapInfo_Type_FromString(t, true);
//if(WARN_COND)
//LOG_WARN("Map ", pFilename, " contains the legacy 'type' keyword which is deprecated and will be removed in the future. Please migrate the mapinfo file to 'gametype'.");
if(f)
else if(t == "gametype")
{
t = car(s); s = cdr(s);
- Gametype f = MapInfo_Type_FromString(t);
+ Gametype f = MapInfo_Type_FromString(t, true);
if(f)
_MapInfo_Map_ApplyGametypeEx (s, pGametypeToSet, f);
else if(WARN_COND)
t = car(s); s = cdr(s);
bool all = t == "all";
Gametype f = NULL;
- if(all || (f = MapInfo_Type_FromString(t)))
+ if(all || (f = MapInfo_Type_FromString(t, true)))
{
if((all ? MAPINFO_TYPE_ALL : f.m_flags) & pGametypeToSet.m_flags)
{
t = car(s); s = cdr(s);
bool all = t == "all";
Gametype f = NULL;
- if(all || (f = MapInfo_Type_FromString(t)))
+ if(all || (f = MapInfo_Type_FromString(t, true)))
{
if((all ? MAPINFO_TYPE_ALL : f.m_flags) & pGametypeToSet.m_flags)
{
Gametype MapInfo_CurrentGametype()
{
- Gametype prev = REGISTRY_GET(Gametypes, cvar("gamecfg"));
+ Gametype prev = MapInfo_Type_FromString(cvar_string("gamecfg"), false);
FOREACH(Gametypes, cvar(it.netname) && it != prev, return it);
return prev ? prev : MAPINFO_TYPE_DEATHMATCH;
}
void MapInfo_LoadMapSettings_SaveGameType(Gametype t)
{
MapInfo_SwitchGameType(t);
- cvar_set("gamecfg", ftos(t.m_id));
+ cvar_set("gamecfg", t.mdl);
MapInfo_LoadedGametype = t;
}
// gets a gametype from a string
string _MapInfo_GetDefaultEx(Gametype t);
float _MapInfo_GetTeamPlayBool(Gametype t);
-Gametype MapInfo_Type_FromString(string t);
+Gametype MapInfo_Type_FromString(string t, bool dowarn);
string MapInfo_Type_Description(Gametype t);
string MapInfo_Type_ToString(Gametype t);
string MapInfo_Type_ToText(Gametype t);
}
if(this.gametype != "")
- MapInfo_SwitchGameType(MapInfo_Type_FromString(this.gametype));
+ MapInfo_SwitchGameType(MapInfo_Type_FromString(this.gametype, false));
if (this.chmap == "")
{
if(s != "data")
modname = sprintf("%s (%s)", modname, s);
- Gametype j = MapInfo_Type_FromString(typestr); // try and get the real name of the game type
+ Gametype j = MapInfo_Type_FromString(typestr, false); // try and get the real name of the game type
if(j) { typestr = MapInfo_Type_ToText(j); } // only set it if we actually found it
me.currentServerType = strzone(typestr);
string thismapname, wantedmapname;
thismapname = GetMapname();
wantedmapname = campaign_gametype[0];
- if(MapInfo_CurrentGametype() != MapInfo_Type_FromString(wantedmapname))
+ if(MapInfo_CurrentGametype() != MapInfo_Type_FromString(wantedmapname, false))
return CampaignBailout("wrong game type!");
wantedmapname = campaign_mapname[0];
if(wantedmapname != thismapname)
if(autocvar_sv_cheats)
{
- MapInfo_SwitchGameType(MapInfo_Type_FromString(campaign_gametype[0]));
+ MapInfo_SwitchGameType(MapInfo_Type_FromString(campaign_gametype[0], false));
CampaignFile_Unload();
CampaignBailout("JOLLY CHEATS AHAHAHAHAHAHAH))");
return;
cvar_settemp("skill", ftos(baseskill));
cvar_settemp("bot_number", ftos(campaign_bots[0]));
- MapInfo_SwitchGameType(MapInfo_Type_FromString(campaign_gametype[0]));
+ MapInfo_SwitchGameType(MapInfo_Type_FromString(campaign_gametype[0], false));
if(Campaign_Invalid())
return;
if (argv(1) != "")
{
string s = argv(1);
- Gametype t = MapInfo_Type_FromString(s), tsave = MapInfo_CurrentGametype();
+ Gametype t = MapInfo_Type_FromString(s, false), tsave = MapInfo_CurrentGametype();
if (t)
{
*/
Gametype GameTypeVote_Type_FromString(string type_name)
{
- Gametype type = MapInfo_Type_FromString(type_name);
+ Gametype type = MapInfo_Type_FromString(type_name, false);
if (type == NULL)
type = MapInfo_Type_FromString(cvar_string(
- strcat("sv_vote_gametype_",type_name,"_type")));
+ strcat("sv_vote_gametype_",type_name,"_type")), false);
return type;
}
{
int flag = GTV_FORBIDDEN;
- Gametype type = MapInfo_Type_FromString(type_name);
+ Gametype type = MapInfo_Type_FromString(type_name, false);
if ( type == NULL )
{
type = MapInfo_Type_FromString(cvar_string(
- strcat("sv_vote_gametype_",type_name,"_type")));
+ strcat("sv_vote_gametype_",type_name,"_type")), false);
flag |= GTV_CUSTOM;
}