- if(t == "nexball")
- {
- print("MapInfo_Type_FromString (probably ", MapInfo_Map_bspname, "): using deprecated name '", t);
- t = "nb";
- print("'. Should use '", t, "'.\n");
- }
- if(t == "freezetag")
- {
- print("MapInfo_Type_FromString (probably ", MapInfo_Map_bspname, "): using deprecated name '", t);
- t = "ft";
- print("'. Should use '", t, "'.\n");
- }
- if(t == "keepaway")
- {
- print("MapInfo_Type_FromString (probably ", MapInfo_Map_bspname, "): using deprecated name '", t);
- t = "ka";
- print("'. Should use '", t, "'.\n");
- }
- if(t == "invasion")
- {
- print("MapInfo_Type_FromString (probably ", MapInfo_Map_bspname, "): using deprecated name '", t);
- t = "inv";
- print("'. Should use '", t, "'.\n");
- }
- if(t == "assault")
- {
- print("MapInfo_Type_FromString (probably ", MapInfo_Map_bspname, "): using deprecated name '", t);
- t = "as";
- print("'. Should use '", t, "'.\n");
- }
- if(t == "race")
- {
- print("MapInfo_Type_FromString (probably ", MapInfo_Map_bspname, "): using deprecated name '", t);
- t = "rc";
- print("'. Should use '", t, "'.\n");
- }
- if(t == "all")
- return MAPINFO_TYPE_ALL;
- FOREACH(MAPINFO_TYPES, it.mdl == t, LAMBDA(return it.items));
+ FOREACH(Gametypes, it.items == t, LAMBDA(return it));
+ return NULL;
+}
+
+int MapInfo_Type_FromString(string t)
+{
+#define deprecate(from, to) do { \
+ if (t == #from) { \
+ string replacement = #to; \
+ LOG_WARNINGF("MapInfo_Type_FromString (probably %s): using deprecated name '%s'. Should use '%s'.\n", MapInfo_Map_bspname, t, replacement); \
+ t = replacement; \
+ } \
+} while (0)
+ deprecate(nexball, nb);
+ deprecate(freezetag, ft);
+ deprecate(keepaway, ka);
+ deprecate(invasion, inv);
+ deprecate(assault, as);
+ deprecate(race, rc);
+ if (t == "all") return MAPINFO_TYPE_ALL;
+ FOREACH(Gametypes, it.mdl == t, LAMBDA(return it.items));