Browse Source

Fixes for guard condition

Tomasz Zieliński 1 year ago
parent
commit
5315beec8c
3 changed files with 8 additions and 7 deletions
  1. 4 4
      lib/rmg/RmgObject.cpp
  2. 3 3
      lib/rmg/RmgObject.h
  3. 1 0
      lib/rmg/modificators/TreasurePlacer.cpp

+ 4 - 4
lib/rmg/RmgObject.cpp

@@ -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;
 }

+ 3 - 3
lib/rmg/RmgObject.h

@@ -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;
 };
 }
 

+ 1 - 0
lib/rmg/modificators/TreasurePlacer.cpp

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