#define SLIST_CATEGORY(name,enoverride,dioverride,str) \
SET_FIELD_COUNT(name, CATEGORY_FIRST, category_ent_count) \
CHECK_MAX_COUNT(name, MAX_CATEGORIES, category_ent_count, "SLIST_CATEGORY") \
- cat = spawn(); \
- categories[name - 1] = cat; \
- cat.classname = "slist_category"; \
+ cat = categories[name - 1] = new(slist_category); \
cat.cat_name = strzone(#name); \
cat.cat_enoverride_string = strzone(SLIST_CATEGORY_AUTOCVAR(name)); \
cat.cat_dioverride_string = strzone(dioverride); \
else
{
error(sprintf("RetrieveCategoryEnt(%d): Improper category number!\n", catnum));
- return world;
+ return NULL;
}
}
bool isv4, isv6;
vector theColor;
float theAlpha;
- bool pure = false;
+ bool pure = false, pure_available = false;
int freeslots = -1, sflags = -1, j, m;
string s, typestr, versionstr, k, v, modname;
k = substring(argv(j), 0, 1);
v = substring(argv(j), 1, -1);
if(k == "P")
- pure = stob(v);
+ {
+ pure = (stof(v) == 0);
+ pure_available = true;
+ }
else if(k == "S")
freeslots = stof(v);
else if(k == "F")
#ifdef COMPAT_NO_MOD_IS_XONOTIC
if(modname == "")
- modname = "Xonotic";
+ modname = "xonotic";
#endif
+ modname = strtolower(modname);
+
/*
SLIST_FIELD_MOD = gethostcacheindexforkey("mod");
s = gethostcachestring(SLIST_FIELD_MOD, i);
if(s != "data")
- if(modname == "Xonotic")
+ if(modname == "xonotic")
modname = s;
*/
// list the mods here on which the pure server check actually works
- if(modname != "Xonotic")
- if(modname != "InstaGib" || modname != "MinstaGib")
- if(modname != "CTS")
- if(modname != "NIX")
- if(modname != "NewToys")
- pure = false;
+ if(modname != "xonotic")
+ if(modname != "instagib" || modname != "minstagib")
+ if(modname != "cts")
+ if(modname != "nix")
+ if(modname != "newtoys")
+ pure_available = false;
if(gethostcachenumber(SLIST_FIELD_FREESLOTS, i) <= 0)
theAlpha = SKINALPHA_SERVERLIST_FULL;
iconPos.x += iconSize.x;
// Mod
- if(modname == "Xonotic")
+ if(modname == "xonotic")
{
- if(pure == 0)
+ // Here, pure_available should always be set. If not, consider
+ // it an impurity.
+ if(pure_available && pure)
draw_Picture(iconPos, "icon_pure1", iconSize, '1 1 1', 1);
}
else
if(draw_PictureSize(icon) == '0 0 0')
icon = "icon_mod_";
- if(pure == 0)
- draw_Picture(iconPos, icon, iconSize, '1 1 1', 1);
- else
+ // In mods, pure_available not being present indicates
+ // non-support of the feature. Just show the mod icon as is
+ // then.
+ if(pure_available && !pure)
draw_Picture(iconPos, icon, iconSize, '1 1 1', SKINALPHA_SERVERLIST_ICON_NONPURE);
+ else
+ draw_Picture(iconPos, icon, iconSize, '1 1 1', 1);
}
iconPos.x += iconSize.x;