From ab7ad4741a4807c3e766f8cf301bc7a57580be19 Mon Sep 17 00:00:00 2001 From: ArseniyShestakov Date: Sun, 8 Mar 2015 17:23:56 +0300 Subject: [PATCH] AIStatus: add teleport channel probing mode When AI going through bidirectional teleport it's always getting list of all available exits. If some of exits are invisible it's will attempt to visit each of them teleport probing begins. --- AI/VCAI/VCAI.cpp | 13 +++++++++++++ AI/VCAI/VCAI.h | 3 +++ 2 files changed, 16 insertions(+) diff --git a/AI/VCAI/VCAI.cpp b/AI/VCAI/VCAI.cpp index 4148bb96a..9d8042f20 100644 --- a/AI/VCAI/VCAI.cpp +++ b/AI/VCAI/VCAI.cpp @@ -2524,6 +2524,7 @@ AIStatus::AIStatus() battle = NO_BATTLE; havingTurn = false; ongoingHeroMovement = false; + ongoingChannelProbing = false; } AIStatus::~AIStatus() @@ -2656,6 +2657,18 @@ void AIStatus::setMove(bool ongoing) cv.notify_all(); } +void AIStatus::setChannelProbing(bool ongoing) +{ + boost::unique_lock lock(mx); + ongoingHeroMovement = ongoing; + cv.notify_all(); +} + +bool AIStatus::channelProbing() +{ + return ongoingChannelProbing; +} + SectorMap::SectorMap() { update(); diff --git a/AI/VCAI/VCAI.h b/AI/VCAI/VCAI.h index 5b13f8334..e353cdb85 100644 --- a/AI/VCAI/VCAI.h +++ b/AI/VCAI/VCAI.h @@ -41,6 +41,7 @@ class AIStatus std::map requestToQueryID; //IDs of answer-requests sent to server => query ids (so we can match answer confirmation from server to the query) std::vector objectsBeingVisited; bool ongoingHeroMovement; + bool ongoingChannelProbing; // true if AI currently explore bidirectional teleport channel exits bool havingTurn; @@ -49,6 +50,8 @@ public: ~AIStatus(); void setBattle(BattleState BS); void setMove(bool ongoing); + void setChannelProbing(bool ongoing); + bool channelProbing(); BattleState getBattle(); void addQuery(QueryID ID, std::string description); void removeQuery(QueryID ID);