Przeglądaj źródła

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.
ArseniyShestakov 10 lat temu
rodzic
commit
ab7ad4741a
2 zmienionych plików z 16 dodań i 0 usunięć
  1. 13 0
      AI/VCAI/VCAI.cpp
  2. 3 0
      AI/VCAI/VCAI.h

+ 13 - 0
AI/VCAI/VCAI.cpp

@@ -2524,6 +2524,7 @@ AIStatus::AIStatus()
 	battle = NO_BATTLE;
 	battle = NO_BATTLE;
 	havingTurn = false;
 	havingTurn = false;
 	ongoingHeroMovement = false;
 	ongoingHeroMovement = false;
+	ongoingChannelProbing = false;
 }
 }
 
 
 AIStatus::~AIStatus()
 AIStatus::~AIStatus()
@@ -2656,6 +2657,18 @@ void AIStatus::setMove(bool ongoing)
 	cv.notify_all();
 	cv.notify_all();
 }
 }
 
 
+void AIStatus::setChannelProbing(bool ongoing)
+{
+	boost::unique_lock<boost::mutex> lock(mx);
+	ongoingHeroMovement = ongoing;
+	cv.notify_all();
+}
+
+bool AIStatus::channelProbing()
+{
+	return ongoingChannelProbing;
+}
+
 SectorMap::SectorMap()
 SectorMap::SectorMap()
 {
 {
 	update();
 	update();

+ 3 - 0
AI/VCAI/VCAI.h

@@ -41,6 +41,7 @@ class AIStatus
 	std::map<int, QueryID> requestToQueryID; //IDs of answer-requests sent to server => query ids (so we can match answer confirmation from server to the query)
 	std::map<int, QueryID> requestToQueryID; //IDs of answer-requests sent to server => query ids (so we can match answer confirmation from server to the query)
 	std::vector<const CGObjectInstance*> objectsBeingVisited;
 	std::vector<const CGObjectInstance*> objectsBeingVisited;
 	bool ongoingHeroMovement;
 	bool ongoingHeroMovement;
+	bool ongoingChannelProbing; // true if AI currently explore bidirectional teleport channel exits
 
 
 	bool havingTurn;
 	bool havingTurn;
 
 
@@ -49,6 +50,8 @@ public:
 	~AIStatus();
 	~AIStatus();
 	void setBattle(BattleState BS);
 	void setBattle(BattleState BS);
 	void setMove(bool ongoing);
 	void setMove(bool ongoing);
+	void setChannelProbing(bool ongoing);
+	bool channelProbing();
 	BattleState getBattle();
 	BattleState getBattle();
 	void addQuery(QueryID ID, std::string description);
 	void addQuery(QueryID ID, std::string description);
 	void removeQuery(QueryID ID);
 	void removeQuery(QueryID ID);