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

Fixes for guard condition

This commit is contained in:
Tomasz Zieliński 2024-05-01 11:34:34 +02:00
parent acab1d38cf
commit 5315beec8c
3 changed files with 8 additions and 7 deletions

View File

@ -189,8 +189,8 @@ Object::Object(CGObjectInstance & object):
}
Object::Object(const Object & object):
guarded(false),
value(0)
guarded(object.guarded),
value(object.value)
{
for(const auto & i : object.dInstances)
addInstance(const_cast<CGObjectInstance &>(i.object()), i.getPosition());
@ -435,12 +435,12 @@ int3 rmg::Object::getGuardPos() const
return int3(-1,-1,-1);
}
void rmg::Object::setValue(size_t newValue)
void rmg::Object::setValue(uint32_t newValue)
{
value = newValue;
}
size_t rmg::Object::getValue() const
uint32_t rmg::Object::getValue() const
{
return value;
}

View File

@ -89,8 +89,8 @@ public:
bool isGuarded() const;
int3 getGuardPos() const;
void setGuardedIfMonster(const Instance & object);
void setValue(size_t value);
size_t getValue() const;
void setValue(uint32_t value);
uint32_t getValue() const;
void finalize(RmgMap & map, CRandomGenerator &);
void clearCachedArea() const;
@ -109,7 +109,7 @@ private:
mutable std::list<Object::Instance*> cachedInstanceList;
mutable std::list<const Object::Instance*> cachedInstanceConstList;
bool guarded;
size_t value;
uint32_t value;
};
}

View File

@ -670,6 +670,7 @@ rmg::Object TreasurePlacer::constructTreasurePile(const std::vector<ObjectInfo*>
if(rmgObject.instances().empty())
{
rmgObject.setValue(0);
accessibleArea.add(int3());
}