mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
AI: stability fixes
This commit is contained in:
@@ -370,6 +370,12 @@ bool isObjectRemovable(const CGObjectInstance * obj)
|
|||||||
case Obj::TREASURE_CHEST:
|
case Obj::TREASURE_CHEST:
|
||||||
case Obj::ARTIFACT:
|
case Obj::ARTIFACT:
|
||||||
case Obj::BORDERGUARD:
|
case Obj::BORDERGUARD:
|
||||||
|
case Obj::FLOTSAM:
|
||||||
|
case Obj::PANDORAS_BOX:
|
||||||
|
case Obj::OCEAN_BOTTLE:
|
||||||
|
case Obj::SEA_CHEST:
|
||||||
|
case Obj::SHIPWRECK_SURVIVOR:
|
||||||
|
case Obj::SPELL_SCROLL:
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@@ -300,10 +300,9 @@ namespace AIPathfinding
|
|||||||
if(blocker == BlockingReason::DESTINATION_BLOCKVIS && destination.nodeObject)
|
if(blocker == BlockingReason::DESTINATION_BLOCKVIS && destination.nodeObject)
|
||||||
{
|
{
|
||||||
auto objID = destination.nodeObject->ID;
|
auto objID = destination.nodeObject->ID;
|
||||||
if((objID == Obj::HERO && destination.objectRelations != PlayerRelations::ENEMIES)
|
auto enemyHero = objID == Obj::HERO && destination.objectRelations == PlayerRelations::ENEMIES;
|
||||||
|| objID == Obj::SUBTERRANEAN_GATE || objID == Obj::MONOLITH_TWO_WAY
|
|
||||||
|| objID == Obj::MONOLITH_ONE_WAY_ENTRANCE || objID == Obj::MONOLITH_ONE_WAY_EXIT
|
if(!enemyHero && !isObjectRemovable(destination.nodeObject))
|
||||||
|| objID == Obj::WHIRLPOOL)
|
|
||||||
{
|
{
|
||||||
destination.blocked = true;
|
destination.blocked = true;
|
||||||
}
|
}
|
||||||
|
@@ -834,6 +834,8 @@ void VCAI::mainLoop()
|
|||||||
std::vector<Goals::TSubgoal> elementarGoals; //no duplicates allowed (operator ==)
|
std::vector<Goals::TSubgoal> elementarGoals; //no duplicates allowed (operator ==)
|
||||||
basicGoals.clear();
|
basicGoals.clear();
|
||||||
|
|
||||||
|
validateVisitableObjs();
|
||||||
|
|
||||||
//get all potential and saved goals
|
//get all potential and saved goals
|
||||||
//TODO: not lose
|
//TODO: not lose
|
||||||
basicGoals.push_back(sptr(Goals::Win()));
|
basicGoals.push_back(sptr(Goals::Win()));
|
||||||
@@ -1748,6 +1750,9 @@ std::vector<const CGObjectInstance *> VCAI::getFlaggedObjects() const
|
|||||||
|
|
||||||
void VCAI::addVisitableObj(const CGObjectInstance * obj)
|
void VCAI::addVisitableObj(const CGObjectInstance * obj)
|
||||||
{
|
{
|
||||||
|
if(obj->ID == Obj::EVENT)
|
||||||
|
return;
|
||||||
|
|
||||||
visitableObjs.insert(obj);
|
visitableObjs.insert(obj);
|
||||||
|
|
||||||
// All teleport objects seen automatically assigned to appropriate channels
|
// All teleport objects seen automatically assigned to appropriate channels
|
||||||
|
Reference in New Issue
Block a user