1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

VCAI compareArtifacts: consider that art with highest price is best

That is suboptimal way as well, but let us avoid infinite loop there. Fix issue 2461
This commit is contained in:
Arseniy Shestakov 2016-09-08 04:26:01 +03:00
parent e16552c2c6
commit 78a560767b

View File

@ -509,8 +509,10 @@ bool compareArtifacts(const CArtifactInstance *a1, const CArtifactInstance *a2)
auto art1 = a1->artType;
auto art2 = a2->artType;
if (art1->valOfBonuses(Bonus::PRIMARY_SKILL) > art2->valOfBonuses(Bonus::PRIMARY_SKILL))
if(art1->price == art2->price)
return art1->valOfBonuses(Bonus::PRIMARY_SKILL) > art2->valOfBonuses(Bonus::PRIMARY_SKILL);
else if(art1->price > art2->price)
return true;
else
return art1->price > art2->price;
return false;
}