1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Do not show visitable for current hero

This commit is contained in:
krs 2023-03-08 22:43:52 +02:00
parent 010c548dc1
commit 1f06a62219
4 changed files with 21 additions and 1 deletions

View File

@ -52,6 +52,9 @@ public:
/// returns true if specified tile is visible in current context
virtual bool isVisible(const int3 & coordinates) const = 0;
/// returns true if specified object is the currently active hero
virtual bool isActiveHero(const CGObjectInstance* obj) const = 0;
virtual size_t objectGroupIndex(ObjectInstanceID objectID) const = 0;
virtual Point objectImageOffset(ObjectInstanceID objectID, const int3 & coordinates) const = 0;

View File

@ -601,7 +601,7 @@ void MapRendererDebug::renderTile(IMapRendererContext & context, Canvas & target
{
const auto * object = context.getObject(objectID);
if (context.objectTransparency(objectID, coordinates) > 0)
if(context.objectTransparency(objectID, coordinates) > 0 && !context.isActiveHero(object))
{
visitable |= object->visitableAt(coordinates.x, coordinates.y);
blocking |= object->blockingAt(coordinates.x, coordinates.y);

View File

@ -68,6 +68,21 @@ bool MapRendererBaseContext::isVisible(const int3 & coordinates) const
return LOCPLINT->cb->isVisible(coordinates);
}
bool MapRendererBaseContext::isActiveHero(const CGObjectInstance * obj) const
{
if(obj->ID == Obj::HERO)
{
assert(dynamic_cast<const CGHeroInstance *>(obj) != nullptr);
if(adventureInt->curHero() != nullptr)
{
if(obj->id == adventureInt->curHero()->id)
return true;
}
}
return false;
}
bool MapRendererBaseContext::tileAnimated(const int3 & coordinates) const
{
return false;

View File

@ -35,6 +35,8 @@ public:
bool isVisible(const int3 & coordinates) const override;
bool tileAnimated(const int3 & coordinates) const override;
bool isActiveHero(const CGObjectInstance* obj) const override;
const TerrainTile & getMapTile(const int3 & coordinates) const override;
const MapObjectsList & getObjects(const int3 & coordinates) const override;
const CGObjectInstance * getObject(ObjectInstanceID objectID) const override;