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:
@@ -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,9 +1491,9 @@ 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);
|
||||||
|
@@ -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);
|
||||||
|
Reference in New Issue
Block a user