From: TimePath Date: Tue, 27 Oct 2015 05:54:54 +0000 (+1100) Subject: OO: `super` considered harmful; does not handle multiple ancestors X-Git-Tag: xonotic-v0.8.2~1779 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b3a4cec80ae1fe3b99fb8f6ed9d3572b5635eed1;p=xonotic%2Fxonotic-data.pk3dir.git OO: `super` considered harmful; does not handle multiple ancestors --- diff --git a/qcsrc/common/turrets/turret/plasma.qc b/qcsrc/common/turrets/turret/plasma.qc index 318f4e8ae..7ed255911 100644 --- a/qcsrc/common/turrets/turret/plasma.qc +++ b/qcsrc/common/turrets/turret/plasma.qc @@ -41,7 +41,7 @@ METHOD(PlasmaTurret, tr_attack, void(PlasmaTurret this)) } else { - super.tr_attack(this); + SUPER(PlasmaTurret).tr_attack(this); } if (self.tur_head.frame == 0) self.tur_head.frame = 1; diff --git a/qcsrc/common/turrets/turret/plasma_dual.qc b/qcsrc/common/turrets/turret/plasma_dual.qc index 387ae44a5..8069401e4 100644 --- a/qcsrc/common/turrets/turret/plasma_dual.qc +++ b/qcsrc/common/turrets/turret/plasma_dual.qc @@ -41,7 +41,7 @@ METHOD(DualPlasmaTurret, tr_attack, void(DualPlasmaTurret this)) vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos); WarpZone_TrailParticles(world, particleeffectnum(EFFECT_VAPORIZER(self.team)), self.tur_shotorg, v); } else { - super.vtblbase.tr_attack(this); + SUPER(PlasmaTurret).tr_attack(this); } self.tur_head.frame += 1; } diff --git a/qcsrc/lib/oo.qh b/qcsrc/lib/oo.qh index 8d60cda04..6a9a2e3b7 100644 --- a/qcsrc/lib/oo.qh +++ b/qcsrc/lib/oo.qh @@ -146,7 +146,6 @@ STATIC_INIT(RegisterClasses) } #define SUPER(cname) (cname##_vtbl.vtblbase) -#define super (this.vtblbase.vtblbase) #define spawn_static(this) #define spawn_1(this) diff --git a/qcsrc/menu/xonotic/datasource.qc b/qcsrc/menu/xonotic/datasource.qc index 57ce0c80c..3b8be8d27 100644 --- a/qcsrc/menu/xonotic/datasource.qc +++ b/qcsrc/menu/xonotic/datasource.qc @@ -57,13 +57,13 @@ CLASS(CvarStringSource, StringSource) { string s = this.CvarStringSource_cvar; this.StringSource_str = s ? cvar_string(s) : string_null; - return super.getEntry(this, i, returns); + return SUPER(CvarStringSource).getEntry(this, i, returns); } METHOD(CvarStringSource, reload, int(entity this, string filter)) { string s = this.CvarStringSource_cvar; this.StringSource_str = s ? cvar_string(s) : string_null; - return super.reload(this, filter); + return SUPER(CvarStringSource).reload(this, filter); } ENDCLASS(CvarStringSource) #endif diff --git a/qcsrc/menu/xonotic/dialog_settings_game.qc b/qcsrc/menu/xonotic/dialog_settings_game.qc index 3c1503b29..0a9907b80 100644 --- a/qcsrc/menu/xonotic/dialog_settings_game.qc +++ b/qcsrc/menu/xonotic/dialog_settings_game.qc @@ -94,7 +94,7 @@ CLASS(XonoticRegisteredSettingsList, XonoticListBox) } METHOD(XonoticRegisteredSettingsList, resizeNotify, void(entity this, vector relOrigin, vector relSize, vector absOrigin, vector absSize)) { - super.resizeNotify(this, relOrigin, relSize, absOrigin, absSize); + SUPER(XonoticRegisteredSettingsList).resizeNotify(this, relOrigin, relSize, absOrigin, absSize); this.itemAbsSize = '0 0 0'; this.realFontSize_y = this.fontSize / (this.itemAbsSize_y = (absSize.y * this.itemHeight)); @@ -103,7 +103,7 @@ CLASS(XonoticRegisteredSettingsList, XonoticListBox) } METHOD(XonoticRegisteredSettingsList, setSelected, void(entity this, int i)) { - super.setSelected(this, i); + SUPER(XonoticRegisteredSettingsList).setSelected(this, i); this.onChange(this, this.onChangeEntity); } CONSTRUCTOR(XonoticRegisteredSettingsList, DataSource _source) {