1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

vcmi: modernize lua

This commit is contained in:
Konstantin
2023-02-05 19:24:34 +03:00
parent fb38050f9b
commit 976c5e7bd4
11 changed files with 43 additions and 35 deletions

View File

@@ -94,7 +94,7 @@ bool LuaSpellEffect::applicable(Problem & problem, const Mechanics * m, const Ef
if(target.empty())
return false;
for(auto & dest : target)
for(const auto & dest : target)
{
JsonNode targetData;
targetData.Vector().push_back(JsonUtils::intNode(dest.hexValue.hex));
@@ -137,7 +137,7 @@ void LuaSpellEffect::apply(ServerCallback * server, const Mechanics * m, const E
JsonNode requestP;
for(auto & dest : target)
for(const auto & dest : target)
{
JsonNode targetData;
targetData.Vector().push_back(JsonUtils::intNode(dest.hexValue.hex));
@@ -176,7 +176,7 @@ std::shared_ptr<Context> LuaSpellEffect::resolveScript(const Mechanics * m) cons
return m->battle()->getContextPool()->getContext(script);
}
void LuaSpellEffect::setContextVariables(const Mechanics * m, std::shared_ptr<Context> context) const
void LuaSpellEffect::setContextVariables(const Mechanics * m, const std::shared_ptr<Context>& context)
{
context->setGlobal("effectLevel", m->getEffectLevel());
context->setGlobal("effectRangeLevel", m->getRangeLevel());