mirror of
https://github.com/vcmi/vcmi.git
synced 2025-05-13 22:06:58 +02:00
* Right-click info window for castles and garrisons you do not own shows a rough amount of creatures instead of none.
I don't really know under which circumstances no information at all is shown in the original H3 so I haven't dealt with that.
This commit is contained in:
parent
68c5bb63a4
commit
95808db933
@ -923,6 +923,7 @@ InfoAboutTown::~InfoAboutTown()
|
|||||||
|
|
||||||
void InfoAboutTown::initFromTown( const CGTownInstance *t, bool detailed )
|
void InfoAboutTown::initFromTown( const CGTownInstance *t, bool detailed )
|
||||||
{
|
{
|
||||||
|
obj = t;
|
||||||
army = t->army;
|
army = t->army;
|
||||||
built = t->builded;
|
built = t->builded;
|
||||||
fortLevel = t->fortLevel();
|
fortLevel = t->fortLevel();
|
||||||
@ -939,12 +940,12 @@ void InfoAboutTown::initFromTown( const CGTownInstance *t, bool detailed )
|
|||||||
details->hallLevel = t->hallLevel();
|
details->hallLevel = t->hallLevel();
|
||||||
details->garrisonedHero = t->garrisonHero;
|
details->garrisonedHero = t->garrisonHero;
|
||||||
}
|
}
|
||||||
else
|
/*else
|
||||||
{
|
{
|
||||||
//hide info about hero stacks counts
|
//hide info about hero stacks counts
|
||||||
for(std::map<si32,std::pair<ui32,si32> >::iterator i = army.slots.begin(); i != army.slots.end(); ++i)
|
for(std::map<si32,std::pair<ui32,si32> >::iterator i = army.slots.begin(); i != army.slots.end(); ++i)
|
||||||
{
|
{
|
||||||
i->second.second = 0;
|
i->second.second = 0;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,7 @@ struct InfoAboutTown
|
|||||||
|
|
||||||
} *details;
|
} *details;
|
||||||
|
|
||||||
|
const CArmedInstance * obj;
|
||||||
char fortLevel; //0 - none
|
char fortLevel; //0 - none
|
||||||
char owner;
|
char owner;
|
||||||
std::string name;
|
std::string name;
|
||||||
|
@ -640,14 +640,23 @@ void CTerrainRect::clickRight(tribool down, bool previousState)
|
|||||||
if (garr != NULL) {
|
if (garr != NULL) {
|
||||||
InfoAboutTown iah;
|
InfoAboutTown iah;
|
||||||
|
|
||||||
|
iah.obj = garr;
|
||||||
iah.fortLevel = 0;
|
iah.fortLevel = 0;
|
||||||
iah.army = garr->army;
|
iah.army = garr->army;
|
||||||
iah.name = std::string("Garrison");
|
iah.name = VLC->generaltexth->names[33]; // "Garrison"
|
||||||
iah.owner = garr->tempOwner;
|
iah.owner = garr->tempOwner;
|
||||||
iah.built = false;
|
iah.built = false;
|
||||||
iah.details = NULL; // TODO: Find a suitable way to show detailed info.
|
|
||||||
iah.tType = NULL;
|
iah.tType = NULL;
|
||||||
|
|
||||||
|
// Show detailed info only to owning player.
|
||||||
|
if (garr->tempOwner == LOCPLINT->playerID) {
|
||||||
|
iah.details = new InfoAboutTown::Details;
|
||||||
|
iah.details->customRes = false;
|
||||||
|
iah.details->garrisonedHero = false;
|
||||||
|
iah.details->goldIncome = -1;
|
||||||
|
iah.details->hallLevel = -1;
|
||||||
|
}
|
||||||
|
|
||||||
SDL_Surface *iwin = graphics->drawTownInfoWin(iah);
|
SDL_Surface *iwin = graphics->drawTownInfoWin(iah);
|
||||||
CInfoPopup * ip = new CInfoPopup(iwin,
|
CInfoPopup * ip = new CInfoPopup(iwin,
|
||||||
GH.current->motion.x - iwin->w/2,
|
GH.current->motion.x - iwin->w/2,
|
||||||
|
@ -111,9 +111,17 @@ SDL_Surface * Graphics::drawTownInfoWin( const InfoAboutTown & curh )
|
|||||||
blitAt(graphics->smallImgs[(*i).second.first],slotsPos[(*i).first].first+1,slotsPos[(*i).first].second+1,ret);
|
blitAt(graphics->smallImgs[(*i).second.first],slotsPos[(*i).first].first+1,slotsPos[(*i).first].second+1,ret);
|
||||||
if(curh.details)
|
if(curh.details)
|
||||||
{
|
{
|
||||||
|
// Show exact creature amount.
|
||||||
SDL_itoa((*i).second.second,buf,10);
|
SDL_itoa((*i).second.second,buf,10);
|
||||||
printAtMiddle(buf,slotsPos[(*i).first].first+17,slotsPos[(*i).first].second+39,GEORM,zwykly,ret);
|
printAtMiddle(buf,slotsPos[(*i).first].first+17,slotsPos[(*i).first].second+39,GEORM,zwykly,ret);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Show only a rough amount for creature stacks.
|
||||||
|
// TODO: Deal with case when no information at all about size shold be presented.
|
||||||
|
std::string roughAmount = curh.obj->getRoughAmount(i->first);
|
||||||
|
printAtMiddle(roughAmount,slotsPos[(*i).first].first+17,slotsPos[(*i).first].second+39,GEORM,zwykly,ret);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//blit town icon
|
//blit town icon
|
||||||
@ -132,8 +140,10 @@ SDL_Surface * Graphics::drawTownInfoWin( const InfoAboutTown & curh )
|
|||||||
if((pom=curh.details->hallLevel) >= 0)
|
if((pom=curh.details->hallLevel) >= 0)
|
||||||
blitAt(halls->ourImages[pom].bitmap, 77, 42, ret);
|
blitAt(halls->ourImages[pom].bitmap, 77, 42, ret);
|
||||||
|
|
||||||
|
if (curh.details->goldIncome >= 0) {
|
||||||
SDL_itoa(curh.details->goldIncome, buf, 10); //gold income
|
SDL_itoa(curh.details->goldIncome, buf, 10); //gold income
|
||||||
printAtMiddle(buf, 167, 70, GEORM, zwykly, ret);
|
printAtMiddle(buf, 167, 70, GEORM, zwykly, ret);
|
||||||
|
}
|
||||||
if(curh.details->garrisonedHero) //garrisoned hero icon
|
if(curh.details->garrisonedHero) //garrisoned hero icon
|
||||||
blitAt(graphics->heroInGarrison,158,87,ret);
|
blitAt(graphics->heroInGarrison,158,87,ret);
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "../global.h"
|
#include "../global.h"
|
||||||
#include "FontBase.h"
|
#include "FontBase.h"
|
||||||
|
#include "../hch/CObjectHandler.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Graphics.h, part of VCMI engine
|
* Graphics.h, part of VCMI engine
|
||||||
|
Loading…
x
Reference in New Issue
Block a user