mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +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);
|
auto assemblyPossibilities = art->assemblyPossibilities(hero, assembleEqipped);
|
||||||
|
|
||||||
// If the artifact can be assembled, display dialog.
|
// If the artifact can be assembled, display dialog.
|
||||||
for(auto combination : assemblyPossibilities)
|
for(const auto * combination : assemblyPossibilities)
|
||||||
{
|
{
|
||||||
LOCPLINT->showArtifactAssemblyDialog(
|
LOCPLINT->showArtifactAssemblyDialog(
|
||||||
art->artType,
|
art->artType,
|
||||||
@@ -824,9 +824,7 @@ void CArtifactsOfHero::artifactUpdateSlots(const ArtifactLocation & al)
|
|||||||
if(al.isHolder(curHero))
|
if(al.isHolder(curHero))
|
||||||
{
|
{
|
||||||
if(al.slot >= GameConstants::BACKPACK_START)
|
if(al.slot >= GameConstants::BACKPACK_START)
|
||||||
{
|
|
||||||
updateBackpackSlots();
|
updateBackpackSlots();
|
||||||
}
|
|
||||||
else
|
else
|
||||||
updateWornSlots();
|
updateWornSlots();
|
||||||
}
|
}
|
||||||
@@ -843,7 +841,7 @@ void CArtifactsOfHero::updateWornSlots(bool redrawParent)
|
|||||||
|
|
||||||
void CArtifactsOfHero::updateBackpackSlots(bool redrawParent)
|
void CArtifactsOfHero::updateBackpackSlots(bool redrawParent)
|
||||||
{
|
{
|
||||||
for(auto & artPlace : backpack)
|
for(auto * artPlace : backpack)
|
||||||
updateSlot(artPlace->slotID);
|
updateSlot(artPlace->slotID);
|
||||||
scrollBackpack(0);
|
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.
|
if(artType->constituents) //combined artifact already: no combining of combined artifacts... for now.
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
for(auto artifact : artType->constituentOf)
|
for(const auto * artifact : artType->constituentOf)
|
||||||
{
|
{
|
||||||
assert(artifact->constituents);
|
assert(artifact->constituents);
|
||||||
bool possible = true;
|
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)
|
if (equipped)
|
||||||
{
|
{
|
||||||
@@ -1229,9 +1229,9 @@ std::vector<ArtifactPosition> CArtifactSet::getBackpackArtPositions(int aid) con
|
|||||||
si32 backpackPosition = GameConstants::BACKPACK_START;
|
si32 backpackPosition = GameConstants::BACKPACK_START;
|
||||||
for(auto & artInfo : artifactsInBackpack)
|
for(auto & artInfo : artifactsInBackpack)
|
||||||
{
|
{
|
||||||
auto art = artInfo.getArt();
|
auto * art = artInfo.getArt();
|
||||||
if (art && art->artType->id == aid)
|
if (art && art->artType->id == aid)
|
||||||
result.push_back(ArtifactPosition(backpackPosition));
|
result.emplace_back(backpackPosition);
|
||||||
backpackPosition++;
|
backpackPosition++;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -1196,8 +1196,7 @@ DLL_LINKAGE void AssembledArtifact::applyGs(CGameState *gs)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(al.slot > pos)
|
al.slot = std::min(al.slot, pos)
|
||||||
al.slot = pos;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user