mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-15 00:05:02 +02:00
Allow guards not stronger than 1/3 max value next to roads
This commit is contained in:
@ -175,19 +175,22 @@ const CGObjectInstance & Object::Instance::object() const
|
||||
}
|
||||
|
||||
Object::Object(CGObjectInstance & object, const int3 & position):
|
||||
guarded(false)
|
||||
guarded(false),
|
||||
value(0)
|
||||
{
|
||||
addInstance(object, position);
|
||||
}
|
||||
|
||||
Object::Object(CGObjectInstance & object):
|
||||
guarded(false)
|
||||
guarded(false),
|
||||
value(0)
|
||||
{
|
||||
addInstance(object);
|
||||
}
|
||||
|
||||
Object::Object(const Object & object):
|
||||
guarded(false)
|
||||
guarded(false),
|
||||
value(0)
|
||||
{
|
||||
for(const auto & i : object.dInstances)
|
||||
addInstance(const_cast<CGObjectInstance &>(i.object()), i.getPosition());
|
||||
@ -425,7 +428,7 @@ int3 rmg::Object::getGuardPos() const
|
||||
{
|
||||
if (instance.object().ID == Obj::MONSTER)
|
||||
{
|
||||
return instance.object().pos;
|
||||
return instance.getPosition(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -435,6 +438,16 @@ int3 rmg::Object::getGuardPos() const
|
||||
}
|
||||
}
|
||||
|
||||
void rmg::Object::setValue(size_t newValue)
|
||||
{
|
||||
value = newValue;
|
||||
}
|
||||
|
||||
size_t rmg::Object::getValue() const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
void Object::Instance::finalize(RmgMap & map, CRandomGenerator & rng)
|
||||
{
|
||||
if(!map.isOnMap(getPosition(true)))
|
||||
|
Reference in New Issue
Block a user