mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
Use tuple instead of vector for comparing values
There are only 3 values, and they're only used for doing a comparison, so it's wasteful to create a whole vector for that. std::tuple is better suited for this use case.
This commit is contained in:
parent
4205701f96
commit
0718acdb6d
@ -840,11 +840,10 @@ CStackBasicDescriptor CGHeroInstance::calculateNecromancy (const BattleResult &b
|
||||
}
|
||||
else
|
||||
{
|
||||
auto quality = [getCreatureID](std::shared_ptr<Bonus> pick) -> std::vector<int>
|
||||
auto quality = [getCreatureID](std::shared_ptr<Bonus> pick) -> std::tuple<int, int, int>
|
||||
{
|
||||
const CCreature * c = VLC->creh->objects[getCreatureID(pick)];
|
||||
std::vector<int> v = {c->level, static_cast<int>(c->cost.marketValue()), -pick->additionalInfo[1]};
|
||||
return v;
|
||||
return std::tuple<int, int, int> {c->level, static_cast<int>(c->cost.marketValue()), -pick->additionalInfo[1]};
|
||||
};
|
||||
if(quality(topPick) < quality(newPick))
|
||||
topPick = newPick;
|
||||
|
Loading…
x
Reference in New Issue
Block a user