mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Fix AI recruitment
This commit is contained in:
@@ -330,7 +330,11 @@ void AIGateway::showRecruitmentDialog(const CGDwelling * dwelling, const CArmedI
|
|||||||
NET_EVENT_HANDLER;
|
NET_EVENT_HANDLER;
|
||||||
|
|
||||||
status.addQuery(queryID, "RecruitmentDialog");
|
status.addQuery(queryID, "RecruitmentDialog");
|
||||||
requestActionASAP([=](){ answerQuery(queryID, 0); });
|
|
||||||
|
requestActionASAP([=](){
|
||||||
|
recruitCreatures(dwelling, dst);
|
||||||
|
answerQuery(queryID, 0);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void AIGateway::heroMovePointsChanged(const CGHeroInstance * hero)
|
void AIGateway::heroMovePointsChanged(const CGHeroInstance * hero)
|
||||||
@@ -845,9 +849,6 @@ void AIGateway::performObjectInteraction(const CGObjectInstance * obj, HeroPtr h
|
|||||||
LOG_TRACE_PARAMS(logAi, "Hero %s and object %s at %s", h->getNameTranslated() % obj->getObjectName() % obj->pos.toString());
|
LOG_TRACE_PARAMS(logAi, "Hero %s and object %s at %s", h->getNameTranslated() % obj->getObjectName() % obj->pos.toString());
|
||||||
switch(obj->ID)
|
switch(obj->ID)
|
||||||
{
|
{
|
||||||
case Obj::CREATURE_GENERATOR1:
|
|
||||||
recruitCreatures(dynamic_cast<const CGDwelling *>(obj), h.get());
|
|
||||||
break;
|
|
||||||
case Obj::TOWN:
|
case Obj::TOWN:
|
||||||
if(h->visitedTown) //we are inside, not just attacking
|
if(h->visitedTown) //we are inside, not just attacking
|
||||||
{
|
{
|
||||||
|
@@ -366,7 +366,11 @@ void VCAI::showRecruitmentDialog(const CGDwelling * dwelling, const CArmedInstan
|
|||||||
NET_EVENT_HANDLER;
|
NET_EVENT_HANDLER;
|
||||||
|
|
||||||
status.addQuery(queryID, "RecruitmentDialog");
|
status.addQuery(queryID, "RecruitmentDialog");
|
||||||
requestActionASAP([=](){ answerQuery(queryID, 0); });
|
requestActionASAP([=](){
|
||||||
|
recruitCreatures(dwelling, dst);
|
||||||
|
checkHeroArmy(dynamic_cast<const CGHeroInstance*>(dst));
|
||||||
|
answerQuery(queryID, 0);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void VCAI::heroMovePointsChanged(const CGHeroInstance * hero)
|
void VCAI::heroMovePointsChanged(const CGHeroInstance * hero)
|
||||||
@@ -1056,10 +1060,6 @@ void VCAI::performObjectInteraction(const CGObjectInstance * obj, HeroPtr h)
|
|||||||
LOG_TRACE_PARAMS(logAi, "Hero %s and object %s at %s", h->getNameTranslated() % obj->getObjectName() % obj->pos.toString());
|
LOG_TRACE_PARAMS(logAi, "Hero %s and object %s at %s", h->getNameTranslated() % obj->getObjectName() % obj->pos.toString());
|
||||||
switch(obj->ID)
|
switch(obj->ID)
|
||||||
{
|
{
|
||||||
case Obj::CREATURE_GENERATOR1:
|
|
||||||
recruitCreatures(dynamic_cast<const CGDwelling *>(obj), h.get());
|
|
||||||
checkHeroArmy(h);
|
|
||||||
break;
|
|
||||||
case Obj::TOWN:
|
case Obj::TOWN:
|
||||||
moveCreaturesToHero(dynamic_cast<const CGTownInstance *>(obj));
|
moveCreaturesToHero(dynamic_cast<const CGTownInstance *>(obj));
|
||||||
if(h->visitedTown) //we are inside, not just attacking
|
if(h->visitedTown) //we are inside, not just attacking
|
||||||
|
Reference in New Issue
Block a user