mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Fix Issue 2214 (#437)
CGameInfoCallback::getAvailableHeroes: add checks for tavern
This commit is contained in:
parent
cac83379f5
commit
2b64bf29ed
@ -477,8 +477,14 @@ std::vector<const CGHeroInstance *> CGameInfoCallback::getAvailableHeroes(const
|
|||||||
std::vector<const CGHeroInstance *> ret;
|
std::vector<const CGHeroInstance *> ret;
|
||||||
//ERROR_RET_VAL_IF(!isOwnedOrVisited(townOrTavern), "Town or tavern must be owned or visited!", ret);
|
//ERROR_RET_VAL_IF(!isOwnedOrVisited(townOrTavern), "Town or tavern must be owned or visited!", ret);
|
||||||
//TODO: town needs to be owned, advmap tavern needs to be visited; to be reimplemented when visit tracking is done
|
//TODO: town needs to be owned, advmap tavern needs to be visited; to be reimplemented when visit tracking is done
|
||||||
|
const CGTownInstance * town = getTown(townOrTavern->id);
|
||||||
|
if(townOrTavern->ID == Obj::TAVERN || (town && town->hasBuilt(BuildingID::TAVERN)))
|
||||||
|
{
|
||||||
range::copy(gs->players[*player].availableHeroes, std::back_inserter(ret));
|
range::copy(gs->players[*player].availableHeroes, std::back_inserter(ret));
|
||||||
vstd::erase_if(ret, [](const CGHeroInstance *h) { return h == nullptr; });
|
vstd::erase_if(ret, [](const CGHeroInstance * h) {
|
||||||
|
return h == nullptr;
|
||||||
|
});
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user