mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-29 21:56:54 +02:00
#4139 - attempt to fix crash on portal probbing
This commit is contained in:
parent
cd12b0e514
commit
cd4aaf93ee
@ -1331,17 +1331,32 @@ bool AIGateway::moveHeroToTile(int3 dst, HeroPtr h)
|
|||||||
auto doChannelProbing = [&]() -> void
|
auto doChannelProbing = [&]() -> void
|
||||||
{
|
{
|
||||||
auto currentPos = h->visitablePos();
|
auto currentPos = h->visitablePos();
|
||||||
auto currentExit = getObj(currentPos, true)->id;
|
auto currentTeleport = getObj(currentPos, true);
|
||||||
|
|
||||||
status.setChannelProbing(true);
|
if(currentTeleport)
|
||||||
for(auto exit : teleportChannelProbingList)
|
{
|
||||||
doTeleportMovement(exit, int3(-1));
|
auto currentExit = currentTeleport->id;
|
||||||
teleportChannelProbingList.clear();
|
|
||||||
status.setChannelProbing(false);
|
|
||||||
|
|
||||||
doTeleportMovement(currentExit, currentPos);
|
status.setChannelProbing(true);
|
||||||
|
for(auto exit : teleportChannelProbingList)
|
||||||
|
doTeleportMovement(exit, int3(-1));
|
||||||
|
teleportChannelProbingList.clear();
|
||||||
|
status.setChannelProbing(false);
|
||||||
|
|
||||||
|
doTeleportMovement(currentExit, currentPos);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logAi->debug("Unexpected channel probbing at " + currentPos.toString());
|
||||||
|
|
||||||
|
teleportChannelProbingList.clear();
|
||||||
|
status.setChannelProbing(false);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
teleportChannelProbingList.clear();
|
||||||
|
status.setChannelProbing(false);
|
||||||
|
|
||||||
for(; i > 0; i--)
|
for(; i > 0; i--)
|
||||||
{
|
{
|
||||||
int3 currentCoord = path.nodes[i].coord;
|
int3 currentCoord = path.nodes[i].coord;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user