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

some refactoring

This commit is contained in:
SoundSSGood 2023-02-11 13:31:44 +02:00
parent 7314df56ac
commit 2976739c97
2 changed files with 7 additions and 8 deletions

View File

@ -294,9 +294,8 @@ void BulkMoveArtifacts::applyCl(CClient * cl)
{
auto srcLoc = ArtifactLocation(srcArtHolder, slotToMove.srcPos);
auto dstLoc = ArtifactLocation(dstArtHolder, slotToMove.dstPos);
callInterfaceIfPresent(cl, srcLoc.owningPlayer(), &IGameEventsReceiver::artifactMoved, srcLoc, dstLoc);
if(srcLoc.owningPlayer() != dstLoc.owningPlayer())
callInterfaceIfPresent(cl, dstLoc.owningPlayer(), &IGameEventsReceiver::artifactMoved, srcLoc, dstLoc);
MoveArtifact ma(&srcLoc, &dstLoc, false);
ma.applyCl(cl);
}
};

View File

@ -1032,13 +1032,13 @@ bool CCombinedArtifactInstance::canBePutAt(const CArtifactSet * artSet, Artifact
CArtifactFittingSet fittingSet(artSet->bearerType());
fittingSet.artifactsWorn = artSet->artifactsWorn;
auto removedArt = fittingSet.getArt(slot);
if(assumeDestRemoved && removedArt)
auto artToRemove = fittingSet.getArt(slot);
if(assumeDestRemoved && artToRemove)
{
if(removedArt->canBeDisassembled())
if(artToRemove->canBeDisassembled())
{
auto contitutient = dynamic_cast<CCombinedArtifactInstance*>(removedArt);
for(auto & part : contitutient->constituentsInfo)
auto combinedArtToRemove = dynamic_cast<CCombinedArtifactInstance*>(artToRemove);
for(auto & part : combinedArtToRemove->constituentsInfo)
{
if(ArtifactUtils::isSlotEquipment(part.slot))
{