mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Code style. Typo. Code clean up.
This commit is contained in:
@@ -286,7 +286,7 @@ void MoveArtifact::applyCl(CClient *cl)
|
|||||||
void BulkMoveArtifacts::applyCl(CClient * cl)
|
void BulkMoveArtifacts::applyCl(CClient * cl)
|
||||||
{
|
{
|
||||||
auto & movingArts = artsPack0;
|
auto & movingArts = artsPack0;
|
||||||
for (auto & slotToMove : movingArts)
|
for(auto & slotToMove : movingArts)
|
||||||
{
|
{
|
||||||
auto srcLoc = ArtifactLocation(srcArtHolder, slotToMove.srcPos);
|
auto srcLoc = ArtifactLocation(srcArtHolder, slotToMove.srcPos);
|
||||||
auto dstLoc = ArtifactLocation(dstArtHolder, slotToMove.dstPos);
|
auto dstLoc = ArtifactLocation(dstArtHolder, slotToMove.dstPos);
|
||||||
@@ -295,15 +295,15 @@ void BulkMoveArtifacts::applyCl(CClient * cl)
|
|||||||
callInterfaceIfPresent(cl, dstLoc.owningPlayer(), &IGameEventsReceiver::artifactMoved, srcLoc, dstLoc);
|
callInterfaceIfPresent(cl, dstLoc.owningPlayer(), &IGameEventsReceiver::artifactMoved, srcLoc, dstLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (swap)
|
if(swap)
|
||||||
{
|
{
|
||||||
movingArts = artsPack1;
|
movingArts = artsPack1;
|
||||||
for (auto & slotToMove : movingArts)
|
for(auto & slotToMove : movingArts)
|
||||||
{
|
{
|
||||||
auto srcLoc = ArtifactLocation(srcArtHolder, slotToMove.srcPos);
|
auto srcLoc = ArtifactLocation(srcArtHolder, slotToMove.srcPos);
|
||||||
auto dstLoc = ArtifactLocation(dstArtHolder, slotToMove.dstPos);
|
auto dstLoc = ArtifactLocation(dstArtHolder, slotToMove.dstPos);
|
||||||
callInterfaceIfPresent(cl, srcLoc.owningPlayer(), &IGameEventsReceiver::artifactMoved, srcLoc, dstLoc);
|
callInterfaceIfPresent(cl, srcLoc.owningPlayer(), &IGameEventsReceiver::artifactMoved, srcLoc, dstLoc);
|
||||||
if (srcLoc.owningPlayer() != dstLoc.owningPlayer())
|
if(srcLoc.owningPlayer() != dstLoc.owningPlayer())
|
||||||
callInterfaceIfPresent(cl, dstLoc.owningPlayer(), &IGameEventsReceiver::artifactMoved, srcLoc, dstLoc);
|
callInterfaceIfPresent(cl, dstLoc.owningPlayer(), &IGameEventsReceiver::artifactMoved, srcLoc, dstLoc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -884,33 +884,6 @@ std::vector<CArtifactInstance *> getBackpackArts(const CGHeroInstance * hero)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Puts all composite arts to backpack and returns their previous location
|
|
||||||
std::vector<HeroArtifact> CExchangeController::moveCompositeArtsToBackpack()
|
|
||||||
{
|
|
||||||
std::vector<const CGHeroInstance *> sides = {left, right};
|
|
||||||
std::vector<HeroArtifact> artPositions;
|
|
||||||
|
|
||||||
for(auto hero : sides)
|
|
||||||
{
|
|
||||||
for(int i = ArtifactPosition::HEAD; i < ArtifactPosition::AFTER_LAST; i++)
|
|
||||||
{
|
|
||||||
auto artPosition = ArtifactPosition(i);
|
|
||||||
auto art = hero->getArt(artPosition);
|
|
||||||
|
|
||||||
if(art && art->canBeDisassembled())
|
|
||||||
{
|
|
||||||
cb->swapArtifacts(
|
|
||||||
ArtifactLocation(hero, artPosition),
|
|
||||||
ArtifactLocation(hero, ArtifactPosition(GameConstants::BACKPACK_START)));
|
|
||||||
|
|
||||||
artPositions.push_back(HeroArtifact(hero, art, artPosition));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return artPositions;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::function<void()> CExchangeController::onSwapArtifacts()
|
std::function<void()> CExchangeController::onSwapArtifacts()
|
||||||
{
|
{
|
||||||
return [&]()
|
return [&]()
|
||||||
|
@@ -324,7 +324,6 @@ private:
|
|||||||
void moveArtifacts(bool leftToRight);
|
void moveArtifacts(bool leftToRight);
|
||||||
void moveArtifact(const CGHeroInstance * source, const CGHeroInstance * target, ArtifactPosition srcPosition);
|
void moveArtifact(const CGHeroInstance * source, const CGHeroInstance * target, ArtifactPosition srcPosition);
|
||||||
void moveStack(const CGHeroInstance * source, const CGHeroInstance * target, SlotID sourceSlot);
|
void moveStack(const CGHeroInstance * source, const CGHeroInstance * target, SlotID sourceSlot);
|
||||||
std::vector<HeroArtifact> moveCompositeArtsToBackpack();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CExchangeWindow : public CStatusbarWindow, public CGarrisonHolder, public CWindowWithArtifacts
|
class CExchangeWindow : public CStatusbarWindow, public CGarrisonHolder, public CWindowWithArtifacts
|
||||||
|
@@ -1469,11 +1469,11 @@ void CArtifactFittingSet::setNewArtSlot(ArtifactPosition slot, CArtifactInstance
|
|||||||
asi.locked = locked;
|
asi.locked = locked;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CArtifactFittingSet::putArtifact(ArtifactPosition pos, CArtifactInstance & art)
|
void CArtifactFittingSet::putArtifact(ArtifactPosition pos, CArtifactInstance * art)
|
||||||
{
|
{
|
||||||
if (art->canBeDisassembled() && (pos < ArtifactPosition::AFTER_LAST))
|
if(art && art->canBeDisassembled() && (pos < ArtifactPosition::AFTER_LAST))
|
||||||
{
|
{
|
||||||
for (auto part : dynamic_cast<CCombinedArtifactInstance*>(art)->constituentsInfo)
|
for(auto & part : dynamic_cast<CCombinedArtifactInstance*>(art)->constituentsInfo)
|
||||||
{
|
{
|
||||||
// For the ArtFittingSet is no needed to do figureMainConstituent, just lock slots
|
// For the ArtFittingSet is no needed to do figureMainConstituent, just lock slots
|
||||||
this->setNewArtSlot(part.art->firstAvailableSlot(this), part.art, true);
|
this->setNewArtSlot(part.art->firstAvailableSlot(this), part.art, true);
|
||||||
@@ -1491,14 +1491,14 @@ ArtBearer::ArtBearer CArtifactFittingSet::bearerType() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
DLL_LINKAGE ArtifactPosition ArtifactUtils::getArtifactDstPosition(const CArtifactInstance * artifact,
|
DLL_LINKAGE ArtifactPosition ArtifactUtils::getArtifactDstPosition(const CArtifactInstance * artifact,
|
||||||
const CArtifactSet * target, ArtBearer::ArtBearer barer)
|
const CArtifactSet * target, ArtBearer::ArtBearer bearer)
|
||||||
{
|
{
|
||||||
for (auto slot : artifact->artType->possibleSlots.at(barer))
|
for(auto slot : artifact->artType->possibleSlots.at(bearer))
|
||||||
{
|
{
|
||||||
auto existingArtifact = target->getArt(slot);
|
auto existingArtifact = target->getArt(slot);
|
||||||
auto existingArtInfo = target->getSlot(slot);
|
auto existingArtInfo = target->getSlot(slot);
|
||||||
|
|
||||||
if (!existingArtifact
|
if(!existingArtifact
|
||||||
&& (!existingArtInfo || !existingArtInfo->locked)
|
&& (!existingArtInfo || !existingArtInfo->locked)
|
||||||
&& artifact->canBePutAt(target, slot))
|
&& artifact->canBePutAt(target, slot))
|
||||||
{
|
{
|
||||||
@@ -1524,11 +1524,11 @@ DLL_LINKAGE bool ArtifactUtils::checkSpellbookIsNeeded(const CGHeroInstance * he
|
|||||||
{
|
{
|
||||||
// TODO what'll happen if Titan's thunder is equipped by pickin git up or the start of game?
|
// TODO what'll happen if Titan's thunder is equipped by pickin git up or the start of game?
|
||||||
// Titan's Thunder creates new spellbook on equip
|
// Titan's Thunder creates new spellbook on equip
|
||||||
if (artID == ArtifactID::TITANS_THUNDER && slot == ArtifactPosition::RIGHT_HAND)
|
if(artID == ArtifactID::TITANS_THUNDER && slot == ArtifactPosition::RIGHT_HAND)
|
||||||
{
|
{
|
||||||
if (heroPtr)
|
if(heroPtr)
|
||||||
{
|
{
|
||||||
if (heroPtr && !heroPtr->hasSpellbook())
|
if(heroPtr && !heroPtr->hasSpellbook())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -381,7 +381,7 @@ namespace ArtifactUtils
|
|||||||
{
|
{
|
||||||
// Calculates where an artifact gets placed when it gets transferred from one hero to another.
|
// Calculates where an artifact gets placed when it gets transferred from one hero to another.
|
||||||
DLL_LINKAGE ArtifactPosition getArtifactDstPosition(const CArtifactInstance * artifact, const CArtifactSet * target,
|
DLL_LINKAGE ArtifactPosition getArtifactDstPosition(const CArtifactInstance * artifact, const CArtifactSet * target,
|
||||||
ArtBearer::ArtBearer barer);
|
ArtBearer::ArtBearer bearer);
|
||||||
DLL_LINKAGE std::vector<ArtifactPosition> unmovablePositions(); // TODO: Make this constexpr when the toolset is upgraded
|
DLL_LINKAGE std::vector<ArtifactPosition> unmovablePositions(); // TODO: Make this constexpr when the toolset is upgraded
|
||||||
DLL_LINKAGE bool isArtRemovable(const std::pair<ArtifactPosition, ArtSlotInfo> & slot);
|
DLL_LINKAGE bool isArtRemovable(const std::pair<ArtifactPosition, ArtSlotInfo> & slot);
|
||||||
DLL_LINKAGE bool checkSpellbookIsNeeded(const CGHeroInstance * heroPtr, ArtifactID artID, ArtifactPosition slot);
|
DLL_LINKAGE bool checkSpellbookIsNeeded(const CGHeroInstance * heroPtr, ArtifactID artID, ArtifactPosition slot);
|
||||||
|
@@ -846,7 +846,7 @@ DLL_LINKAGE CBonusSystemNode *ArtifactLocation::getHolderNode()
|
|||||||
DLL_LINKAGE const CArtifactInstance *ArtifactLocation::getArt() const
|
DLL_LINKAGE const CArtifactInstance *ArtifactLocation::getArt() const
|
||||||
{
|
{
|
||||||
auto s = getSlot();
|
auto s = getSlot();
|
||||||
if (s)
|
if(s)
|
||||||
return s->getArt();
|
return s->getArt();
|
||||||
else
|
else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -1098,7 +1098,7 @@ DLL_LINKAGE void MoveArtifact::applyGs(CGameState * gs)
|
|||||||
DLL_LINKAGE void BulkMoveArtifacts::applyGs(CGameState * gs)
|
DLL_LINKAGE void BulkMoveArtifacts::applyGs(CGameState * gs)
|
||||||
{
|
{
|
||||||
int numBackpackArtifactsMoved = 0;
|
int numBackpackArtifactsMoved = 0;
|
||||||
if (swap)
|
if(swap)
|
||||||
{
|
{
|
||||||
// Swap
|
// Swap
|
||||||
auto leftSet = getSrcHolderArtSet();
|
auto leftSet = getSrcHolderArtSet();
|
||||||
@@ -1107,17 +1107,17 @@ DLL_LINKAGE void BulkMoveArtifacts::applyGs(CGameState * gs)
|
|||||||
std::vector<std::pair<ArtifactPosition, ArtSlotInfo>> unmovableArtsLeftHero, unmovableArtsRightHero;
|
std::vector<std::pair<ArtifactPosition, ArtSlotInfo>> unmovableArtsLeftHero, unmovableArtsRightHero;
|
||||||
|
|
||||||
// Keep unmovable artifacts separately until the swap
|
// Keep unmovable artifacts separately until the swap
|
||||||
for (auto artPos : ArtifactUtils::unmovablePositions())
|
for(auto artPos : ArtifactUtils::unmovablePositions())
|
||||||
{
|
{
|
||||||
auto slotInfo = leftSet->getSlot(artPos);
|
auto slotInfo = leftSet->getSlot(artPos);
|
||||||
if (slotInfo)
|
if(slotInfo)
|
||||||
{
|
{
|
||||||
unmovableArtsLeftHero.push_back(std::make_pair(artPos, *slotInfo));
|
unmovableArtsLeftHero.push_back(std::make_pair(artPos, *slotInfo));
|
||||||
leftSet->eraseArtSlot(artPos);
|
leftSet->eraseArtSlot(artPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
slotInfo = rightSet->getSlot(artPos);
|
slotInfo = rightSet->getSlot(artPos);
|
||||||
if (slotInfo)
|
if(slotInfo)
|
||||||
{
|
{
|
||||||
unmovableArtsRightHero.push_back(std::make_pair(artPos, *slotInfo));
|
unmovableArtsRightHero.push_back(std::make_pair(artPos, *slotInfo));
|
||||||
rightSet->eraseArtSlot(artPos);
|
rightSet->eraseArtSlot(artPos);
|
||||||
@@ -1132,11 +1132,11 @@ DLL_LINKAGE void BulkMoveArtifacts::applyGs(CGameState * gs)
|
|||||||
leftSet->artifactsInBackpack = ArtFittingSet.artifactsInBackpack;
|
leftSet->artifactsInBackpack = ArtFittingSet.artifactsInBackpack;
|
||||||
|
|
||||||
// Return non movable artifacts to their place after the swap
|
// Return non movable artifacts to their place after the swap
|
||||||
for (auto & art : unmovableArtsLeftHero)
|
for(auto & art : unmovableArtsLeftHero)
|
||||||
{
|
{
|
||||||
leftSet->putArtifact(art.first, art.second.artifact);
|
leftSet->putArtifact(art.first, art.second.artifact);
|
||||||
}
|
}
|
||||||
for (auto & art : unmovableArtsRightHero)
|
for(auto & art : unmovableArtsRightHero)
|
||||||
{
|
{
|
||||||
rightSet->putArtifact(art.first, art.second.artifact);
|
rightSet->putArtifact(art.first, art.second.artifact);
|
||||||
}
|
}
|
||||||
@@ -1144,12 +1144,12 @@ DLL_LINKAGE void BulkMoveArtifacts::applyGs(CGameState * gs)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Move
|
// Move
|
||||||
for (auto & slot : artsPack0)
|
for(auto & slot : artsPack0)
|
||||||
{
|
{
|
||||||
// When an object gets removed from the backpack, the backpack shrinks
|
// When an object gets removed from the backpack, the backpack shrinks
|
||||||
// so all the following indices will be affected. Thus, we need to update
|
// so all the following indices will be affected. Thus, we need to update
|
||||||
// the subsequent artifact slots to account for that
|
// the subsequent artifact slots to account for that
|
||||||
if (slot.srcPos >= GameConstants::BACKPACK_START)
|
if(slot.srcPos >= GameConstants::BACKPACK_START)
|
||||||
{
|
{
|
||||||
slot.srcPos = ArtifactPosition(slot.srcPos.num - numBackpackArtifactsMoved);
|
slot.srcPos = ArtifactPosition(slot.srcPos.num - numBackpackArtifactsMoved);
|
||||||
}
|
}
|
||||||
@@ -1160,7 +1160,7 @@ DLL_LINKAGE void BulkMoveArtifacts::applyGs(CGameState * gs)
|
|||||||
const_cast<CArtifactInstance*>(art)->move(
|
const_cast<CArtifactInstance*>(art)->move(
|
||||||
ArtifactLocation(srcArtHolder, slot.srcPos), ArtifactLocation(dstArtHolder, slot.dstPos));
|
ArtifactLocation(srcArtHolder, slot.srcPos), ArtifactLocation(dstArtHolder, slot.dstPos));
|
||||||
|
|
||||||
if (slot.srcPos >= GameConstants::BACKPACK_START)
|
if(slot.srcPos >= GameConstants::BACKPACK_START)
|
||||||
{
|
{
|
||||||
numBackpackArtifactsMoved++;
|
numBackpackArtifactsMoved++;
|
||||||
}
|
}
|
||||||
|
@@ -3943,9 +3943,9 @@ bool CGameHandler::bulkMoveArtifacts(ObjectInstanceID srcHero, ObjectInstanceID
|
|||||||
ArtFittingSet.artifactsWorn = pdstHero->artifactsWorn;
|
ArtFittingSet.artifactsWorn = pdstHero->artifactsWorn;
|
||||||
|
|
||||||
// Move over artifacts that are worn
|
// Move over artifacts that are worn
|
||||||
for (auto & artInfo : psrcHero->artifactsWorn)
|
for(auto & artInfo : psrcHero->artifactsWorn)
|
||||||
{
|
{
|
||||||
if (ArtifactUtils::isArtRemovable(artInfo))
|
if(ArtifactUtils::isArtRemovable(artInfo))
|
||||||
{
|
{
|
||||||
auto artifact = psrcHero->getArt(artInfo.first);
|
auto artifact = psrcHero->getArt(artInfo.first);
|
||||||
auto dstSlot = ArtifactUtils::getArtifactDstPosition(artifact, &ArtFittingSet, pdstHero->bearerType());
|
auto dstSlot = ArtifactUtils::getArtifactDstPosition(artifact, &ArtFittingSet, pdstHero->bearerType());
|
||||||
@@ -3953,19 +3953,19 @@ bool CGameHandler::bulkMoveArtifacts(ObjectInstanceID srcHero, ObjectInstanceID
|
|||||||
static_cast<ConstTransitivePtr<CArtifactInstance>>(psrcHero->getArt(artInfo.first)));
|
static_cast<ConstTransitivePtr<CArtifactInstance>>(psrcHero->getArt(artInfo.first)));
|
||||||
slots->push_back(BulkMoveArtifacts::LinkedSlots(artInfo.first, dstSlot));
|
slots->push_back(BulkMoveArtifacts::LinkedSlots(artInfo.first, dstSlot));
|
||||||
|
|
||||||
if (ArtifactUtils::checkSpellbookIsNeeded(pdstHero, artifact->artType->id, dstSlot))
|
if(ArtifactUtils::checkSpellbookIsNeeded(pdstHero, artifact->artType->id, dstSlot))
|
||||||
giveHeroNewArtifact(pdstHero, VLC->arth->objects[ArtifactID::SPELLBOOK], ArtifactPosition::SPELLBOOK);
|
giveHeroNewArtifact(pdstHero, VLC->arth->objects[ArtifactID::SPELLBOOK], ArtifactPosition::SPELLBOOK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Move over artifacts that are in backpack
|
// Move over artifacts that are in backpack
|
||||||
for (auto & slotInfo : psrcHero->artifactsInBackpack)
|
for(auto & slotInfo : psrcHero->artifactsInBackpack)
|
||||||
{
|
{
|
||||||
auto artifact = psrcHero->getArt(psrcHero->getArtPos(slotInfo.artifact));
|
auto artifact = psrcHero->getArt(psrcHero->getArtPos(slotInfo.artifact));
|
||||||
auto dstSlot = ArtifactUtils::getArtifactDstPosition(artifact, &ArtFittingSet, pdstHero->bearerType());
|
auto dstSlot = ArtifactUtils::getArtifactDstPosition(artifact, &ArtFittingSet, pdstHero->bearerType());
|
||||||
ArtFittingSet.putArtifact(dstSlot, static_cast<ConstTransitivePtr<CArtifactInstance>>(slotInfo.artifact));
|
ArtFittingSet.putArtifact(dstSlot, static_cast<ConstTransitivePtr<CArtifactInstance>>(slotInfo.artifact));
|
||||||
slots->push_back(BulkMoveArtifacts::LinkedSlots(psrcHero->getArtPos(slotInfo.artifact), dstSlot));
|
slots->push_back(BulkMoveArtifacts::LinkedSlots(psrcHero->getArtPos(slotInfo.artifact), dstSlot));
|
||||||
|
|
||||||
if (ArtifactUtils::checkSpellbookIsNeeded(pdstHero, artifact->artType->id, dstSlot))
|
if(ArtifactUtils::checkSpellbookIsNeeded(pdstHero, artifact->artType->id, dstSlot))
|
||||||
giveHeroNewArtifact(pdstHero, VLC->arth->objects[ArtifactID::SPELLBOOK], ArtifactPosition::SPELLBOOK);
|
giveHeroNewArtifact(pdstHero, VLC->arth->objects[ArtifactID::SPELLBOOK], ArtifactPosition::SPELLBOOK);
|
||||||
}
|
}
|
||||||
sendAndApply(&ma);
|
sendAndApply(&ma);
|
||||||
@@ -3975,7 +3975,7 @@ bool CGameHandler::bulkMoveArtifacts(ObjectInstanceID srcHero, ObjectInstanceID
|
|||||||
bool CGameHandler::bulkSwapArtifacts(ObjectInstanceID leftHero, ObjectInstanceID rightHero)
|
bool CGameHandler::bulkSwapArtifacts(ObjectInstanceID leftHero, ObjectInstanceID rightHero)
|
||||||
{
|
{
|
||||||
// Make sure exchange is even possible between the two heroes.
|
// Make sure exchange is even possible between the two heroes.
|
||||||
if (!isAllowedExchange(leftHero, rightHero))
|
if(!isAllowedExchange(leftHero, rightHero))
|
||||||
COMPLAIN_RET("That heroes cannot make any exchange!");
|
COMPLAIN_RET("That heroes cannot make any exchange!");
|
||||||
|
|
||||||
auto pleftHero = getHero(leftHero);
|
auto pleftHero = getHero(leftHero);
|
||||||
@@ -3990,15 +3990,15 @@ bool CGameHandler::bulkSwapArtifacts(ObjectInstanceID leftHero, ObjectInstanceID
|
|||||||
auto moveArtsWorn = [this](const CGHeroInstance * srcHero, const CGHeroInstance * dstHero,
|
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)
|
for(auto & artifact : srcHero->artifactsWorn)
|
||||||
{
|
{
|
||||||
if (artifact.second.locked)
|
if(artifact.second.locked)
|
||||||
continue;
|
continue;
|
||||||
if (!ArtifactUtils::isArtRemovable(artifact))
|
if(!ArtifactUtils::isArtRemovable(artifact))
|
||||||
continue;
|
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))
|
if(ArtifactUtils::checkSpellbookIsNeeded(dstHero, artifact.second.getArt()->artType->id, artifact.first))
|
||||||
giveHeroNewArtifact(dstHero, VLC->arth->objects[ArtifactID::SPELLBOOK], ArtifactPosition::SPELLBOOK);
|
giveHeroNewArtifact(dstHero, VLC->arth->objects[ArtifactID::SPELLBOOK], ArtifactPosition::SPELLBOOK);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -4007,13 +4007,13 @@ bool CGameHandler::bulkSwapArtifacts(ObjectInstanceID leftHero, ObjectInstanceID
|
|||||||
// Move over artifacts that are worn rightHero -> leftHero
|
// Move over artifacts that are worn rightHero -> leftHero
|
||||||
moveArtsWorn(prightHero, pleftHero, slotsRightLeft);
|
moveArtsWorn(prightHero, pleftHero, slotsRightLeft);
|
||||||
// Move over artifacts that are in backpack leftHero -> rightHero
|
// Move over artifacts that are in backpack leftHero -> rightHero
|
||||||
for (auto & slotInfo : pleftHero->artifactsInBackpack)
|
for(auto & slotInfo : pleftHero->artifactsInBackpack)
|
||||||
{
|
{
|
||||||
auto slot = pleftHero->getArtPos(slotInfo.artifact);
|
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
|
// Move over artifacts that are in backpack rightHero -> leftHero
|
||||||
for (auto & slotInfo : prightHero->artifactsInBackpack)
|
for(auto & slotInfo : prightHero->artifactsInBackpack)
|
||||||
{
|
{
|
||||||
auto slot = prightHero->getArtPos(slotInfo.artifact);
|
auto slot = prightHero->getArtPos(slotInfo.artifact);
|
||||||
slotsRightLeft.push_back(BulkMoveArtifacts::LinkedSlots(slot, slot));
|
slotsRightLeft.push_back(BulkMoveArtifacts::LinkedSlots(slot, slot));
|
||||||
@@ -4046,7 +4046,7 @@ bool CGameHandler::assembleArtifacts (ObjectInstanceID heroID, ArtifactPosition
|
|||||||
if (!vstd::contains(destArtifact->assemblyPossibilities(hero), combinedArt))
|
if (!vstd::contains(destArtifact->assemblyPossibilities(hero), combinedArt))
|
||||||
COMPLAIN_RET("assembleArtifacts: It's impossible to assemble requested artifact!");
|
COMPLAIN_RET("assembleArtifacts: It's impossible to assemble requested artifact!");
|
||||||
|
|
||||||
if (ArtifactUtils::checkSpellbookIsNeeded(hero, assembleTo, artifactSlot))
|
if(ArtifactUtils::checkSpellbookIsNeeded(hero, assembleTo, artifactSlot))
|
||||||
giveHeroNewArtifact(hero, VLC->arth->objects[ArtifactID::SPELLBOOK], ArtifactPosition::SPELLBOOK);
|
giveHeroNewArtifact(hero, VLC->arth->objects[ArtifactID::SPELLBOOK], ArtifactPosition::SPELLBOOK);
|
||||||
|
|
||||||
AssembledArtifact aa;
|
AssembledArtifact aa;
|
||||||
|
@@ -371,7 +371,7 @@ bool CGarrisonDialogQuery::blocksPack(const CPack * pack) const
|
|||||||
if(auto dismiss = dynamic_ptr_cast<DisbandCreature>(pack))
|
if(auto dismiss = dynamic_ptr_cast<DisbandCreature>(pack))
|
||||||
return !vstd::contains(ourIds, dismiss->id);
|
return !vstd::contains(ourIds, dismiss->id);
|
||||||
|
|
||||||
if (auto arts = dynamic_ptr_cast<BulkExchangeArtifacts>(pack))
|
if(auto arts = dynamic_ptr_cast<BulkExchangeArtifacts>(pack))
|
||||||
return !vstd::contains(ourIds, arts->srcHero) || !vstd::contains(ourIds, arts->dstHero);
|
return !vstd::contains(ourIds, arts->srcHero) || !vstd::contains(ourIds, arts->dstHero);
|
||||||
|
|
||||||
if(auto dismiss = dynamic_ptr_cast<AssembleArtifacts>(pack))
|
if(auto dismiss = dynamic_ptr_cast<AssembleArtifacts>(pack))
|
||||||
|
@@ -184,7 +184,7 @@ bool BulkExchangeArtifacts::applyGh(CGameHandler * gh)
|
|||||||
{
|
{
|
||||||
const CGHeroInstance * pSrcHero = gh->getHero(srcHero);
|
const CGHeroInstance * pSrcHero = gh->getHero(srcHero);
|
||||||
throwOnWrongPlayer(gh, pSrcHero->getOwner());
|
throwOnWrongPlayer(gh, pSrcHero->getOwner());
|
||||||
if (swap)
|
if(swap)
|
||||||
return gh->bulkSwapArtifacts(srcHero, dstHero);
|
return gh->bulkSwapArtifacts(srcHero, dstHero);
|
||||||
else
|
else
|
||||||
return gh->bulkMoveArtifacts(srcHero, dstHero);
|
return gh->bulkMoveArtifacts(srcHero, dstHero);
|
||||||
|
Reference in New Issue
Block a user