1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00
This commit is contained in:
Michał W. Urbańczyk 2014-03-01 13:42:23 +00:00
parent 93b8d2e59a
commit a6f68d6870
2 changed files with 4 additions and 3 deletions

View File

@ -3699,7 +3699,8 @@ CTavernWindow::CTavernWindow(const CGObjectInstance *TavernObj):
{
OBJ_CONSTRUCTION_CAPTURING_ALL;
std::vector<const CGHeroInstance*> h = LOCPLINT->cb->getAvailableHeroes(TavernObj);
assert(h.size() == 2);
if(h.size() < 2)
h.resize(2, nullptr);
h1 = new HeroPortrait(selected,0,72,299,h[0]);
h2 = new HeroPortrait(selected,1,162,299,h[1]);

View File

@ -554,8 +554,8 @@ std::vector<const CGHeroInstance *> CGameInfoCallback::getAvailableHeroes(const
std::vector<const CGHeroInstance *> 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
ret.resize(gs->players[*player].availableHeroes.size());
std::copy(gs->players[*player].availableHeroes.begin(),gs->players[*player].availableHeroes.end(),ret.begin());
range::copy(gs->players[*player].availableHeroes, std::back_inserter(ret));
vstd::erase_if(ret, [](const CGHeroInstance *h) { return h == nullptr; });
return ret;
}