mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
CPathfinder: add border gate support and use passableFor
This commit is contained in:
parent
9f565b81e9
commit
2724a67a27
@ -453,7 +453,7 @@ bool CPathfinder::isMovementAfterDestPossible() const
|
|||||||
/// Transit over whirlpools only allowed when hero protected
|
/// Transit over whirlpools only allowed when hero protected
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(dtObj->ID == Obj::GARRISON || dtObj->ID == Obj::GARRISON2)
|
else if(dtObj->ID == Obj::GARRISON || dtObj->ID == Obj::GARRISON2 || dtObj->ID == Obj::BORDER_GATE)
|
||||||
{
|
{
|
||||||
/// Transit via unguarded garrisons is always possible
|
/// Transit via unguarded garrisons is always possible
|
||||||
return true;
|
return true;
|
||||||
@ -517,18 +517,33 @@ CGPathNode::ENodeAction CPathfinder::getDestAction() const
|
|||||||
else
|
else
|
||||||
action = CGPathNode::BLOCKING_VISIT;
|
action = CGPathNode::BLOCKING_VISIT;
|
||||||
}
|
}
|
||||||
else if(dtObj->ID == Obj::TOWN && objRel == PlayerRelations::ENEMIES)
|
else if(dtObj->ID == Obj::TOWN)
|
||||||
{
|
{
|
||||||
const CGTownInstance * townObj = dynamic_cast<const CGTownInstance *>(dtObj);
|
if(dtObj->passableFor(hero->tempOwner))
|
||||||
if(townObj->armedGarrison())
|
action = CGPathNode::VISIT;
|
||||||
|
else if(objRel == PlayerRelations::ENEMIES)
|
||||||
action = CGPathNode::BATTLE;
|
action = CGPathNode::BATTLE;
|
||||||
}
|
}
|
||||||
else if(dtObj->ID == Obj::GARRISON || dtObj->ID == Obj::GARRISON2)
|
else if(dtObj->ID == Obj::GARRISON || dtObj->ID == Obj::GARRISON2)
|
||||||
{
|
{
|
||||||
const CGGarrison * garrisonObj = dynamic_cast<const CGGarrison *>(dtObj);
|
if(dtObj->passableFor(hero->tempOwner))
|
||||||
if((garrisonObj->stacksCount() && objRel == PlayerRelations::ENEMIES) || isDestinationGuarded(true))
|
{
|
||||||
|
if(isDestinationGuarded(true))
|
||||||
|
action = CGPathNode::BATTLE;
|
||||||
|
}
|
||||||
|
else if(objRel == PlayerRelations::ENEMIES)
|
||||||
action = CGPathNode::BATTLE;
|
action = CGPathNode::BATTLE;
|
||||||
}
|
}
|
||||||
|
else if(dtObj->ID == Obj::BORDER_GATE)
|
||||||
|
{
|
||||||
|
if(dtObj->passableFor(hero->tempOwner))
|
||||||
|
{
|
||||||
|
if(isDestinationGuarded(true))
|
||||||
|
action = CGPathNode::BATTLE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
action = CGPathNode::BLOCKING_VISIT;
|
||||||
|
}
|
||||||
else if(isDestinationGuardian())
|
else if(isDestinationGuardian())
|
||||||
action = CGPathNode::BATTLE;
|
action = CGPathNode::BATTLE;
|
||||||
else if(dtObj->blockVisit && !(options.useCastleGate && dtObj->ID == Obj::TOWN))
|
else if(dtObj->blockVisit && !(options.useCastleGate && dtObj->ID == Obj::TOWN))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user