1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

vcmi: modernize lib/spells/effects

This commit is contained in:
Konstantin
2023-02-07 01:40:01 +03:00
parent cb3723b54c
commit e82cc56ddb
34 changed files with 154 additions and 355 deletions

View File

@@ -29,7 +29,7 @@ Effects::Effects() = default;
Effects::~Effects() = default;
void Effects::add(const std::string & name, std::shared_ptr<Effect> effect, const int level)
void Effects::add(const std::string & name, const std::shared_ptr<Effect>& effect, const int level)
{
effect->name = name;
data.at(level)[name] = effect;
@@ -97,7 +97,7 @@ bool Effects::applicable(Problem & problem, const Mechanics * m, const Target &
void Effects::forEachEffect(const int level, const std::function<void(const Effect *, bool &)> & callback) const
{
bool stop = false;
for(auto one : data.at(level))
for(const auto& one : data.at(level))
{
callback(one.second.get(), stop);
if(stop)
@@ -138,7 +138,7 @@ void Effects::serializeJson(const Registry * registry, JsonSerializeFormat & han
const JsonNode & effectMap = handler.getCurrent();
for(auto & p : effectMap.Struct())
for(const auto & p : effectMap.Struct())
{
const std::string & name = p.first;