1
0
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:
SoundSSGood
2022-11-10 17:45:54 +02:00
committed by GitHub
parent f2afd9e831
commit b9087e2d63
3 changed files with 10 additions and 16 deletions

View File

@@ -3988,7 +3988,7 @@ bool CGameHandler::bulkSwapArtifacts(ObjectInstanceID leftHero, ObjectInstanceID
auto & slotsRightLeft = ma.artsPack1;
auto moveArtsWorn = [this](const CGHeroInstance * srcHero, const CGHeroInstance * dstHero,
std::vector<BulkMoveArtifacts::LinkedSlots> * slots) -> void
std::vector<BulkMoveArtifacts::LinkedSlots> & slots) -> void
{
for (auto & artifact : srcHero->artifactsWorn)
{
@@ -3996,7 +3996,7 @@ bool CGameHandler::bulkSwapArtifacts(ObjectInstanceID leftHero, ObjectInstanceID
continue;
if (!ArtifactUtils::isArtRemovable(artifact))
continue;
slots->push_back(BulkMoveArtifacts::LinkedSlots(artifact.first, artifact.first));
slots.push_back(BulkMoveArtifacts::LinkedSlots(artifact.first, artifact.first));
if (ArtifactUtils::checkSpellbookIsNeeded(dstHero, artifact.second.getArt()->artType->id, artifact.first))
giveHeroNewArtifact(dstHero, VLC->arth->objects[ArtifactID::SPELLBOOK], ArtifactPosition::SPELLBOOK);
@@ -4010,13 +4010,13 @@ bool CGameHandler::bulkSwapArtifacts(ObjectInstanceID leftHero, ObjectInstanceID
for (auto & slotInfo : pleftHero->artifactsInBackpack)
{
auto slot = pleftHero->getArtPos(slotInfo.artifact);
slotsLeftRight->push_back(BulkMoveArtifacts::LinkedSlots(slot, slot));
slotsLeftRight.push_back(BulkMoveArtifacts::LinkedSlots(slot, slot));
}
// Move over artifacts that are in backpack rightHero -> leftHero
for (auto & slotInfo : prightHero->artifactsInBackpack)
{
auto slot = prightHero->getArtPos(slotInfo.artifact);
slotsRightLeft->push_back(BulkMoveArtifacts::LinkedSlots(slot, slot));
slotsRightLeft.push_back(BulkMoveArtifacts::LinkedSlots(slot, slot));
}
sendAndApply(&ma);
return true;