1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00

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.
This commit is contained in:
ArseniyShestakov 2015-03-08 17:23:56 +03:00
parent 5233b60243
commit ab7ad4741a
2 changed files with 16 additions and 0 deletions

View File

@ -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();

View File

@ -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);