diff --git a/apps/openmw/mwgui/console.cpp b/apps/openmw/mwgui/console.cpp index 836a0f0db..0421dc370 100644 --- a/apps/openmw/mwgui/console.cpp +++ b/apps/openmw/mwgui/console.cpp @@ -17,6 +17,8 @@ namespace MWGui ConsoleInterpreterContext (Console& console, MWWorld::Environment& environment, MWWorld::Ptr reference); + + virtual void report (const std::string& message); }; ConsoleInterpreterContext::ConsoleInterpreterContext (Console& console, @@ -26,6 +28,11 @@ namespace MWGui mConsole (console) {} + void ConsoleInterpreterContext::report (const std::string& message) + { + mConsole.printOK (message); + } + bool Console::compile (const std::string& cmd, Compiler::Output& output) { try diff --git a/apps/openmw/mwscript/controlextensions.cpp b/apps/openmw/mwscript/controlextensions.cpp index 3d65c5705..893af259f 100644 --- a/apps/openmw/mwscript/controlextensions.cpp +++ b/apps/openmw/mwscript/controlextensions.cpp @@ -48,7 +48,7 @@ namespace MWScript bool enabled = context.getWorld().toggleCollisionMode(); - context.messageBox (enabled ? "Collsion -> On" : "Collision -> Off"); + context.report (enabled ? "Collsion -> On" : "Collision -> Off"); } }; diff --git a/apps/openmw/mwscript/interpretercontext.cpp b/apps/openmw/mwscript/interpretercontext.cpp index cb6ecb218..77a71a1d4 100644 --- a/apps/openmw/mwscript/interpretercontext.cpp +++ b/apps/openmw/mwscript/interpretercontext.cpp @@ -110,6 +110,11 @@ namespace MWScript mEnvironment.mWindowManager->messageBox (message, buttons); } + void InterpreterContext::report (const std::string& message) + { + messageBox (message); + } + bool InterpreterContext::menuMode() { return mEnvironment.mWindowManager->isGuiMode(); diff --git a/apps/openmw/mwscript/interpretercontext.hpp b/apps/openmw/mwscript/interpretercontext.hpp index aebfc620e..35b4a169d 100644 --- a/apps/openmw/mwscript/interpretercontext.hpp +++ b/apps/openmw/mwscript/interpretercontext.hpp @@ -57,9 +57,13 @@ namespace MWScript virtual void setLocalFloat (int index, float value); using Interpreter::Context::messageBox; + virtual void messageBox (const std::string& message, const std::vector& buttons); + virtual void report (const std::string& message); + ///< By default echo via messageBox. + virtual bool menuMode(); virtual int getGlobalShort (const std::string& name) const; diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index e1c9eae3b..d8dfbdde4 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -102,7 +102,7 @@ namespace MWScript bool enabled = context.getWorld().toggleRenderMode (MWWorld::World::Render_CollisionDebug); - context.messageBox (enabled ? + context.report (enabled ? "Collsion Mesh Rendering -> On" : "Collision Mesh Rendering -> Off"); } }; diff --git a/apps/openmw/mwscript/skyextensions.cpp b/apps/openmw/mwscript/skyextensions.cpp index 1a761e3bb..caa07c095 100644 --- a/apps/openmw/mwscript/skyextensions.cpp +++ b/apps/openmw/mwscript/skyextensions.cpp @@ -24,7 +24,7 @@ namespace MWScript bool enabled = context.getWorld().toggleSky(); - context.messageBox (enabled ? "Sky -> On" : "Sky -> Off"); + context.report (enabled ? "Sky -> On" : "Sky -> Off"); } }; diff --git a/components/interpreter/context.hpp b/components/interpreter/context.hpp index 0d77903f4..973b22d35 100644 --- a/components/interpreter/context.hpp +++ b/components/interpreter/context.hpp @@ -18,21 +18,23 @@ namespace Interpreter virtual float getLocalFloat (int index) const = 0; - virtual void setLocalShort (int index, int value) = 0; + virtual void setLocalShort (int index, int value) = 0; - virtual void setLocalLong (int index, int value) = 0; + virtual void setLocalLong (int index, int value) = 0; virtual void setLocalFloat (int index, float value) = 0; - + virtual void messageBox (const std::string& message, - const std::vector& buttons) = 0; - + const std::vector& buttons) = 0; + void messageBox (const std::string& message) { std::vector empty; messageBox (message, empty); } - + + virtual void report (const std::string& message) = 0; + virtual bool menuMode() = 0; virtual int getGlobalShort (const std::string& name) const = 0; @@ -41,31 +43,29 @@ namespace Interpreter virtual float getGlobalFloat (const std::string& name) const = 0; - virtual void setGlobalShort (const std::string& name, int value) = 0; + virtual void setGlobalShort (const std::string& name, int value) = 0; - virtual void setGlobalLong (const std::string& name, int value) = 0; + virtual void setGlobalLong (const std::string& name, int value) = 0; + + virtual void setGlobalFloat (const std::string& name, float value) = 0; - virtual void setGlobalFloat (const std::string& name, float value) = 0; - virtual bool isScriptRunning (const std::string& name) const = 0; - + virtual void startScript (const std::string& name) = 0; - + virtual void stopScript (const std::string& name) = 0; - + virtual float getDistance (const std::string& name, const std::string& id = "") const - = 0; - + = 0; + virtual float getSecondsPassed() const = 0; - + virtual bool isDisabled (const std::string& id = "") const = 0; - + virtual void enable (const std::string& id = "") = 0; - - virtual void disable (const std::string& id = "") = 0; + + virtual void disable (const std::string& id = "") = 0; }; } #endif - -