From: TimePath Date: Sun, 16 Aug 2015 10:38:47 +0000 (+1000) Subject: Support filtering X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=fa5777e34c03e0d28ce1f0b044dd8905bd86ba4e;p=xonotic%2Fxonotic-data.pk3dir.git Support filtering --- diff --git a/qcsrc/menu/xonotic/dialog_media_guide.qc b/qcsrc/menu/xonotic/dialog_media_guide.qc index 8ea4214fbf..e7b573ff5e 100644 --- a/qcsrc/menu/xonotic/dialog_media_guide.qc +++ b/qcsrc/menu/xonotic/dialog_media_guide.qc @@ -37,6 +37,7 @@ CLASS(DebugSource, DataSource) .string name, icon; ATTRIB(DebugSource, entryName, .string, name) ATTRIB(DebugSource, entryIcon, .string, icon) + string DebugSource_activeFilter = ""; .entity chain; METHOD(DebugSource, getEntry, entity(int)) entity DebugSource_getEntry(int i) { @@ -45,6 +46,7 @@ CLASS(DebugSource, DataSource) for (e = findchainfloat(instanceOfObject, true); e; e = e.chain) { if (e.classname == "vtbl") continue; if (e.instanceOfItem) continue; + if (strstrofs(sprintf("entity %i", e), DebugSource_activeFilter, 0) < 0) continue; if (idx++ == i) break; } static entity entry; @@ -55,11 +57,13 @@ CLASS(DebugSource, DataSource) } METHOD(DebugSource, reload, int(string)) int DebugSource_reload(string filter) { + DebugSource_activeFilter = filter; int idx = 0; entity e; for (e = findchainfloat(instanceOfObject, true); e; e = e.chain) { if (e.classname == "vtbl") continue; if (e.instanceOfItem) continue; + if (strstrofs(sprintf("entity %i", e), DebugSource_activeFilter, 0) < 0) continue; idx++; } return idx;