1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

arts altar - arts holder

This commit is contained in:
SoundSSGood
2024-01-12 23:57:19 +02:00
parent 4d0c0f10a9
commit 652f009181
15 changed files with 104 additions and 101 deletions

View File

@@ -181,7 +181,7 @@ bool CArtifact::canBePutAt(const CArtifactSet * artSet, ArtifactPosition slot, b
{
auto simpleArtCanBePutAt = [this](const CArtifactSet * artSet, ArtifactPosition slot, bool assumeDestRemoved) -> bool
{
if(ArtifactUtils::isSlotBackpack(slot))
if(artSet->bearerType() == ArtBearer::HERO && ArtifactUtils::isSlotBackpack(slot))
{
if(isBig() || (!assumeDestRemoved && !ArtifactUtils::isBackpackFreeSlots(artSet)))
return false;
@@ -258,6 +258,7 @@ CArtifact::CArtifact()
possibleSlots[ArtBearer::HERO]; //we want to generate map entry even if it will be empty
possibleSlots[ArtBearer::CREATURE]; //we want to generate map entry even if it will be empty
possibleSlots[ArtBearer::COMMANDER];
possibleSlots[ArtBearer::ALTAR].push_back(ArtifactPosition::ALTAR);
}
//This destructor should be placed here to avoid side effects
@@ -906,6 +907,9 @@ const ArtSlotInfo * CArtifactSet::getSlot(const ArtifactPosition & pos) const
bool CArtifactSet::isPositionFree(const ArtifactPosition & pos, bool onlyLockCheck) const
{
if(bearerType() == ArtBearer::ALTAR)
return artifactsInBackpack.size() < 22;
if(const ArtSlotInfo *s = getSlot(pos))
return (onlyLockCheck || !s->artifact) && !s->locked;