1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +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;

View File

@@ -54,6 +54,7 @@ public:
int3 getSightCenter() const;
/// If true hero can visit this object only from neighbouring tiles and can't stand on this object
bool blockVisit;
bool removable;
PlayerColor getOwner() const override
{
@@ -85,6 +86,9 @@ public:
/// If true hero can visit this object only from neighbouring tiles and can't stand on this object
virtual bool isBlockedVisitable() const;
// If true, can be possibly removed from the map
virtual bool isRemovable() const;
/// If true this object can be visited by hero standing on the coast
virtual bool isCoastVisitable() const;
@@ -144,6 +148,7 @@ public:
h & id;
h & tempOwner;
h & blockVisit;
h & removable;
h & appearance;
//definfo is handled by map serializer
}