Make Show fallback to global variables when sensible (bug #5278)

pull/2694/head
Capostrophic 4 years ago
parent 3ce3f364ea
commit aadf13b123

@ -197,6 +197,7 @@
Bug #5255: "GetTarget, player" doesn't return 1 during NPC hello
Bug #5261: Creatures can sometimes become stuck playing idles and never wander again
Bug #5269: Editor: Cell lighting in resaved cleaned content files is corrupted
Bug #5278: Console command Show doesn't fall back to global variable after local var not found
Feature #1774: Handle AvoidNode
Feature #2229: Improve pathfinding AI
Feature #3025: Analogue gamepad movement controls

@ -923,11 +923,7 @@ namespace MWScript
if (!ptr.isEmpty())
{
const std::string& script = ptr.getClass().getScript(ptr);
if (script.empty())
{
output << ptr.getCellRef().getRefId() << " has no script " << std::endl;
}
else
if (!script.empty())
{
const Compiler::Locals& locals =
MWBase::Environment::get().getScriptManager()->getLocals(script);
@ -941,13 +937,11 @@ namespace MWScript
case 'f':
output << ptr.getCellRef().getRefId() << "." << var << ": " << ptr.getRefData().getLocals().getFloatVar(script, var);
break;
default:
output << "unknown local '" << var << "' for '" << ptr.getCellRef().getRefId() << "'";
break;
// Do nothing otherwise
}
}
}
else
if (output.rdbuf()->in_avail() == 0)
{
MWBase::World *world = MWBase::Environment::get().getWorld();
char type = world->getGlobalVariableType (var);
@ -964,7 +958,7 @@ namespace MWScript
output << runtime.getContext().getGlobalFloat (var);
break;
default:
output << "unknown global variable";
output << "unknown variable";
}
}
runtime.getContext().report(output.str());

Loading…
Cancel
Save