mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
suggested changes
This commit is contained in:
parent
11a109f3af
commit
fd9c7352a0
@ -236,11 +236,11 @@ void CHeroArtPlace::addCombinedArtInfo(std::map<const CArtifact*, int> & arts)
|
|||||||
text += "{" + combinedArt.first->getNameTranslated() + "}";
|
text += "{" + combinedArt.first->getNameTranslated() + "}";
|
||||||
if(arts.size() == 1)
|
if(arts.size() == 1)
|
||||||
{
|
{
|
||||||
for(const auto part : *combinedArt.first->constituents)
|
for(const auto part : combinedArt.first->getConstituents())
|
||||||
artList += "\n" + part->getNameTranslated();
|
artList += "\n" + part->getNameTranslated();
|
||||||
}
|
}
|
||||||
text += " (" + boost::str(boost::format("%d") % combinedArt.second) + " / " +
|
text += " (" + boost::str(boost::format("%d") % combinedArt.second) + " / " +
|
||||||
boost::str(boost::format("%d") % combinedArt.first->constituents->size()) + ")" + artList;
|
boost::str(boost::format("%d") % combinedArt.first->getConstituents().size()) + ")" + artList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ bool ArtifactUtilsClient::askToDisassemble(const CGHeroInstance * hero, const Ar
|
|||||||
|
|
||||||
if(art->isCombined())
|
if(art->isCombined())
|
||||||
{
|
{
|
||||||
if(ArtifactUtils::isSlotBackpack(slot) && !ArtifactUtils::isBackpackFreeSlots(hero, art->artType->constituents->size() - 1))
|
if(ArtifactUtils::isSlotBackpack(slot) && !ArtifactUtils::isBackpackFreeSlots(hero, art->artType->getConstituents().size() - 1))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
LOCPLINT->showArtifactAssemblyDialog(
|
LOCPLINT->showArtifactAssemblyDialog(
|
||||||
|
@ -98,7 +98,7 @@ void CArtifactsOfHeroAltar::deleteFromVisible(const CArtifactInstance * artInst)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(const auto & part : artInst->partsInfo)
|
for(const auto & part : artInst->getPartsInfo())
|
||||||
{
|
{
|
||||||
if(part.slot != ArtifactPosition::PRE_FIRST)
|
if(part.slot != ArtifactPosition::PRE_FIRST)
|
||||||
getArtPlace(part.slot)->setArtifact(nullptr);
|
getArtPlace(part.slot)->setArtifact(nullptr);
|
||||||
|
@ -261,10 +261,10 @@ void CArtifactsOfHeroBase::setSlotData(ArtPlacePtr artPlace, const ArtifactPosit
|
|||||||
{
|
{
|
||||||
// If the artifact is part of at least one combined artifact, add additional information
|
// If the artifact is part of at least one combined artifact, add additional information
|
||||||
std::map<const CArtifact*, int> arts;
|
std::map<const CArtifact*, int> arts;
|
||||||
for(const auto combinedArt : slotInfo->artifact->artType->partOf)
|
for(const auto combinedArt : slotInfo->artifact->artType->getPartOf())
|
||||||
{
|
{
|
||||||
arts.insert(std::pair(combinedArt, 0));
|
arts.insert(std::pair(combinedArt, 0));
|
||||||
for(const auto part : *combinedArt->constituents)
|
for(const auto part : combinedArt->getConstituents())
|
||||||
if(artSet.hasArt(part->getId(), true))
|
if(artSet.hasArt(part->getId(), true))
|
||||||
arts.at(combinedArt)++;
|
arts.at(combinedArt)++;
|
||||||
}
|
}
|
||||||
|
@ -123,12 +123,12 @@ DLL_LINKAGE std::vector<const CArtifact*> ArtifactUtils::assemblyPossibilities(
|
|||||||
if(art->isCombined())
|
if(art->isCombined())
|
||||||
return arts;
|
return arts;
|
||||||
|
|
||||||
for(const auto artifact : art->partOf)
|
for(const auto artifact : art->getPartOf())
|
||||||
{
|
{
|
||||||
assert(artifact->constituents);
|
assert(artifact->constituents);
|
||||||
bool possible = true;
|
bool possible = true;
|
||||||
|
|
||||||
for(const auto constituent : *artifact->constituents) //check if all constituents are available
|
for(const auto constituent : artifact->getConstituents()) //check if all constituents are available
|
||||||
{
|
{
|
||||||
if(equipped)
|
if(equipped)
|
||||||
{
|
{
|
||||||
@ -172,8 +172,8 @@ DLL_LINKAGE CArtifactInstance * ArtifactUtils::createNewArtifactInstance(CArtifa
|
|||||||
if(art->isCombined())
|
if(art->isCombined())
|
||||||
{
|
{
|
||||||
assert(art->constituents);
|
assert(art->constituents);
|
||||||
for(const auto & part : *art->constituents)
|
for(const auto & part : art->getConstituents())
|
||||||
artInst->addArtInstAsPart(ArtifactUtils::createNewArtifactInstance(part), ArtifactPosition::PRE_FIRST);
|
artInst->addPart(ArtifactUtils::createNewArtifactInstance(part), ArtifactPosition::PRE_FIRST);
|
||||||
}
|
}
|
||||||
if(art->isGrowing())
|
if(art->isGrowing())
|
||||||
{
|
{
|
||||||
@ -211,7 +211,7 @@ DLL_LINKAGE CArtifactInstance * ArtifactUtils::createArtifact(CMap * map, const
|
|||||||
map->addNewArtifactInstance(art);
|
map->addNewArtifactInstance(art);
|
||||||
if(art->artType && art->isCombined())
|
if(art->artType && art->isCombined())
|
||||||
{
|
{
|
||||||
for(auto & part : art->partsInfo)
|
for(auto & part : art->getPartsInfo())
|
||||||
{
|
{
|
||||||
map->addNewArtifactInstance(part.art);
|
map->addNewArtifactInstance(part.art);
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,27 @@ VCMI_LIB_NAMESPACE_BEGIN
|
|||||||
|
|
||||||
bool CCombinedArtifact::isCombined() const
|
bool CCombinedArtifact::isCombined() const
|
||||||
{
|
{
|
||||||
return !(constituents == nullptr);
|
return !(constituents.empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<CArtifact*> & CCombinedArtifact::getConstituents()
|
||||||
|
{
|
||||||
|
return constituents;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::vector<CArtifact*> & CCombinedArtifact::getConstituents() const
|
||||||
|
{
|
||||||
|
return constituents;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<CArtifact*> & CCombinedArtifact::getPartOf()
|
||||||
|
{
|
||||||
|
return partOf;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::vector<CArtifact*> & CCombinedArtifact::getPartOf() const
|
||||||
|
{
|
||||||
|
return partOf;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CScrollArtifact::isScroll() const
|
bool CScrollArtifact::isScroll() const
|
||||||
@ -61,6 +81,26 @@ bool CGrowingArtifact::isGrowing() const
|
|||||||
return !bonusesPerLevel.empty() || !thresholdBonuses.empty();
|
return !bonusesPerLevel.empty() || !thresholdBonuses.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector <std::pair<ui16, Bonus>> & CGrowingArtifact::getBonusesPerLevel()
|
||||||
|
{
|
||||||
|
return bonusesPerLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::vector <std::pair<ui16, Bonus>> & CGrowingArtifact::getBonusesPerLevel() const
|
||||||
|
{
|
||||||
|
return bonusesPerLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector <std::pair<ui16, Bonus>> & CGrowingArtifact::getThresholdBonuses()
|
||||||
|
{
|
||||||
|
return thresholdBonuses;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::vector <std::pair<ui16, Bonus>> & CGrowingArtifact::getThresholdBonuses() const
|
||||||
|
{
|
||||||
|
return thresholdBonuses;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t CArtifact::getIndex() const
|
int32_t CArtifact::getIndex() const
|
||||||
{
|
{
|
||||||
return id.toEnum();
|
return id.toEnum();
|
||||||
@ -180,7 +220,7 @@ bool CArtifact::canBePutAt(const CArtifactSet * artSet, ArtifactPosition slot, b
|
|||||||
if(assumeDestRemoved)
|
if(assumeDestRemoved)
|
||||||
fittingSet.removeArtifact(slot);
|
fittingSet.removeArtifact(slot);
|
||||||
assert(constituents);
|
assert(constituents);
|
||||||
for(const auto art : *constituents)
|
for(const auto art : constituents)
|
||||||
{
|
{
|
||||||
auto possibleSlot = ArtifactUtils::getArtAnyPosition(&fittingSet, art->getId());
|
auto possibleSlot = ArtifactUtils::getArtAnyPosition(&fittingSet, art->getId());
|
||||||
if(ArtifactUtils::isSlotEquipment(possibleSlot))
|
if(ArtifactUtils::isSlotEquipment(possibleSlot))
|
||||||
@ -557,14 +597,13 @@ void CArtHandler::loadComponents(CArtifact * art, const JsonNode & node)
|
|||||||
{
|
{
|
||||||
if (!node["components"].isNull())
|
if (!node["components"].isNull())
|
||||||
{
|
{
|
||||||
art->constituents = std::make_unique<std::vector<CArtifact *>>();
|
|
||||||
for(const auto & component : node["components"].Vector())
|
for(const auto & component : node["components"].Vector())
|
||||||
{
|
{
|
||||||
VLC->modh->identifiers.requestIdentifier("artifact", component, [=](si32 id)
|
VLC->modh->identifiers.requestIdentifier("artifact", component, [=](si32 id)
|
||||||
{
|
{
|
||||||
// when this code is called both combinational art as well as component are loaded
|
// when this code is called both combinational art as well as component are loaded
|
||||||
// so it is safe to access any of them
|
// so it is safe to access any of them
|
||||||
art->constituents->push_back(objects[id]);
|
art->constituents.push_back(objects[id]);
|
||||||
objects[id]->partOf.push_back(art);
|
objects[id]->partOf.push_back(art);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -655,7 +694,7 @@ bool CArtHandler::legalArtifact(const ArtifactID & id)
|
|||||||
auto art = objects[id];
|
auto art = objects[id];
|
||||||
//assert ( (!art->constituents) || art->constituents->size() ); //artifacts is not combined or has some components
|
//assert ( (!art->constituents) || art->constituents->size() ); //artifacts is not combined or has some components
|
||||||
|
|
||||||
if(art->constituents)
|
if(art->isCombined())
|
||||||
return false; //no combo artifacts spawning
|
return false; //no combo artifacts spawning
|
||||||
|
|
||||||
if(art->aClass < CArtifact::ART_TREASURE || art->aClass > CArtifact::ART_RELIC)
|
if(art->aClass < CArtifact::ART_TREASURE || art->aClass > CArtifact::ART_RELIC)
|
||||||
@ -894,7 +933,7 @@ void CArtifactSet::putArtifact(ArtifactPosition slot, CArtifactInstance * art)
|
|||||||
if(art->artType->isCombined() && ArtifactUtils::isSlotEquipment(slot))
|
if(art->artType->isCombined() && ArtifactUtils::isSlotEquipment(slot))
|
||||||
{
|
{
|
||||||
const CArtifactInstance * mainPart = nullptr;
|
const CArtifactInstance * mainPart = nullptr;
|
||||||
for(const auto & part : art->partsInfo)
|
for(const auto & part : art->getPartsInfo())
|
||||||
if(vstd::contains(part.art->artType->possibleSlots.at(bearerType()), slot)
|
if(vstd::contains(part.art->artType->possibleSlots.at(bearerType()), slot)
|
||||||
&& (part.slot == ArtifactPosition::PRE_FIRST))
|
&& (part.slot == ArtifactPosition::PRE_FIRST))
|
||||||
{
|
{
|
||||||
@ -902,7 +941,7 @@ void CArtifactSet::putArtifact(ArtifactPosition slot, CArtifactInstance * art)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto & part : art->partsInfo)
|
for(auto & part : art->getPartsInfo())
|
||||||
{
|
{
|
||||||
if(part.art != mainPart)
|
if(part.art != mainPart)
|
||||||
{
|
{
|
||||||
@ -923,7 +962,7 @@ void CArtifactSet::removeArtifact(ArtifactPosition slot)
|
|||||||
{
|
{
|
||||||
if(art->isCombined())
|
if(art->isCombined())
|
||||||
{
|
{
|
||||||
for(auto & part : art->partsInfo)
|
for(auto & part : art->getPartsInfo())
|
||||||
{
|
{
|
||||||
if(getArt(part.slot, false))
|
if(getArt(part.slot, false))
|
||||||
eraseArtSlot(part.slot);
|
eraseArtSlot(part.slot);
|
||||||
@ -940,7 +979,7 @@ std::pair<const CArtifactInstance *, const CArtifactInstance *> CArtifactSet::se
|
|||||||
auto art = slot.artifact;
|
auto art = slot.artifact;
|
||||||
if(art->isCombined())
|
if(art->isCombined())
|
||||||
{
|
{
|
||||||
for(auto& ci : art->partsInfo)
|
for(auto & ci : art->getPartsInfo())
|
||||||
{
|
{
|
||||||
if(ci.art->getTypeId() == aid)
|
if(ci.art->getTypeId() == aid)
|
||||||
{
|
{
|
||||||
|
@ -46,11 +46,15 @@ class DLL_LINKAGE CCombinedArtifact
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
CCombinedArtifact() = default;
|
CCombinedArtifact() = default;
|
||||||
public:
|
|
||||||
std::unique_ptr<std::vector<CArtifact*>> constituents; // Artifacts IDs a combined artifact consists of, or nullptr.
|
|
||||||
std::vector<CArtifact*> partOf; // Reverse map of constituents - combined arts that include this art
|
|
||||||
|
|
||||||
|
std::vector<CArtifact*> constituents; // Artifacts IDs a combined artifact consists of, or nullptr.
|
||||||
|
std::vector<CArtifact*> partOf; // Reverse map of constituents - combined arts that include this art
|
||||||
|
public:
|
||||||
bool isCombined() const;
|
bool isCombined() const;
|
||||||
|
std::vector<CArtifact*> & getConstituents();
|
||||||
|
const std::vector<CArtifact*> & getConstituents() const;
|
||||||
|
std::vector<CArtifact*> & getPartOf();
|
||||||
|
const std::vector<CArtifact*> & getPartOf() const;
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler & h, const int version)
|
template <typename Handler> void serialize(Handler & h, const int version)
|
||||||
{
|
{
|
||||||
@ -71,12 +75,17 @@ class DLL_LINKAGE CGrowingArtifact
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
CGrowingArtifact() = default;
|
CGrowingArtifact() = default;
|
||||||
public:
|
|
||||||
std::vector <std::pair<ui16, Bonus>> bonusesPerLevel; // Bonus given each n levels
|
std::vector <std::pair<ui16, Bonus>> bonusesPerLevel; // Bonus given each n levels
|
||||||
std::vector <std::pair<ui16, Bonus>> thresholdBonuses; // After certain level they will be added once
|
std::vector <std::pair<ui16, Bonus>> thresholdBonuses; // After certain level they will be added once
|
||||||
|
public:
|
||||||
bool isGrowing() const;
|
bool isGrowing() const;
|
||||||
|
|
||||||
|
std::vector <std::pair<ui16, Bonus>> & getBonusesPerLevel();
|
||||||
|
const std::vector <std::pair<ui16, Bonus>> & getBonusesPerLevel() const;
|
||||||
|
std::vector <std::pair<ui16, Bonus>> & getThresholdBonuses();
|
||||||
|
const std::vector <std::pair<ui16, Bonus>> & getThresholdBonuses() const;
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler & h, const int version)
|
template <typename Handler> void serialize(Handler & h, const int version)
|
||||||
{
|
{
|
||||||
h & bonusesPerLevel;
|
h & bonusesPerLevel;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
void CCombinedArtifactInstance::addArtInstAsPart(CArtifactInstance * art, const ArtifactPosition & slot)
|
void CCombinedArtifactInstance::addPart(CArtifactInstance * art, const ArtifactPosition & slot)
|
||||||
{
|
{
|
||||||
auto artInst = static_cast<CArtifactInstance*>(this);
|
auto artInst = static_cast<CArtifactInstance*>(this);
|
||||||
assert(vstd::contains_if(*artInst->artType->constituents,
|
assert(vstd::contains_if(*artInst->artType->constituents,
|
||||||
@ -44,6 +44,16 @@ bool CCombinedArtifactInstance::isPart(const CArtifactInstance * supposedPart) c
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<CCombinedArtifactInstance::PartInfo> & CCombinedArtifactInstance::getPartsInfo()
|
||||||
|
{
|
||||||
|
return partsInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::vector<CCombinedArtifactInstance::PartInfo> & CCombinedArtifactInstance::getPartsInfo() const
|
||||||
|
{
|
||||||
|
return partsInfo;
|
||||||
|
}
|
||||||
|
|
||||||
SpellID CScrollArtifactInstance::getScrollSpellID() const
|
SpellID CScrollArtifactInstance::getScrollSpellID() const
|
||||||
{
|
{
|
||||||
auto artInst = static_cast<const CArtifactInstance*>(this);
|
auto artInst = static_cast<const CArtifactInstance*>(this);
|
||||||
@ -69,7 +79,7 @@ void CGrowingArtifactInstance::growingUp()
|
|||||||
bonus->duration = BonusDuration::COMMANDER_KILLED;
|
bonus->duration = BonusDuration::COMMANDER_KILLED;
|
||||||
artInst->accumulateBonus(bonus);
|
artInst->accumulateBonus(bonus);
|
||||||
|
|
||||||
for(const auto & bonus : artInst->artType->bonusesPerLevel)
|
for(const auto & bonus : artInst->artType->getBonusesPerLevel())
|
||||||
{
|
{
|
||||||
// Every n levels
|
// Every n levels
|
||||||
if(artInst->valOfBonuses(BonusType::LEVEL_COUNTER) % bonus.first == 0)
|
if(artInst->valOfBonuses(BonusType::LEVEL_COUNTER) % bonus.first == 0)
|
||||||
@ -77,7 +87,7 @@ void CGrowingArtifactInstance::growingUp()
|
|||||||
artInst->accumulateBonus(std::make_shared<Bonus>(bonus.second));
|
artInst->accumulateBonus(std::make_shared<Bonus>(bonus.second));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(const auto & bonus : artInst->artType->thresholdBonuses)
|
for(const auto & bonus : artInst->artType->getThresholdBonuses())
|
||||||
{
|
{
|
||||||
// At n level
|
// At n level
|
||||||
if(artInst->valOfBonuses(BonusType::LEVEL_COUNTER) == bonus.first)
|
if(artInst->valOfBonuses(BonusType::LEVEL_COUNTER) == bonus.first)
|
||||||
|
@ -33,15 +33,18 @@ public:
|
|||||||
PartInfo(CArtifactInstance * art = nullptr, const ArtifactPosition & slot = ArtifactPosition::PRE_FIRST)
|
PartInfo(CArtifactInstance * art = nullptr, const ArtifactPosition & slot = ArtifactPosition::PRE_FIRST)
|
||||||
: art(art), slot(slot) {};
|
: art(art), slot(slot) {};
|
||||||
};
|
};
|
||||||
std::vector<PartInfo> partsInfo;
|
void addPart(CArtifactInstance * art, const ArtifactPosition & slot);
|
||||||
void addArtInstAsPart(CArtifactInstance * art, const ArtifactPosition & slot);
|
|
||||||
// Checks if supposed part inst is part of this combined art inst
|
// Checks if supposed part inst is part of this combined art inst
|
||||||
bool isPart(const CArtifactInstance * supposedPart) const;
|
bool isPart(const CArtifactInstance * supposedPart) const;
|
||||||
|
std::vector<PartInfo> & getPartsInfo();
|
||||||
|
const std::vector<PartInfo> & getPartsInfo() const;
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler & h, const int version)
|
template <typename Handler> void serialize(Handler & h, const int version)
|
||||||
{
|
{
|
||||||
h & partsInfo;
|
h & partsInfo;
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
std::vector<PartInfo> partsInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DLL_LINKAGE CScrollArtifactInstance
|
class DLL_LINKAGE CScrollArtifactInstance
|
||||||
|
@ -1530,9 +1530,9 @@ void NewArtifact::applyGs(CGameState *gs)
|
|||||||
art->setType(art->artType);
|
art->setType(art->artType);
|
||||||
if(art->isCombined())
|
if(art->isCombined())
|
||||||
{
|
{
|
||||||
assert(art->artType->constituents);
|
assert(art->artType->getConstituents());
|
||||||
for(const auto & part : *art->artType->constituents)
|
for(const auto & part : art->artType->getConstituents())
|
||||||
art->addArtInstAsPart(ArtifactUtils::createNewArtifactInstance(part), ArtifactPosition::PRE_FIRST);
|
art->addPart(ArtifactUtils::createNewArtifactInstance(part), ArtifactPosition::PRE_FIRST);
|
||||||
}
|
}
|
||||||
gs->map->addNewArtifactInstance(art);
|
gs->map->addNewArtifactInstance(art);
|
||||||
}
|
}
|
||||||
@ -1938,7 +1938,7 @@ void AssembledArtifact::applyGs(CGameState *gs)
|
|||||||
auto * combinedArt = new CArtifactInstance(builtArt);
|
auto * combinedArt = new CArtifactInstance(builtArt);
|
||||||
gs->map->addNewArtifactInstance(combinedArt);
|
gs->map->addNewArtifactInstance(combinedArt);
|
||||||
// Retrieve all constituents
|
// Retrieve all constituents
|
||||||
for(const CArtifact * constituent : *builtArt->constituents)
|
for(const CArtifact * constituent : builtArt->getConstituents())
|
||||||
{
|
{
|
||||||
ArtifactPosition pos = combineEquipped ? artSet->getArtPos(constituent->getId(), true, false) :
|
ArtifactPosition pos = combineEquipped ? artSet->getArtPos(constituent->getId(), true, false) :
|
||||||
artSet->getArtBackpackPos(constituent->getId());
|
artSet->getArtBackpackPos(constituent->getId());
|
||||||
@ -1960,7 +1960,7 @@ void AssembledArtifact::applyGs(CGameState *gs)
|
|||||||
al.slot = std::min(al.slot, pos);
|
al.slot = std::min(al.slot, pos);
|
||||||
pos = ArtifactPosition::PRE_FIRST;
|
pos = ArtifactPosition::PRE_FIRST;
|
||||||
}
|
}
|
||||||
combinedArt->addArtInstAsPart(constituentInstance, pos);
|
combinedArt->addPart(constituentInstance, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
//put new combined artifacts
|
//put new combined artifacts
|
||||||
@ -1972,7 +1972,7 @@ void DisassembledArtifact::applyGs(CGameState *gs)
|
|||||||
auto * disassembled = al.getArt();
|
auto * disassembled = al.getArt();
|
||||||
assert(disassembled);
|
assert(disassembled);
|
||||||
|
|
||||||
auto parts = disassembled->partsInfo;
|
auto parts = disassembled->getPartsInfo();
|
||||||
disassembled->removeFrom(al);
|
disassembled->removeFrom(al);
|
||||||
for(auto & part : parts)
|
for(auto & part : parts)
|
||||||
{
|
{
|
||||||
|
@ -153,7 +153,7 @@ bool CQuest::checkQuest(const CGHeroInstance * h) const
|
|||||||
if(h->getArtPosCount(elem.first, false, true, true) < elem.second)
|
if(h->getArtPosCount(elem.first, false, true, true) < elem.second)
|
||||||
return false;
|
return false;
|
||||||
if(!h->hasArt(elem.first))
|
if(!h->hasArt(elem.first))
|
||||||
reqSlots += h->getAssemblyByConstituent(elem.first)->partsInfo.size() - 2;
|
reqSlots += h->getAssemblyByConstituent(elem.first)->getPartsInfo().size() - 2;
|
||||||
}
|
}
|
||||||
if(ArtifactUtils::isBackpackFreeSlots(h, reqSlots))
|
if(ArtifactUtils::isBackpackFreeSlots(h, reqSlots))
|
||||||
return true;
|
return true;
|
||||||
@ -804,7 +804,7 @@ void CGSeerHut::finishQuest(const CGHeroInstance * h, ui32 accept) const
|
|||||||
{
|
{
|
||||||
const auto * assembly = h->getAssemblyByConstituent(elem);
|
const auto * assembly = h->getAssemblyByConstituent(elem);
|
||||||
assert(assembly);
|
assert(assembly);
|
||||||
auto parts = assembly->partsInfo;
|
auto parts = assembly->getPartsInfo();
|
||||||
|
|
||||||
// Remove the assembly
|
// Remove the assembly
|
||||||
cb->removeArtifact(ArtifactLocation(h, h->getArtPos(assembly)));
|
cb->removeArtifact(ArtifactLocation(h, h->getArtPos(assembly)));
|
||||||
|
@ -746,7 +746,7 @@ void CMapLoaderH3M::readAllowedArtifacts()
|
|||||||
if(!features.levelSOD)
|
if(!features.levelSOD)
|
||||||
{
|
{
|
||||||
for(CArtifact * artifact : VLC->arth->objects)
|
for(CArtifact * artifact : VLC->arth->objects)
|
||||||
if(artifact->constituents)
|
if(artifact->isCombined())
|
||||||
map->allowedArtifact[artifact->getId()] = false;
|
map->allowedArtifact[artifact->getId()] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ void CMapGenerator::initQuestArtsRemaining()
|
|||||||
for (auto art : VLC->arth->objects)
|
for (auto art : VLC->arth->objects)
|
||||||
{
|
{
|
||||||
//Don't use parts of combined artifacts
|
//Don't use parts of combined artifacts
|
||||||
if (art->aClass == CArtifact::ART_TREASURE && VLC->arth->legalArtifact(art->getId()) && art->partOf.empty())
|
if (art->aClass == CArtifact::ART_TREASURE && VLC->arth->legalArtifact(art->getId()) && art->getPartOf().empty())
|
||||||
questArtifacts.push_back(art->getId());
|
questArtifacts.push_back(art->getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4084,7 +4084,7 @@ bool CGameHandler::assembleArtifacts (ObjectInstanceID heroID, ArtifactPosition
|
|||||||
if(assemble)
|
if(assemble)
|
||||||
{
|
{
|
||||||
CArtifact * combinedArt = VLC->arth->objects[assembleTo];
|
CArtifact * combinedArt = VLC->arth->objects[assembleTo];
|
||||||
if(!combinedArt->constituents)
|
if(!combinedArt->isCombined())
|
||||||
COMPLAIN_RET("assembleArtifacts: Artifact being attempted to assemble is not a combined artifacts!");
|
COMPLAIN_RET("assembleArtifacts: Artifact being attempted to assemble is not a combined artifacts!");
|
||||||
if (!vstd::contains(ArtifactUtils::assemblyPossibilities(hero, destArtifact->getTypeId(),
|
if (!vstd::contains(ArtifactUtils::assemblyPossibilities(hero, destArtifact->getTypeId(),
|
||||||
ArtifactUtils::isSlotEquipment(artifactSlot)), combinedArt))
|
ArtifactUtils::isSlotEquipment(artifactSlot)), combinedArt))
|
||||||
@ -4107,7 +4107,7 @@ bool CGameHandler::assembleArtifacts (ObjectInstanceID heroID, ArtifactPosition
|
|||||||
COMPLAIN_RET("assembleArtifacts: Artifact being attempted to disassemble is not a combined artifact!");
|
COMPLAIN_RET("assembleArtifacts: Artifact being attempted to disassemble is not a combined artifact!");
|
||||||
|
|
||||||
if(ArtifactUtils::isSlotBackpack(artifactSlot)
|
if(ArtifactUtils::isSlotBackpack(artifactSlot)
|
||||||
&& !ArtifactUtils::isBackpackFreeSlots(hero, destArtifact->artType->constituents->size() - 1))
|
&& !ArtifactUtils::isBackpackFreeSlots(hero, destArtifact->artType->getConstituents().size() - 1))
|
||||||
COMPLAIN_RET("assembleArtifacts: Artifact being attempted to disassemble but backpack is full!");
|
COMPLAIN_RET("assembleArtifacts: Artifact being attempted to disassemble but backpack is full!");
|
||||||
|
|
||||||
DisassembledArtifact da;
|
DisassembledArtifact da;
|
||||||
|
Loading…
Reference in New Issue
Block a user