Răsfoiți Sursa

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 ani în urmă
părinte
comite
ab7ad4741a
2 a modificat fișierele cu 16 adăugiri și 0 ștergeri
  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;
 	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<boost::mutex> lock(mx);
+	ongoingHeroMovement = ongoing;
+	cv.notify_all();
+}
+
+bool AIStatus::channelProbing()
+{
+	return ongoingChannelProbing;
+}
+
 SectorMap::SectorMap()
 {
 	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::vector<const CGObjectInstance*> 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);