From 91433d8b1a45f9ad7d1d9983df54180b6ae2cb2f Mon Sep 17 00:00:00 2001 From: TimePath Date: Mon, 17 Aug 2015 16:27:16 +1000 Subject: [PATCH] Fix handling of unknown entities --- qcsrc/common/oo.qh | 4 ++-- qcsrc/menu/xonotic/dialog_media_guide.qc | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/qcsrc/common/oo.qh b/qcsrc/common/oo.qh index 1e16793351..01c9db9154 100644 --- a/qcsrc/common/oo.qh +++ b/qcsrc/common/oo.qh @@ -118,9 +118,9 @@ STATIC_INIT(RegisterClasses) { RegisterClasses(); } #define _vtbl NULL CLASS(Object, ); METHOD(Object, describe, string(entity this)) - string Object_describe(entity) { return string_null; } + string Object_describe(entity this) { return _("No description"); } METHOD(Object, display, void(entity this, void(string name, string icon) returns)) - void Object_display(entity, void(string, string)) { } + void Object_display(entity this, void(string name, string icon) returns) { returns(sprintf("entity %i", this), "nopreview_menuskin"); } ENDCLASS(Object) #undef spawn_static #undef spawn_1 diff --git a/qcsrc/menu/xonotic/dialog_media_guide.qc b/qcsrc/menu/xonotic/dialog_media_guide.qc index fcc2719faa..3c2fb8acd3 100644 --- a/qcsrc/menu/xonotic/dialog_media_guide.qc +++ b/qcsrc/menu/xonotic/dialog_media_guide.qc @@ -53,10 +53,7 @@ CLASS(DebugSource, DataSource) if (strstrofs(sprintf("entity %i", e), DebugSource_activeFilter, 0) < 0) continue; if (idx++ == i) break; } - if (returns) { - if (e.display) e.display(e, returns); - else returns(sprintf("entity %i", e), ""); - } + if (returns) e.display(e, returns); return e; } METHOD(DebugSource, reload, int(string)) @@ -196,7 +193,7 @@ void XonoticGuideTab_entryChangeNotify(entity, entity this) entity desc = this.descriptionPane; entity entries = this.entryList; entity e = entries.source.getEntry(entries.selectedItem, func_null); - string s = e.describe ? e.describe(e) : _("No description"); + string s = e.describe(e); if (cvar("developer")) { s = sprintf("entity %i\n%s", e, s); } desc.setDescription(desc, s); } -- 2.39.2