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:
@@ -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);
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user