From c1dfa980bf58fcc7f9be96d87c49cd4afae1b214 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 13 Aug 2013 17:31:15 -0700 Subject: [PATCH] Combine ShowVarsImplicit and ShowVarsExplicit Also removes an unnecessary else statement --- apps/openmw/mwscript/miscextensions.cpp | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index 54d778e89..234f67d8c 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -632,9 +632,9 @@ namespace MWScript }; - class OpShowVarsExplicit : public Interpreter::Opcode0 + template + class OpShowVars : public Interpreter::Opcode0 { - protected: void printLocalVars(Interpreter::Runtime &runtime, const MWWorld::Ptr &ptr) { std::stringstream str; @@ -675,16 +675,6 @@ namespace MWScript runtime.getContext().report(str.str()); } - public: - virtual void execute (Interpreter::Runtime& runtime) - { - MWWorld::Ptr ptr = ExplicitRef()(runtime); - printLocalVars(runtime, ptr); - } - }; - - class OpShowVarsImplicit : public OpShowVarsExplicit - { void printGlobalVars(Interpreter::Runtime &runtime) { std::stringstream str; @@ -701,8 +691,6 @@ namespace MWScript str<); interpreter.installSegment5 (Compiler::Misc::opcodeDisableTeleporting, new OpEnableTeleporting); interpreter.installSegment5 (Compiler::Misc::opcodeEnableTeleporting, new OpEnableTeleporting); - interpreter.installSegment5 (Compiler::Misc::opcodeShowVars, new OpShowVarsImplicit); - interpreter.installSegment5 (Compiler::Misc::opcodeShowVarsExplicit, new OpShowVarsExplicit); + interpreter.installSegment5 (Compiler::Misc::opcodeShowVars, new OpShowVars); + interpreter.installSegment5 (Compiler::Misc::opcodeShowVarsExplicit, new OpShowVars); } } }