1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-15 20:03:15 +02:00

Apply suggestions from code review

Co-authored-by: Nordsoft91 <nordsoft@yahoo.com>
This commit is contained in:
SoundSSGood
2022-11-18 22:15:03 +02:00
committed by GitHub
parent e9ab894638
commit 30bbb57619
3 changed files with 7 additions and 10 deletions

View File

@@ -216,7 +216,7 @@ bool CHeroArtPlace::askToAssemble(const CArtifactInstance *art, ArtifactPosition
auto assemblyPossibilities = art->assemblyPossibilities(hero, assembleEqipped);
// If the artifact can be assembled, display dialog.
for(auto combination : assemblyPossibilities)
for(const auto * combination : assemblyPossibilities)
{
LOCPLINT->showArtifactAssemblyDialog(
art->artType,
@@ -824,9 +824,7 @@ void CArtifactsOfHero::artifactUpdateSlots(const ArtifactLocation & al)
if(al.isHolder(curHero))
{
if(al.slot >= GameConstants::BACKPACK_START)
{
updateBackpackSlots();
}
else
updateWornSlots();
}
@@ -843,7 +841,7 @@ void CArtifactsOfHero::updateWornSlots(bool redrawParent)
void CArtifactsOfHero::updateBackpackSlots(bool redrawParent)
{
for(auto & artPlace : backpack)
for(auto * artPlace : backpack)
updateSlot(artPlace->slotID);
scrollBackpack(0);

View File

@@ -876,12 +876,12 @@ std::vector<const CArtifact *> CArtifactInstance::assemblyPossibilities(const CA
if(artType->constituents) //combined artifact already: no combining of combined artifacts... for now.
return ret;
for(auto artifact : artType->constituentOf)
for(const auto * artifact : artType->constituentOf)
{
assert(artifact->constituents);
bool possible = true;
for(auto constituent : *artifact->constituents) //check if all constituents are available
for(const auto * constituent : *artifact->constituents) //check if all constituents are available
{
if (equipped)
{
@@ -1229,9 +1229,9 @@ std::vector<ArtifactPosition> CArtifactSet::getBackpackArtPositions(int aid) con
si32 backpackPosition = GameConstants::BACKPACK_START;
for(auto & artInfo : artifactsInBackpack)
{
auto art = artInfo.getArt();
auto * art = artInfo.getArt();
if (art && art->artType->id == aid)
result.push_back(ArtifactPosition(backpackPosition));
result.emplace_back(backpackPosition);
backpackPosition++;
}
return result;

View File

@@ -1196,8 +1196,7 @@ DLL_LINKAGE void AssembledArtifact::applyGs(CGameState *gs)
}
else
{
if(al.slot > pos)
al.slot = pos;
al.slot = std::min(al.slot, pos)
}
}