Requested changes

This commit is contained in:
Zackhasacat 2024-02-08 21:51:54 -06:00
parent 4700fdcfc2
commit 86666761a3

View File

@ -53,7 +53,7 @@ namespace sol
namespace MWLua namespace MWLua
{ {
auto getGlobalVariableValue(const std::string_view globalId) -> float float getGlobalVariableValue(const std::string_view globalId)
{ {
char varType = MWBase::Environment::get().getWorld()->getGlobalVariableType(globalId); char varType = MWBase::Environment::get().getWorld()->getGlobalVariableType(globalId);
if (varType == 'f') if (varType == 'f')
@ -147,7 +147,7 @@ namespace MWLua
return getGlobalVariableValue(globalId); return getGlobalVariableValue(globalId);
}, },
[](const GlobalStore& store, int index) -> sol::optional<float> { [](const GlobalStore& store, int index) -> sol::optional<float> {
if (index < 1 || index >= store.getSize()) if (index < 1 || store.getSize() < index)
return sol::nullopt; return sol::nullopt;
auto g = store.at(index - 1); auto g = store.at(index - 1);
if (g == nullptr) if (g == nullptr)
@ -170,7 +170,7 @@ namespace MWLua
if (index >= store.getSize()) if (index >= store.getSize())
return sol::nullopt; return sol::nullopt;
const auto& global = store.at(index++); const ESM::Global* global = store.at(index++);
if (!global) if (!global)
return sol::nullopt; return sol::nullopt;