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

Apply suggested changes next part

This commit is contained in:
SoundSSGood 2022-11-10 23:24:41 +02:00
parent 6e5932c016
commit 9647758812
3 changed files with 6 additions and 15 deletions

View File

@ -181,16 +181,9 @@ bool CCallback::assembleArtifacts (const CGHeroInstance * hero, ArtifactPosition
return true;
}
bool CCallback::bulkMoveArtifacts(ObjectInstanceID srcHero, ObjectInstanceID dstHero)
bool CCallback::bulkMoveArtifacts(ObjectInstanceID srcHero, ObjectInstanceID dstHero, bool swap)
{
BulkExchangeArtifacts bma(srcHero, dstHero, false);
sendRequest(&bma);
return true;
}
bool CCallback::bulkSwapArtifacts(ObjectInstanceID leftHero, ObjectInstanceID rightHero)
{
BulkExchangeArtifacts bma(leftHero, rightHero, true);
BulkExchangeArtifacts bma(srcHero, dstHero, swap);
sendRequest(&bma);
return true;
}

View File

@ -97,8 +97,7 @@ public:
// Moves all artifacts from one hero to another
virtual bool bulkMoveArtifacts(ObjectInstanceID srcHero, ObjectInstanceID dstHero) = 0;
virtual bool bulkSwapArtifacts(ObjectInstanceID leftHero, ObjectInstanceID rightHero) = 0;
virtual bool bulkMoveArtifacts(ObjectInstanceID srcHero, ObjectInstanceID dstHero, bool swap) = 0;
};
class CBattleCallback : public IBattleCallback, public CPlayerBattleCallback
@ -156,8 +155,7 @@ public:
bool dismissHero(const CGHeroInstance * hero) override;
bool swapArtifacts(const ArtifactLocation &l1, const ArtifactLocation &l2) override;
bool assembleArtifacts(const CGHeroInstance * hero, ArtifactPosition artifactSlot, bool assemble, ArtifactID assembleTo) override;
bool bulkMoveArtifacts(ObjectInstanceID srcHero, ObjectInstanceID dstHero) override;
bool bulkSwapArtifacts(ObjectInstanceID leftHero, ObjectInstanceID rightHero) override;
bool bulkMoveArtifacts(ObjectInstanceID srcHero, ObjectInstanceID dstHero, bool swap) override;
bool buildBuilding(const CGTownInstance *town, BuildingID buildingID) override;
void recruitCreatures(const CGDwelling * obj, const CArmedInstance * dst, CreatureID ID, ui32 amount, si32 level=-1) override;
bool dismissCreature(const CArmedInstance *obj, SlotID stackPos) override;

View File

@ -890,7 +890,7 @@ std::function<void()> CExchangeController::onSwapArtifacts()
{
GsThread::run([=]
{
cb->bulkSwapArtifacts(left->id, right->id);
cb->bulkMoveArtifacts(left->id, right->id, true);
});
};
}
@ -1047,7 +1047,7 @@ void CExchangeController::moveArtifacts(bool leftToRight)
GsThread::run([=]
{
cb->bulkMoveArtifacts(source->id, target->id);
cb->bulkMoveArtifacts(source->id, target->id, false);
});
}