This commit is contained in:
Kuyondo 2025-07-02 23:47:27 +08:00
parent a5580718f7
commit 2dc0d8abca

View File

@ -1238,7 +1238,7 @@ namespace MWScript
std::map<ESM::RefId, std::shared_ptr<GlobalScriptDesc>> globalScripts(scripts.begin(), scripts.end());
auto printVariables
= [&str](std::string_view scptName, const auto& names, const auto& values, std::string_view type) {
= [&str](const ESM::RefId& scptName, const auto& names, const auto& values, std::string_view type) {
size_t size = std::min(names.size(), values.size());
for (size_t i = 0; i < size; ++i)
{
@ -1253,19 +1253,18 @@ namespace MWScript
if (!script->mRunning)
continue;
const std::string scptName = refId.serializeText();
const Compiler::Locals& complocals
= MWBase::Environment::get().getScriptManager()->getLocals(refId);
const Locals& locals
= MWBase::Environment::get().getScriptManager()->getGlobalScripts().getLocals(refId);
if (locals.isEmpty())
str << std::endl << " No variables in script " << scptName;
str << std::endl << " No variables in script " << refId;
else
{
printVariables(scptName, complocals.get('s'), locals.mShorts, "short");
printVariables(scptName, complocals.get('l'), locals.mLongs, "long");
printVariables(scptName, complocals.get('f'), locals.mFloats, "float");
printVariables(refId, complocals.get('s'), locals.mShorts, "short");
printVariables(refId, complocals.get('l'), locals.mLongs, "long");
printVariables(refId, complocals.get('f'), locals.mFloats, "float");
}
}