1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

In tavern update the hover text for the RECRUIT button when a hero is selected.

This commit is contained in:
Frank Zago 2009-05-30 16:17:44 +00:00
parent cff70406f1
commit e7b2074812
2 changed files with 12 additions and 8 deletions

View File

@ -2762,6 +2762,7 @@ CTavernWindow::CTavernWindow(const CGHeroInstance *H1, const CGHeroInstance *H2,
selected = 0;
else
selected = -1;
oldSelected = -1;
bg = BitmapHandler::loadBitmap("TPTAVERN.bmp");
SDL_SetColorKey(bg,SDL_SRCCOLORKEY,SDL_MapRGB(bg->format,0,255,255));
graphics->blueToPlayersAdv(bg,LOCPLINT->playerID);
@ -2801,13 +2802,7 @@ CTavernWindow::CTavernWindow(const CGHeroInstance *H1, const CGHeroInstance *H2,
}
else
{
if(H1)
{
recruit->hoverTexts[0] = CGI->generaltexth->tavernInfo[3]; //Recruit %s the %s
boost::algorithm::replace_first(recruit->hoverTexts[0],"%s",H1->name);
boost::algorithm::replace_first(recruit->hoverTexts[0],"%s",H1->type->heroClass->name);
}
else
if(!H1)
recruit->block(1);
}
}
@ -2871,7 +2866,15 @@ void CTavernWindow::show(SDL_Surface * to)
if(selected >= 0)
{
HeroPortrait *sel = selected ? &h2 : &h1;
HeroPortrait *other = selected ? &h1 : &h2;
if (selected != oldSelected) {
// Selected hero just changed. Update OK button hover text
oldSelected = selected;
recruit->hoverTexts[0] = CGI->generaltexth->tavernInfo[3]; //Recruit %s the %s
boost::algorithm::replace_first(recruit->hoverTexts[0],"%s",sel->h->name);
boost::algorithm::replace_first(recruit->hoverTexts[0],"%s",sel->h->type->heroClass->name);
}
printAtMiddleWB(sel->descr,pos.x+146,pos.y+389,GEOR13,40,zwykly,to);
CSDL_Ext::drawBorder(to,sel->pos.x-2,sel->pos.y-2,sel->pos.w+4,sel->pos.h+4,int3(247,223,123));

View File

@ -514,6 +514,7 @@ public:
SDL_Surface *bg; //background
CStatusBar *bar; //tavern's internal status bar
int selected;//0 (left) or 1 (right)
int oldSelected;//0 (left) or 1 (right)
AdventureMapButton *thiefGuild, *cancel, *recruit;