mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Thieves Guild: fix tavern map object, lvl 0 when no taverns owned
We also now check not number of towns, but only towns that has tavern built. Also according to original mechanics all taverns always display information based on your number of taverns and not number of taverns of object owner.
This commit is contained in:
parent
3b3c49420f
commit
2a63ba148a
@ -1630,9 +1630,9 @@ CThievesGuildWindow::CThievesGuildWindow(const CGObjectInstance * _owner):
|
||||
int counter = 0;
|
||||
for(auto & iter : tgi.colorToBestHero)
|
||||
{
|
||||
new CPicture(colorToBox[iter.first.getNum()], 253 + 66 * counter, 334);
|
||||
if(iter.second.portrait >= 0)
|
||||
{
|
||||
new CPicture(colorToBox[iter.first.getNum()], 253 + 66 * counter, 334);
|
||||
new CAnimImage("PortraitsSmall", iter.second.portrait, 0, 260 + 66 * counter, 360);
|
||||
//TODO: r-click info:
|
||||
// - r-click on hero
|
||||
|
@ -197,7 +197,14 @@ void CGameInfoCallback::getThievesGuildInfo(SThievesGuildInfo & thi, const CGObj
|
||||
|
||||
if(obj->ID == Obj::TOWN || obj->ID == Obj::TAVERN)
|
||||
{
|
||||
gs->obtainPlayersStats(thi, gs->players[obj->tempOwner].towns.size());
|
||||
int taverns = 0;
|
||||
for(auto town : gs->players[*player].towns)
|
||||
{
|
||||
if(town->hasBuilt(BuildingID::TAVERN))
|
||||
taverns++;
|
||||
}
|
||||
|
||||
gs->obtainPlayersStats(thi, taverns);
|
||||
}
|
||||
else if(obj->ID == Obj::DEN_OF_THIEVES)
|
||||
{
|
||||
|
@ -2603,13 +2603,15 @@ void CGameState::obtainPlayersStats(SThievesGuildInfo & tgi, int level)
|
||||
tgi.playerColors.push_back(elem.second.color);
|
||||
}
|
||||
|
||||
if(level >= 1) //num of towns & num of heroes
|
||||
if(level >= 0) //num of towns & num of heroes
|
||||
{
|
||||
//num of towns
|
||||
FILL_FIELD(numOfTowns, g->second.towns.size())
|
||||
//num of heroes
|
||||
FILL_FIELD(numOfHeroes, g->second.heroes.size())
|
||||
//best hero's portrait
|
||||
}
|
||||
if(level >= 1) //best hero's portrait
|
||||
{
|
||||
for(auto g = players.cbegin(); g != players.cend(); ++g)
|
||||
{
|
||||
if(playerInactive(g->second.color))
|
||||
|
Loading…
Reference in New Issue
Block a user