mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-02 00:10:22 +02:00
Merge pull request #542 from nullkiller/ai-stability-fixes
AI: stability fixes
This commit is contained in:
commit
08b841d668
@ -370,6 +370,12 @@ bool isObjectRemovable(const CGObjectInstance * obj)
|
||||
case Obj::TREASURE_CHEST:
|
||||
case Obj::ARTIFACT:
|
||||
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;
|
||||
break;
|
||||
default:
|
||||
|
@ -300,10 +300,9 @@ namespace AIPathfinding
|
||||
if(blocker == BlockingReason::DESTINATION_BLOCKVIS && destination.nodeObject)
|
||||
{
|
||||
auto objID = destination.nodeObject->ID;
|
||||
if((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
|
||||
|| objID == Obj::WHIRLPOOL)
|
||||
auto enemyHero = objID == Obj::HERO && destination.objectRelations == PlayerRelations::ENEMIES;
|
||||
|
||||
if(!enemyHero && !isObjectRemovable(destination.nodeObject))
|
||||
{
|
||||
destination.blocked = true;
|
||||
}
|
||||
|
@ -834,6 +834,8 @@ void VCAI::mainLoop()
|
||||
std::vector<Goals::TSubgoal> elementarGoals; //no duplicates allowed (operator ==)
|
||||
basicGoals.clear();
|
||||
|
||||
validateVisitableObjs();
|
||||
|
||||
//get all potential and saved goals
|
||||
//TODO: not lose
|
||||
basicGoals.push_back(sptr(Goals::Win()));
|
||||
@ -1748,6 +1750,9 @@ std::vector<const CGObjectInstance *> VCAI::getFlaggedObjects() const
|
||||
|
||||
void VCAI::addVisitableObj(const CGObjectInstance * obj)
|
||||
{
|
||||
if(obj->ID == Obj::EVENT)
|
||||
return;
|
||||
|
||||
visitableObjs.insert(obj);
|
||||
|
||||
// All teleport objects seen automatically assigned to appropriate channels
|
||||
|
Loading…
Reference in New Issue
Block a user