2013-04-20 14:34:01 +03:00
|
|
|
#include "StdInc.h"
|
|
|
|
#include "CQuery.h"
|
|
|
|
#include "CGameHandler.h"
|
2013-04-21 15:49:26 +03:00
|
|
|
#include "../lib/BattleState.h"
|
2015-12-02 21:05:10 +02:00
|
|
|
#include "../lib/mapObjects/MiscObjects.h"
|
2013-04-20 14:34:01 +03:00
|
|
|
|
|
|
|
boost::mutex Queries::mx;
|
|
|
|
|
|
|
|
template <typename Container>
|
|
|
|
std::string formatContainer(const Container &c, std::string delimeter=", ", std::string opener="(", std::string closer=")")
|
|
|
|
{
|
|
|
|
std::string ret = opener;
|
2013-06-29 16:05:48 +03:00
|
|
|
auto itr = std::begin(c);
|
|
|
|
if(itr != std::end(c))
|
2013-04-20 14:34:01 +03:00
|
|
|
{
|
|
|
|
ret += boost::lexical_cast<std::string>(*itr);
|
2013-06-29 16:05:48 +03:00
|
|
|
while(++itr != std::end(c))
|
2013-04-20 14:34:01 +03:00
|
|
|
{
|
|
|
|
ret += delimeter;
|
|
|
|
ret += boost::lexical_cast<std::string>(*itr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ret += closer;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::ostream & operator<<(std::ostream &out, const CQuery &query)
|
|
|
|
{
|
|
|
|
return out << query.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
std::ostream & operator<<(std::ostream &out, QueryPtr query)
|
|
|
|
{
|
|
|
|
return out << "[" << query.get() << "] " << query->toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
CQuery::CQuery(void)
|
|
|
|
{
|
|
|
|
boost::unique_lock<boost::mutex> l(Queries::mx);
|
|
|
|
|
2013-05-27 17:20:46 +03:00
|
|
|
static QueryID QID = QueryID(0);
|
2013-04-20 14:34:01 +03:00
|
|
|
|
2013-05-27 17:20:46 +03:00
|
|
|
queryID = ++QID;
|
2016-08-30 00:11:54 +02:00
|
|
|
logGlobal->trace("Created a new query with id %d", queryID);
|
2013-04-20 14:34:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CQuery::~CQuery(void)
|
|
|
|
{
|
2016-08-30 00:11:54 +02:00
|
|
|
logGlobal->trace("Destructed the query with id %d", queryID);
|
2013-04-20 14:34:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void CQuery::addPlayer(PlayerColor color)
|
|
|
|
{
|
|
|
|
if(color.isValidPlayer())
|
|
|
|
{
|
|
|
|
players.push_back(color);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string CQuery::toString() const
|
|
|
|
{
|
|
|
|
std::string ret = boost::str(boost::format("A query of type %s and qid=%d affecting players %s") % typeid(*this).name() % queryID % formatContainer(players));
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CQuery::endsByPlayerAnswer() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CQuery::onRemoval(CGameHandler *gh, PlayerColor color)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CQuery::blocksPack(const CPack *pack) const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CQuery::notifyObjectAboutRemoval(const CObjectVisitQuery &objectVisit) const
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void CQuery::onExposure(CGameHandler *gh, QueryPtr topQuery)
|
|
|
|
{
|
|
|
|
gh->queries.popQuery(*this);
|
|
|
|
}
|
|
|
|
|
2013-09-28 02:46:58 +03:00
|
|
|
void CQuery::onAdding(CGameHandler *gh, PlayerColor color)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-04-20 14:34:01 +03:00
|
|
|
CObjectVisitQuery::CObjectVisitQuery(const CGObjectInstance *Obj, const CGHeroInstance *Hero, int3 Tile)
|
2013-05-14 16:42:52 +03:00
|
|
|
: visitedObject(Obj), visitingHero(Hero), tile(Tile), removeObjectAfterVisit(false)
|
2013-04-20 14:34:01 +03:00
|
|
|
{
|
|
|
|
addPlayer(Hero->tempOwner);
|
|
|
|
}
|
|
|
|
|
2015-10-28 22:53:44 +02:00
|
|
|
bool CObjectVisitQuery::blocksPack(const CPack *pack) const
|
2013-04-20 14:34:01 +03:00
|
|
|
{
|
|
|
|
//During the visit itself ALL actions are blocked.
|
|
|
|
//(However, the visit may trigger a query above that'll pass some.)
|
2015-10-28 22:53:44 +02:00
|
|
|
return true;
|
2013-04-20 14:34:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void CObjectVisitQuery::onRemoval(CGameHandler *gh, PlayerColor color)
|
|
|
|
{
|
|
|
|
gh->objectVisitEnded(*this);
|
2013-05-14 16:42:52 +03:00
|
|
|
|
|
|
|
//TODO or should it be destructor?
|
|
|
|
//Can object visit affect 2 players and what would be desired behavior?
|
|
|
|
if(removeObjectAfterVisit)
|
|
|
|
gh->removeObject(visitedObject);
|
2013-04-20 14:34:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void CObjectVisitQuery::onExposure(CGameHandler *gh, QueryPtr topQuery)
|
|
|
|
{
|
|
|
|
//Object may have been removed and deleted.
|
|
|
|
if(gh->isValidObject(visitedObject))
|
|
|
|
topQuery->notifyObjectAboutRemoval(*this);
|
|
|
|
|
|
|
|
gh->queries.popQuery(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Queries::popQuery(PlayerColor player, QueryPtr query)
|
|
|
|
{
|
|
|
|
LOG_TRACE_PARAMS(logGlobal, "player='%s', query='%s'", player % query);
|
|
|
|
if(topQuery(player) != query)
|
|
|
|
{
|
2016-08-30 00:11:54 +02:00
|
|
|
logGlobal->trace("Cannot remove, not a top!");
|
2013-04-20 14:34:01 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
queries[player] -= query;
|
|
|
|
auto nextQuery = topQuery(player);
|
|
|
|
|
|
|
|
query->onRemoval(gh, player);
|
|
|
|
|
2014-03-23 15:59:03 +03:00
|
|
|
//Exposure on query below happens only if removal didn't trigger any new query
|
2013-04-20 14:34:01 +03:00
|
|
|
if(nextQuery && nextQuery == topQuery(player))
|
|
|
|
{
|
|
|
|
nextQuery->onExposure(gh, query);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Queries::popQuery(const CQuery &query)
|
|
|
|
{
|
|
|
|
LOG_TRACE_PARAMS(logGlobal, "query='%s'", query);
|
|
|
|
|
|
|
|
assert(query.players.size());
|
2013-06-29 16:05:48 +03:00
|
|
|
for(auto player : query.players)
|
2013-04-20 14:34:01 +03:00
|
|
|
{
|
|
|
|
auto top = topQuery(player);
|
|
|
|
if(top.get() == &query)
|
|
|
|
popQuery(top);
|
|
|
|
else
|
2016-08-30 00:11:54 +02:00
|
|
|
logGlobal->trace("Cannot remove query %s", query.toString());
|
2013-04-20 14:34:01 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Queries::popQuery(QueryPtr query)
|
|
|
|
{
|
2013-06-29 16:05:48 +03:00
|
|
|
for(auto player : query->players)
|
2013-04-20 14:34:01 +03:00
|
|
|
popQuery(player, query);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Queries::addQuery(QueryPtr query)
|
|
|
|
{
|
2013-06-29 16:05:48 +03:00
|
|
|
for(auto player : query->players)
|
2013-04-20 14:34:01 +03:00
|
|
|
addQuery(player, query);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Queries::addQuery(PlayerColor player, QueryPtr query)
|
|
|
|
{
|
2016-08-30 00:11:54 +02:00
|
|
|
LOG_TRACE_PARAMS(logGlobal, "player='%d', query='%s'", player.getNum() % query);
|
2013-09-28 02:46:58 +03:00
|
|
|
query->onAdding(gh, player);
|
2013-04-20 14:34:01 +03:00
|
|
|
queries[player].push_back(query);
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryPtr Queries::topQuery(PlayerColor player)
|
|
|
|
{
|
|
|
|
return vstd::backOrNull(queries[player]);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Queries::popIfTop(QueryPtr query)
|
|
|
|
{
|
2013-06-17 18:45:55 +03:00
|
|
|
LOG_TRACE_PARAMS(logGlobal, "query='%d'", query);
|
|
|
|
if(!query)
|
2016-08-30 00:11:54 +02:00
|
|
|
logGlobal->error("The query is nullptr! Ignoring.");
|
2013-06-17 18:45:55 +03:00
|
|
|
|
2013-04-20 14:34:01 +03:00
|
|
|
popIfTop(*query);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Queries::popIfTop(const CQuery &query)
|
|
|
|
{
|
2013-06-29 16:05:48 +03:00
|
|
|
for(PlayerColor color : query.players)
|
2013-04-20 14:34:01 +03:00
|
|
|
if(topQuery(color).get() == &query)
|
|
|
|
popQuery(color, topQuery(color));
|
|
|
|
}
|
|
|
|
|
2015-12-29 04:43:33 +02:00
|
|
|
std::vector<std::shared_ptr<const CQuery>> Queries::allQueries() const
|
2013-04-20 14:34:01 +03:00
|
|
|
{
|
2015-12-29 04:43:33 +02:00
|
|
|
std::vector<std::shared_ptr<const CQuery>> ret;
|
2013-06-29 16:05:48 +03:00
|
|
|
for(auto &playerQueries : queries)
|
|
|
|
for(auto &query : playerQueries.second)
|
2013-04-20 14:34:01 +03:00
|
|
|
ret.push_back(query);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-12-29 04:43:33 +02:00
|
|
|
std::vector<std::shared_ptr<CQuery>> Queries::allQueries()
|
2013-04-20 14:34:01 +03:00
|
|
|
{
|
|
|
|
//TODO code duplication with const function :(
|
2015-12-29 04:43:33 +02:00
|
|
|
std::vector<std::shared_ptr<CQuery>> ret;
|
2013-06-29 16:05:48 +03:00
|
|
|
for(auto &playerQueries : queries)
|
|
|
|
for(auto &query : playerQueries.second)
|
2013-04-20 14:34:01 +03:00
|
|
|
ret.push_back(query);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-10-28 22:53:44 +02:00
|
|
|
void CBattleQuery::notifyObjectAboutRemoval(const CObjectVisitQuery &objectVisit) const
|
2013-04-20 14:34:01 +03:00
|
|
|
{
|
|
|
|
assert(result);
|
|
|
|
objectVisit.visitedObject->battleFinished(objectVisit.visitingHero, *result);
|
|
|
|
}
|
|
|
|
|
|
|
|
CBattleQuery::CBattleQuery(const BattleInfo *Bi)
|
|
|
|
{
|
2013-07-22 01:01:29 +03:00
|
|
|
belligerents[0] = Bi->sides[0].armyObject;
|
|
|
|
belligerents[1] = Bi->sides[1].armyObject;
|
2013-04-20 14:34:01 +03:00
|
|
|
|
|
|
|
bi = Bi;
|
|
|
|
|
2013-07-22 01:01:29 +03:00
|
|
|
for(auto &side : bi->sides)
|
|
|
|
addPlayer(side.color);
|
2013-04-20 14:34:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
CBattleQuery::CBattleQuery()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-10-28 22:53:44 +02:00
|
|
|
bool CBattleQuery::blocksPack(const CPack *pack) const
|
2013-04-20 14:34:01 +03:00
|
|
|
{
|
2015-10-28 22:53:44 +02:00
|
|
|
const char * name = typeid(*pack).name();
|
|
|
|
return strcmp(name, typeid(MakeAction).name()) && strcmp(name, typeid(MakeCustomAction).name());
|
2013-04-20 14:34:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void CBattleQuery::onRemoval(CGameHandler *gh, PlayerColor color)
|
|
|
|
{
|
|
|
|
gh->battleAfterLevelUp(*result);
|
|
|
|
}
|
|
|
|
|
2015-10-28 22:53:44 +02:00
|
|
|
void CGarrisonDialogQuery::notifyObjectAboutRemoval(const CObjectVisitQuery &objectVisit) const
|
2013-04-20 14:34:01 +03:00
|
|
|
{
|
|
|
|
objectVisit.visitedObject->garrisonDialogClosed(objectVisit.visitingHero);
|
|
|
|
}
|
|
|
|
|
|
|
|
CGarrisonDialogQuery::CGarrisonDialogQuery(const CArmedInstance *up, const CArmedInstance *down)
|
|
|
|
{
|
|
|
|
exchangingArmies[0] = up;
|
|
|
|
exchangingArmies[1] = down;
|
|
|
|
|
|
|
|
addPlayer(up->tempOwner);
|
|
|
|
addPlayer(down->tempOwner);
|
|
|
|
}
|
|
|
|
|
2015-10-28 22:53:44 +02:00
|
|
|
bool CGarrisonDialogQuery::blocksPack(const CPack *pack) const
|
2013-04-20 14:34:01 +03:00
|
|
|
{
|
2013-11-07 15:48:41 +03:00
|
|
|
std::set<ObjectInstanceID> ourIds;
|
2013-06-01 01:23:53 +03:00
|
|
|
ourIds.insert(this->exchangingArmies[0]->id);
|
|
|
|
ourIds.insert(this->exchangingArmies[1]->id);
|
|
|
|
|
2015-10-28 22:53:44 +02:00
|
|
|
if (auto stacks = dynamic_ptr_cast<ArrangeStacks>(pack))
|
2013-04-20 14:34:01 +03:00
|
|
|
{
|
|
|
|
return !vstd::contains(ourIds, stacks->id1) || !vstd::contains(ourIds, stacks->id2);
|
|
|
|
}
|
2015-10-28 22:53:44 +02:00
|
|
|
|
|
|
|
if (auto arts = dynamic_ptr_cast<ExchangeArtifacts>(pack))
|
2013-06-01 01:23:53 +03:00
|
|
|
{
|
|
|
|
if(auto id1 = boost::apply_visitor(GetEngagedHeroIds(), arts->src.artHolder))
|
|
|
|
if(!vstd::contains(ourIds, *id1))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if(auto id2 = boost::apply_visitor(GetEngagedHeroIds(), arts->dst.artHolder))
|
|
|
|
if(!vstd::contains(ourIds, *id2))
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
2015-10-28 22:53:44 +02:00
|
|
|
if (auto dismiss = dynamic_ptr_cast<DisbandCreature>(pack))
|
2014-02-09 22:47:23 +03:00
|
|
|
{
|
|
|
|
return !vstd::contains(ourIds, dismiss->id);
|
|
|
|
}
|
2013-04-20 14:34:01 +03:00
|
|
|
|
2015-10-28 22:53:44 +02:00
|
|
|
if (auto dismiss = dynamic_ptr_cast<AssembleArtifacts>(pack))
|
2014-06-14 16:52:30 +03:00
|
|
|
{
|
|
|
|
return !vstd::contains(ourIds, dismiss->heroID);
|
|
|
|
}
|
2015-10-28 22:53:44 +02:00
|
|
|
|
|
|
|
if(auto upgrade = dynamic_ptr_cast<UpgradeCreature>(pack))
|
2015-09-15 09:54:55 +02:00
|
|
|
{
|
|
|
|
return !vstd::contains(ourIds, upgrade->id);
|
|
|
|
}
|
2013-04-20 14:34:01 +03:00
|
|
|
return CDialogQuery::blocksPack(pack);
|
|
|
|
}
|
|
|
|
|
2015-10-28 22:53:44 +02:00
|
|
|
void CBlockingDialogQuery::notifyObjectAboutRemoval(const CObjectVisitQuery &objectVisit) const
|
2013-04-20 14:34:01 +03:00
|
|
|
{
|
|
|
|
assert(answer);
|
|
|
|
objectVisit.visitedObject->blockingDialogAnswered(objectVisit.visitingHero, *answer);
|
|
|
|
}
|
|
|
|
|
|
|
|
CBlockingDialogQuery::CBlockingDialogQuery(const BlockingDialog &bd)
|
|
|
|
{
|
|
|
|
this->bd = bd;
|
|
|
|
addPlayer(bd.player);
|
|
|
|
}
|
|
|
|
|
2015-03-08 15:37:33 +02:00
|
|
|
void CTeleportDialogQuery::notifyObjectAboutRemoval(const CObjectVisitQuery &objectVisit) const
|
|
|
|
{
|
2016-01-18 09:44:46 +02:00
|
|
|
// do not change to dynamic_ptr_cast - SIGSEGV!
|
|
|
|
auto obj = dynamic_cast<const CGTeleport*>(objectVisit.visitedObject);
|
2015-03-08 15:37:33 +02:00
|
|
|
obj->teleportDialogAnswered(objectVisit.visitingHero, *answer, td.exits);
|
|
|
|
}
|
|
|
|
|
|
|
|
CTeleportDialogQuery::CTeleportDialogQuery(const TeleportDialog &td)
|
|
|
|
{
|
|
|
|
this->td = td;
|
|
|
|
addPlayer(td.hero->tempOwner);
|
|
|
|
}
|
|
|
|
|
2013-04-20 14:34:01 +03:00
|
|
|
CHeroLevelUpDialogQuery::CHeroLevelUpDialogQuery(const HeroLevelUp &Hlu)
|
|
|
|
{
|
|
|
|
hlu = Hlu;
|
|
|
|
addPlayer(hlu.hero->tempOwner);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CHeroLevelUpDialogQuery::onRemoval(CGameHandler *gh, PlayerColor color)
|
|
|
|
{
|
|
|
|
assert(answer);
|
2016-08-30 00:11:54 +02:00
|
|
|
logGlobal->trace("Completing hero level-up query. %s gains skill %d", hlu.hero->getObjectName(), answer.get());
|
2013-04-20 14:34:01 +03:00
|
|
|
gh->levelUpHero(hlu.hero, hlu.skills[*answer]);
|
|
|
|
}
|
|
|
|
|
2015-10-28 22:53:44 +02:00
|
|
|
void CHeroLevelUpDialogQuery::notifyObjectAboutRemoval(const CObjectVisitQuery &objectVisit) const
|
2013-05-28 00:46:04 +03:00
|
|
|
{
|
|
|
|
objectVisit.visitedObject->heroLevelUpDone(objectVisit.visitingHero);
|
|
|
|
}
|
|
|
|
|
2013-04-20 14:34:01 +03:00
|
|
|
CCommanderLevelUpDialogQuery::CCommanderLevelUpDialogQuery(const CommanderLevelUp &Clu)
|
|
|
|
{
|
|
|
|
clu = Clu;
|
|
|
|
addPlayer(clu.hero->tempOwner);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCommanderLevelUpDialogQuery::onRemoval(CGameHandler *gh, PlayerColor color)
|
|
|
|
{
|
|
|
|
assert(answer);
|
2016-08-30 00:11:54 +02:00
|
|
|
logGlobal->trace("Completing commander level-up query. Commander of hero %s gains skill %s", clu.hero->getObjectName(), answer.get());
|
2013-04-20 14:34:01 +03:00
|
|
|
gh->levelUpCommander(clu.hero->commander, clu.skills[*answer]);
|
|
|
|
}
|
|
|
|
|
2015-10-28 22:53:44 +02:00
|
|
|
void CCommanderLevelUpDialogQuery::notifyObjectAboutRemoval(const CObjectVisitQuery &objectVisit) const
|
2013-05-28 00:46:04 +03:00
|
|
|
{
|
|
|
|
objectVisit.visitedObject->heroLevelUpDone(objectVisit.visitingHero);
|
|
|
|
}
|
|
|
|
|
2015-10-28 22:53:44 +02:00
|
|
|
bool CDialogQuery::endsByPlayerAnswer() const
|
2013-04-20 14:34:01 +03:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-10-28 22:53:44 +02:00
|
|
|
bool CDialogQuery::blocksPack(const CPack *pack) const
|
2013-04-20 14:34:01 +03:00
|
|
|
{
|
|
|
|
//We accept only query replies from correct player
|
2015-10-28 22:53:44 +02:00
|
|
|
if(auto reply = dynamic_ptr_cast<QueryReply>(pack))
|
2013-04-20 14:34:01 +03:00
|
|
|
{
|
|
|
|
return !vstd::contains(players, reply->player);
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
CHeroMovementQuery::CHeroMovementQuery(const TryMoveHero &Tmh, const CGHeroInstance *Hero, bool VisitDestAfterVictory)
|
|
|
|
: tmh(Tmh), visitDestAfterVictory(VisitDestAfterVictory), hero(Hero)
|
|
|
|
{
|
|
|
|
players.push_back(hero->tempOwner);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CHeroMovementQuery::onExposure(CGameHandler *gh, QueryPtr topQuery)
|
|
|
|
{
|
|
|
|
assert(players.size() == 1);
|
|
|
|
|
|
|
|
if(visitDestAfterVictory && hero->tempOwner == players[0]) //hero still alive, so he won with the guard
|
|
|
|
//TODO what if there were H4-like escape? we should also check pos
|
|
|
|
{
|
2016-08-30 00:11:54 +02:00
|
|
|
logGlobal->trace("Hero %s after victory over guard finishes visit to %s", hero->name, tmh.end());
|
2013-04-20 14:34:01 +03:00
|
|
|
//finish movement
|
|
|
|
visitDestAfterVictory = false;
|
|
|
|
gh->visitObjectOnTile(*gh->getTile(CGHeroInstance::convertPosition(tmh.end, false)), hero);
|
|
|
|
}
|
|
|
|
|
|
|
|
gh->queries.popIfTop(*this);
|
|
|
|
}
|
2013-09-28 02:46:58 +03:00
|
|
|
|
|
|
|
void CHeroMovementQuery::onRemoval(CGameHandler *gh, PlayerColor color)
|
|
|
|
{
|
|
|
|
PlayerBlocked pb;
|
|
|
|
pb.player = color;
|
|
|
|
pb.reason = PlayerBlocked::ONGOING_MOVEMENT;
|
|
|
|
pb.startOrEnd = PlayerBlocked::BLOCKADE_ENDED;
|
|
|
|
gh->sendAndApply(&pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CHeroMovementQuery::onAdding(CGameHandler *gh, PlayerColor color)
|
|
|
|
{
|
|
|
|
PlayerBlocked pb;
|
|
|
|
pb.player = color;
|
|
|
|
pb.reason = PlayerBlocked::ONGOING_MOVEMENT;
|
|
|
|
pb.startOrEnd = PlayerBlocked::BLOCKADE_STARTED;
|
|
|
|
gh->sendAndApply(&pb);
|
|
|
|
}
|