1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Working fir for Corpse issue:

- Do not place guard next to blockVis object, if possible
- Do not place two blockVis objects next to each other
This commit is contained in:
Tomasz Zieliński
2023-12-06 20:49:28 +01:00
parent 03fa75c51e
commit 6cd19b81dd
11 changed files with 149 additions and 28 deletions

View File

@ -33,7 +33,8 @@ CGObjectInstance::CGObjectInstance():
ID(Obj::NO_OBJ),
subID(-1),
tempOwner(PlayerColor::UNFLAGGABLE),
blockVisit(false)
blockVisit(false),
removable(false)
{
}
@ -173,12 +174,7 @@ void CGObjectInstance::pickRandomObject(CRandomGenerator & rand)
void CGObjectInstance::initObj(CRandomGenerator & rand)
{
switch(ID.toEnum())
{
case Obj::TAVERN:
blockVisit = true;
break;
}
// no-op
}
void CGObjectInstance::setProperty( ObjProperty what, ObjPropertyID identifier )
@ -191,6 +187,7 @@ void CGObjectInstance::setProperty( ObjProperty what, ObjPropertyID identifier )
tempOwner = identifier.as<PlayerColor>();
break;
case ObjProperty::BLOCKVIS:
// Never actually used in code, but possible in ERM
blockVisit = identifier.getNum();
break;
case ObjProperty::ID:
@ -327,9 +324,16 @@ bool CGObjectInstance::isVisitable() const
bool CGObjectInstance::isBlockedVisitable() const
{
// TODO: Read from json
return blockVisit;
}
bool CGObjectInstance::isRemovable() const
{
// TODO: Read from json
return removable;
}
bool CGObjectInstance::isCoastVisitable() const
{
return false;