mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-06 00:55:50 +00:00
Merge branch 'more_move' into 'master'
Address Coverity Scan complaints left See merge request OpenMW/openmw!3837
This commit is contained in:
commit
76842c3ba1
@ -375,12 +375,18 @@ int MWDialogue::Filter::getSelectStructInteger(const SelectWrapper& select) cons
|
||||
return mChoice;
|
||||
|
||||
case SelectWrapper::Function_AiSetting:
|
||||
{
|
||||
int argument = select.getArgument();
|
||||
if (argument < 0 || argument > 3)
|
||||
{
|
||||
throw std::runtime_error("AiSetting index is out of range");
|
||||
}
|
||||
|
||||
return mActor.getClass()
|
||||
.getCreatureStats(mActor)
|
||||
.getAiSetting((MWMechanics::AiSetting)select.getArgument())
|
||||
.getAiSetting(static_cast<MWMechanics::AiSetting>(argument))
|
||||
.getModified(false);
|
||||
|
||||
}
|
||||
case SelectWrapper::Function_PcAttribute:
|
||||
{
|
||||
ESM::RefId attribute = ESM::Attribute::indexToRefId(select.getArgument());
|
||||
|
@ -344,18 +344,19 @@ namespace MWLua
|
||||
[world, context](const sol::object& staticOrID, const osg::Vec3f& worldPos) {
|
||||
auto model = getStaticModelOrThrow(staticOrID);
|
||||
context.mLuaManager->addAction(
|
||||
[world, model, worldPos]() { world->spawnEffect(model, "", worldPos); }, "openmw.vfx.spawn");
|
||||
[world, model = std::move(model), worldPos]() { world->spawnEffect(model, "", worldPos); },
|
||||
"openmw.vfx.spawn");
|
||||
},
|
||||
[world, context](const sol::object& staticOrID, const osg::Vec3f& worldPos, const sol::table& options) {
|
||||
auto model = getStaticModelOrThrow(staticOrID);
|
||||
|
||||
bool magicVfx = options.get_or("mwMagicVfx", true);
|
||||
std::string textureOverride = options.get_or<std::string>("particleTextureOverride", "");
|
||||
std::string texture = options.get_or<std::string>("particleTextureOverride", "");
|
||||
float scale = options.get_or("scale", 1.f);
|
||||
|
||||
context.mLuaManager->addAction(
|
||||
[world, model, textureOverride, worldPos, scale, magicVfx]() {
|
||||
world->spawnEffect(model, textureOverride, worldPos, scale, magicVfx);
|
||||
[world, model = std::move(model), texture = std::move(texture), worldPos, scale, magicVfx]() {
|
||||
world->spawnEffect(model, texture, worldPos, scale, magicVfx);
|
||||
},
|
||||
"openmw.vfx.spawn");
|
||||
});
|
||||
|
@ -42,7 +42,7 @@ namespace MWLua
|
||||
ObjectVariant mObject;
|
||||
|
||||
public:
|
||||
ItemData(ObjectVariant object)
|
||||
ItemData(const ObjectVariant& object)
|
||||
: mObject(object)
|
||||
{
|
||||
}
|
||||
@ -116,7 +116,7 @@ namespace MWLua
|
||||
item["itemData"] = [](const sol::object& object) -> sol::optional<ItemData> {
|
||||
ObjectVariant o(object);
|
||||
if (o.ptr().getClass().isItem(o.ptr()) || o.ptr().mRef->getType() == ESM::REC_LIGH)
|
||||
return ItemData(std::move(o));
|
||||
return ItemData(o);
|
||||
return {};
|
||||
};
|
||||
|
||||
|
@ -649,7 +649,7 @@ namespace MWLua
|
||||
scripts->setSavedDataDeserializer(mLocalSerializer.get());
|
||||
ESM::LuaScripts data;
|
||||
scripts->save(data);
|
||||
localData[id] = data;
|
||||
localData[id] = std::move(data);
|
||||
}
|
||||
|
||||
mMenuScripts.removeAllScripts();
|
||||
|
@ -85,7 +85,7 @@ namespace MWLua
|
||||
}
|
||||
|
||||
context.mLuaManager->addAction(
|
||||
[=] {
|
||||
[shader, name, values = std::move(values)] {
|
||||
MWBase::Environment::get().getWorld()->getPostProcessor()->setUniform(shader.mShader, name, values);
|
||||
},
|
||||
"SetUniformShaderAction");
|
||||
|
@ -274,7 +274,8 @@ namespace MWLua
|
||||
{
|
||||
ei = LuaUtil::cast<std::string>(item);
|
||||
}
|
||||
context.mLuaManager->addAction([obj = Object(ptr), ei = ei] { setSelectedEnchantedItem(obj.ptr(), ei); },
|
||||
context.mLuaManager->addAction(
|
||||
[obj = Object(ptr), ei = std::move(ei)] { setSelectedEnchantedItem(obj.ptr(), ei); },
|
||||
"setSelectedEnchantedItemAction");
|
||||
};
|
||||
|
||||
|
@ -117,7 +117,7 @@ namespace MWLua
|
||||
// The journal mwscript function has a try function here, we will make the lua function throw an
|
||||
// error. However, the addAction will cause it to error outside of this function.
|
||||
context.mLuaManager->addAction(
|
||||
[actor, q, stage] {
|
||||
[actor = std::move(actor), q, stage] {
|
||||
MWWorld::Ptr actorPtr;
|
||||
if (actor)
|
||||
actorPtr = actor->ptr();
|
||||
|
@ -241,7 +241,7 @@ namespace MWLua
|
||||
for (unsigned i = 0; i < newStack.size(); ++i)
|
||||
newStack[i] = nameToMode.at(LuaUtil::cast<std::string_view>(modes[i + 1]));
|
||||
luaManager->addAction(
|
||||
[windowManager, newStack, arg]() {
|
||||
[windowManager, newStack = std::move(newStack), arg]() {
|
||||
MWWorld::Ptr ptr;
|
||||
if (arg.has_value())
|
||||
ptr = arg->ptr();
|
||||
@ -319,7 +319,7 @@ namespace MWLua
|
||||
};
|
||||
|
||||
auto uiLayer = context.mLua->sol().new_usertype<LuaUi::Layer>("UiLayer");
|
||||
uiLayer["name"] = sol::readonly_property([](LuaUi::Layer& self) { return self.name(); });
|
||||
uiLayer["name"] = sol::readonly_property([](LuaUi::Layer& self) -> std::string_view { return self.name(); });
|
||||
uiLayer["size"] = sol::readonly_property([](LuaUi::Layer& self) { return self.size(); });
|
||||
uiLayer[sol::meta_function::to_string]
|
||||
= [](LuaUi::Layer& self) { return Misc::StringUtils::format("UiLayer(%s)", self.name()); };
|
||||
|
Loading…
Reference in New Issue
Block a user