1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-14 02:33:51 +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): Object::Object(const Object & object):
guarded(false), guarded(object.guarded),
value(0) value(object.value)
{ {
for(const auto & i : object.dInstances) for(const auto & i : object.dInstances)
addInstance(const_cast<CGObjectInstance &>(i.object()), i.getPosition()); addInstance(const_cast<CGObjectInstance &>(i.object()), i.getPosition());
@ -435,12 +435,12 @@ int3 rmg::Object::getGuardPos() const
return int3(-1,-1,-1); return int3(-1,-1,-1);
} }
void rmg::Object::setValue(size_t newValue) void rmg::Object::setValue(uint32_t newValue)
{ {
value = newValue; value = newValue;
} }
size_t rmg::Object::getValue() const uint32_t rmg::Object::getValue() const
{ {
return value; return value;
} }

View File

@ -89,8 +89,8 @@ public:
bool isGuarded() const; bool isGuarded() const;
int3 getGuardPos() const; int3 getGuardPos() const;
void setGuardedIfMonster(const Instance & object); void setGuardedIfMonster(const Instance & object);
void setValue(size_t value); void setValue(uint32_t value);
size_t getValue() const; uint32_t getValue() const;
void finalize(RmgMap & map, CRandomGenerator &); void finalize(RmgMap & map, CRandomGenerator &);
void clearCachedArea() const; void clearCachedArea() const;
@ -109,7 +109,7 @@ private:
mutable std::list<Object::Instance*> cachedInstanceList; mutable std::list<Object::Instance*> cachedInstanceList;
mutable std::list<const Object::Instance*> cachedInstanceConstList; mutable std::list<const Object::Instance*> cachedInstanceConstList;
bool guarded; 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()) if(rmgObject.instances().empty())
{ {
rmgObject.setValue(0);
accessibleArea.add(int3()); accessibleArea.add(int3());
} }