mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Nullkiller: fix crash and freeze
This commit is contained in:
parent
80df879489
commit
7e88819105
@ -175,6 +175,11 @@ std::vector<CGPathNode *> AINodeStorage::getInitialNodes()
|
||||
getOrCreateNode(actor->initialPosition, actor->layer, actor)
|
||||
.get();
|
||||
|
||||
if(!initialNode)
|
||||
continue;
|
||||
|
||||
initialNode->inPQ = false;
|
||||
initialNode->pq = nullptr;
|
||||
initialNode->turns = actor->initialTurn;
|
||||
initialNode->moveRemains = actor->initialMovement;
|
||||
initialNode->danger = 0;
|
||||
@ -254,7 +259,7 @@ void AINodeStorage::commit(
|
||||
"Commited %s -> %s, cost: %f, turn: %s, mp: %d, hero: %s, mask: %x, army: %lld",
|
||||
source->coord.toString(),
|
||||
destination->coord.toString(),
|
||||
destination->cost,
|
||||
destination->getCost(),
|
||||
std::to_string(destination->turns),
|
||||
destination->moveRemains,
|
||||
destination->actor->toString(),
|
||||
@ -599,8 +604,8 @@ void AINodeStorage::addHeroChain(const std::vector<ExchangeCandidate> & result)
|
||||
logAi->trace(
|
||||
"Exchange at %s is is not effective enough. %f < %f",
|
||||
exchangeNode->coord.toString(),
|
||||
exchangeNode->cost,
|
||||
chainInfo.cost);
|
||||
exchangeNode->getCost(),
|
||||
chainInfo.getCost());
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
@ -629,7 +634,7 @@ void AINodeStorage::addHeroChain(const std::vector<ExchangeCandidate> & result)
|
||||
other->actor->toString(),
|
||||
exchangeNode->actor->toString(),
|
||||
exchangeNode->actor->chainMask,
|
||||
exchangeNode->cost,
|
||||
exchangeNode->getCost(),
|
||||
std::to_string(exchangeNode->turns),
|
||||
exchangeNode->moveRemains,
|
||||
exchangeNode->actor->armyValue);
|
||||
|
@ -45,6 +45,14 @@ namespace AIPathfinding
|
||||
return;
|
||||
}
|
||||
|
||||
#if PATHFINDER_TRACE_LEVEL >= 2
|
||||
logAi->trace(
|
||||
"Movement from tile %s is blocked. Try to bypass. Action: %d, blocker: %d",
|
||||
destination.coord.toString(),
|
||||
(int)destination.action,
|
||||
(int)blocker);
|
||||
#endif
|
||||
|
||||
auto destGuardians = cb->getGuardingCreatures(destination.coord);
|
||||
bool allowBypass = false;
|
||||
|
||||
@ -56,7 +64,15 @@ namespace AIPathfinding
|
||||
break;
|
||||
|
||||
case BlockingReason::DESTINATION_BLOCKVIS:
|
||||
if(destination.nodeHero && destination.heroRelations != PlayerRelations::ENEMIES)
|
||||
{
|
||||
allowBypass = destination.heroRelations == PlayerRelations::SAME_PLAYER
|
||||
&& destination.nodeHero == nodeStorage->getHero(destination.node);
|
||||
}
|
||||
else
|
||||
{
|
||||
allowBypass = destination.nodeObject && bypassRemovableObject(source, destination, pathfinderConfig, pathfinderHelper);
|
||||
}
|
||||
|
||||
if(allowBypass && destGuardians.size())
|
||||
allowBypass = bypassDestinationGuards(destGuardians, source, destination, pathfinderConfig, pathfinderHelper);
|
||||
|
@ -744,10 +744,11 @@ void VCAI::makeTurn()
|
||||
}
|
||||
}
|
||||
|
||||
cb->sendMessage("vcmieagles");
|
||||
|
||||
if(cb->getDate(Date::DAY) == 1)
|
||||
{
|
||||
retrieveVisitableObjs();
|
||||
cb->sendMessage("vcmieagles");
|
||||
}
|
||||
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user