ATTRIB(Gametype, model2, string, string_null)
/** game type description */
ATTRIB(Gametype, gametype_description, string, string_null)
+
+ METHOD(Gametype, describe, string(entity this))
+ string Gametype_describe(entity this) { return this.gametype_description; }
+
+ METHOD(Gametype, display, void(entity this, void(string name, string icon) returns))
+ void Gametype_display(entity this, void(string, string) returns) { returns(this.message, strcat("gametype_", this.mdl)); }
+
CONSTRUCTOR(Gametype, string hname, string sname, string g_name, bool gteamplay, string defaults, string gdescription)
{
CONSTRUCT(Gametype);
#define spawn_1(this)
#define _vtbl NULL
CLASS(Object, );
- ATTRIB(Object, description, string, string_null)
+ METHOD(Object, describe, string(entity this))
+ METHOD(Object, display, void(entity this, void(string name, string icon) returns))
ENDCLASS(Object)
#undef spawn_static
#undef spawn_1
if (strstrofs(sprintf("entity %i", e), DebugSource_activeFilter, 0) < 0) continue;
if (idx++ == i) break;
}
- if (returns) returns(sprintf("entity %i", e), "");
+ if (returns) {
+ if (e.display) e.display(e, returns);
+ else returns(sprintf("entity %i", e), "");
+ }
return e;
}
METHOD(DebugSource, reload, int(string))
#include "../../common/mapinfo.qh"
CLASS(GametypeSource, DataSource)
- .string mdl, message;
METHOD(GametypeSource, getEntry, entity(int, void(string, string)))
entity GametypeSource_getEntry(int i, void(string, string) returns) {
entity e = MAPINFO_TYPES[i];
- if (returns) returns(e.message, strcat("gametype_", e.mdl));
+ if (returns) e.display(e, returns);
return e;
}
METHOD(GametypeSource, reload, int(string))
entity desc = this.descriptionPane;
entity entries = this.entryList;
entity e = entries.source.getEntry(entries.selectedItem, func_null);
- string s = e.description;
- string s2 = s ? s : _("No description");
- if (cvar("developer")) { if (!s) s2 = sprintf("entity %i\n%s", e, s2); }
- desc.setDescription(desc, s2);
+ string s = e.describe ? e.describe(e) : _("No description");
+ if (cvar("developer")) { s = sprintf("entity %i\n%s", e, s); }
+ desc.setDescription(desc, s);
}
#endif