From 578beb630575f6785fdd1eebe71392e548fdce11 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Sun, 10 Mar 2019 17:05:56 +0300 Subject: [PATCH] Use selected object local variables in console (feature #3893) --- CHANGELOG.md | 1 + apps/openmw/mwgui/console.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d14b45e90..534ab2270 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ Feature #2229: Improve pathfinding AI Feature #3442: Default values for fallbacks from ini file Feature #3610: Option to invert X axis + Feature #3893: Implicit target for "set" function in console Feature #3980: In-game option to disable controller Feature #4209: Editor: Faction rank sub-table Feature #4673: Weapon sheathing diff --git a/apps/openmw/mwgui/console.cpp b/apps/openmw/mwgui/console.cpp index 929dffe48..899bc0d90 100644 --- a/apps/openmw/mwgui/console.cpp +++ b/apps/openmw/mwgui/console.cpp @@ -11,10 +11,12 @@ #include "../mwscript/extensions.hpp" #include "../mwbase/environment.hpp" +#include "../mwbase/scriptmanager.hpp" #include "../mwbase/windowmanager.hpp" #include "../mwbase/world.hpp" #include "../mwworld/esmstore.hpp" +#include "../mwworld/class.hpp" namespace MWGui { @@ -173,6 +175,12 @@ namespace MWGui print("> " + command + "\n"); Compiler::Locals locals; + if (!mPtr.isEmpty()) + { + std::string script = mPtr.getClass().getScript(mPtr); + if (!script.empty()) + locals = MWBase::Environment::get().getScriptManager()->getLocals(script); + } Compiler::Output output (locals); if (compile (command + "\n", output))