1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-17 00:07:41 +02:00

Minor cleanup of hero movemen code

This commit is contained in:
Ivan Savenko
2023-09-08 18:02:36 +03:00
parent 347ce01dbe
commit 80b80a0ae6
7 changed files with 81 additions and 33 deletions

View File

@ -64,15 +64,18 @@ void CGObjectInstance::setOwner(const PlayerColor & ow)
{
tempOwner = ow;
}
int CGObjectInstance::getWidth() const//returns width of object graphic in tiles
int CGObjectInstance::getWidth() const
{
return appearance->getWidth();
}
int CGObjectInstance::getHeight() const //returns height of object graphic in tiles
int CGObjectInstance::getHeight() const
{
return appearance->getHeight();
}
bool CGObjectInstance::visitableAt(int x, int y) const //returns true if object is visitable at location (x, y) form left top tile of image (x, y in tiles)
bool CGObjectInstance::visitableAt(int x, int y) const
{
return appearance->isVisitableAt(pos.x - x, pos.y - y);
}
@ -86,6 +89,20 @@ bool CGObjectInstance::coveringAt(int x, int y) const
return appearance->isVisibleAt(pos.x - x, pos.y - y);
}
bool CGObjectInstance::visitableAt(const int3 & testPos) const
{
return pos.z == testPos.z && appearance->isVisitableAt(pos.x - testPos.x, pos.y - testPos.y);
}
bool CGObjectInstance::blockingAt(const int3 & testPos) const
{
return pos.z == testPos.z && appearance->isBlockedAt(pos.x - testPos.x, pos.y - testPos.y);
}
bool CGObjectInstance::coveringAt(const int3 & testPos) const
{
return pos.z == testPos.z && appearance->isVisibleAt(pos.x - testPos.x, pos.y - testPos.y);
}
std::set<int3> CGObjectInstance::getBlockedPos() const
{
std::set<int3> ret;