|
@@ -92,8 +92,8 @@ void AIGateway::heroMoved(const TryMoveHero & details, bool verbose)
|
|
|
validateObject(details.id); //enemy hero may have left visible area
|
|
|
auto hero = cb->getHero(details.id);
|
|
|
|
|
|
- const int3 from = CGHeroInstance::convertPosition(details.start, false);
|
|
|
- const int3 to = CGHeroInstance::convertPosition(details.end, false);
|
|
|
+ const int3 from = hero->convertPosition(details.start, false);
|
|
|
+ const int3 to = hero->convertPosition(details.end, false);
|
|
|
const CGObjectInstance * o1 = vstd::frontOrNull(cb->getVisitableObjs(from, verbose));
|
|
|
const CGObjectInstance * o2 = vstd::frontOrNull(cb->getVisitableObjs(to, verbose));
|
|
|
|
|
@@ -1178,7 +1178,7 @@ bool AIGateway::moveHeroToTile(int3 dst, HeroPtr h)
|
|
|
{
|
|
|
//FIXME: this assertion fails also if AI moves onto defeated guarded object
|
|
|
assert(cb->getVisitableObjs(dst).size() > 1); //there's no point in revisiting tile where there is no visitable object
|
|
|
- cb->moveHero(*h, CGHeroInstance::convertPosition(dst, true));
|
|
|
+ cb->moveHero(*h, h->convertPosition(dst, true));
|
|
|
afterMovementCheck(); // TODO: is it feasible to hero get killed there if game work properly?
|
|
|
// If revisiting, teleport probing is never done, and so the entries into the list would remain unused and uncleared
|
|
|
teleportChannelProbingList.clear();
|
|
@@ -1232,14 +1232,14 @@ bool AIGateway::moveHeroToTile(int3 dst, HeroPtr h)
|
|
|
|
|
|
auto doMovement = [&](int3 dst, bool transit)
|
|
|
{
|
|
|
- cb->moveHero(*h, CGHeroInstance::convertPosition(dst, true), transit);
|
|
|
+ cb->moveHero(*h, h->convertPosition(dst, true), transit);
|
|
|
};
|
|
|
|
|
|
auto doTeleportMovement = [&](ObjectInstanceID exitId, int3 exitPos)
|
|
|
{
|
|
|
destinationTeleport = exitId;
|
|
|
if(exitPos.valid())
|
|
|
- destinationTeleportPos = CGHeroInstance::convertPosition(exitPos, true);
|
|
|
+ destinationTeleportPos = h->convertPosition(exitPos, true);
|
|
|
cb->moveHero(*h, h->pos);
|
|
|
destinationTeleport = ObjectInstanceID();
|
|
|
destinationTeleportPos = int3(-1);
|
|
@@ -1248,7 +1248,7 @@ bool AIGateway::moveHeroToTile(int3 dst, HeroPtr h)
|
|
|
|
|
|
auto doChannelProbing = [&]() -> void
|
|
|
{
|
|
|
- auto currentPos = CGHeroInstance::convertPosition(h->pos, false);
|
|
|
+ auto currentPos = h->convertPosition(h->pos, false);
|
|
|
auto currentExit = getObj(currentPos, true)->id;
|
|
|
|
|
|
status.setChannelProbing(true);
|
|
@@ -1265,7 +1265,7 @@ bool AIGateway::moveHeroToTile(int3 dst, HeroPtr h)
|
|
|
int3 currentCoord = path.nodes[i].coord;
|
|
|
int3 nextCoord = path.nodes[i - 1].coord;
|
|
|
|
|
|
- auto currentObject = getObj(currentCoord, currentCoord == CGHeroInstance::convertPosition(h->pos, false));
|
|
|
+ auto currentObject = getObj(currentCoord, currentCoord == h->convertPosition(h->pos, false));
|
|
|
auto nextObjectTop = getObj(nextCoord, false);
|
|
|
auto nextObject = getObj(nextCoord, true);
|
|
|
auto destTeleportObj = getDestTeleportObj(currentObject, nextObjectTop, nextObject);
|