|
@@ -1014,6 +1014,7 @@ CCreaInfo::CCreaInfo(Point position, const CGTownInstance *Town, int Level, bool
|
|
|
level = -1;
|
|
|
label = nullptr;
|
|
|
picture = nullptr;
|
|
|
+ creature = nullptr;
|
|
|
return;//No creature
|
|
|
}
|
|
|
addUsedEvents(LCLICK | RCLICK | HOVER);
|
|
@@ -1125,6 +1126,8 @@ CTownInfo::CTownInfo(int posX, int posY, const CGTownInstance* Town, bool townHa
|
|
|
pos.y += posY;
|
|
|
int buildID;
|
|
|
|
|
|
+ picture = nullptr;
|
|
|
+
|
|
|
if (townHall)
|
|
|
{
|
|
|
buildID = 10 + town->hallLevel();
|
|
@@ -1134,7 +1137,7 @@ CTownInfo::CTownInfo(int posX, int posY, const CGTownInstance* Town, bool townHa
|
|
|
{
|
|
|
buildID = 6 + town->fortLevel();
|
|
|
if (buildID == 6)
|
|
|
- return;
|
|
|
+ return;//FIXME: suspicious statement, fix or comment
|
|
|
picture = new CAnimImage("ITMCL.DEF", town->fortLevel()-1);
|
|
|
}
|
|
|
building = town->town->buildings.at(BuildingID(buildID));
|
|
@@ -1302,11 +1305,11 @@ CHallInterface::CBuildingBox::CBuildingBox(int x, int y, const CGTownInstance *
|
|
|
static int panelIndex[12] = { 3, 3, 3, 0, 0, 2, 2, 1, 2, 2, 3, 3};
|
|
|
static int iconIndex[12] = {-1, -1, -1, 0, 0, 1, 2, -1, 1, 1, -1, -1};
|
|
|
|
|
|
- picture = new CAnimImage(town->town->clientInfo.buildingsIcons, building->bid, 0, 2, 2);
|
|
|
- panel = new CAnimImage("TPTHBAR", panelIndex[state], 0, 1, 73);
|
|
|
- if ( iconIndex[state] >=0 )
|
|
|
- icon = new CAnimImage("TPTHCHK", iconIndex[state], 0, 136, 56);
|
|
|
- label = new CLabel(75, 81, FONT_SMALL, CENTER, Colors::WHITE, building->Name());
|
|
|
+ new CAnimImage(town->town->clientInfo.buildingsIcons, building->bid, 0, 2, 2);
|
|
|
+ new CAnimImage("TPTHBAR", panelIndex[state], 0, 1, 73);
|
|
|
+ if (iconIndex[state] >=0)
|
|
|
+ new CAnimImage("TPTHCHK", iconIndex[state], 0, 136, 56);
|
|
|
+ new CLabel(75, 81, FONT_SMALL, CENTER, Colors::WHITE, building->Name());
|
|
|
|
|
|
//todo: add support for all possible states
|
|
|
if(state >= EBuildingState::BUILDING_ERROR)
|
|
@@ -1427,12 +1430,12 @@ CBuildWindow::CBuildWindow(const CGTownInstance *Town, const CBuilding * Buildin
|
|
|
std::string tooltipYes = boost::str(boost::format(CGI->generaltexth->allTexts[595]) % building->Name());
|
|
|
std::string tooltipNo = boost::str(boost::format(CGI->generaltexth->allTexts[596]) % building->Name());
|
|
|
|
|
|
- buy = new CButton(Point(45, 446), "IBUY30", CButton::tooltip(tooltipYes), [&]{ buyFunc(); }, SDLK_RETURN);
|
|
|
+ CButton * buy = new CButton(Point(45, 446), "IBUY30", CButton::tooltip(tooltipYes), [&]{ buyFunc(); }, SDLK_RETURN);
|
|
|
buy->borderColor = Colors::METALLIC_GOLD;
|
|
|
+ buy->block(state!=7 || LOCPLINT->playerID != town->tempOwner);
|
|
|
|
|
|
- cancel = new CButton(Point(290, 445), "ICANCEL", CButton::tooltip(tooltipNo), [&] { close();}, SDLK_ESCAPE);
|
|
|
+ CButton * cancel = new CButton(Point(290, 445), "ICANCEL", CButton::tooltip(tooltipNo), [&] { close();}, SDLK_ESCAPE);
|
|
|
cancel->borderColor = Colors::METALLIC_GOLD;
|
|
|
- buy->block(state!=7 || LOCPLINT->playerID != town->tempOwner);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1597,10 +1600,11 @@ CFortScreen::RecruitArea::RecruitArea(int posX, int posY, const CGTownInstance *
|
|
|
addUsedEvents(LCLICK | RCLICK | HOVER);//Activate only if dwelling is present
|
|
|
|
|
|
icons = new CPicture("TPCAINFO", 261, 3);
|
|
|
+
|
|
|
if (getMyBuilding() != nullptr)
|
|
|
{
|
|
|
- buildingPic = new CAnimImage(town->town->clientInfo.buildingsIcons, getMyBuilding()->bid, 0, 4, 21);
|
|
|
- dwellingName = new CLabel(78, 101, FONT_SMALL, CENTER, Colors::WHITE, getMyBuilding()->Name());
|
|
|
+ new CAnimImage(town->town->clientInfo.buildingsIcons, getMyBuilding()->bid, 0, 4, 21);
|
|
|
+ new CLabel(78, 101, FONT_SMALL, CENTER, Colors::WHITE, getMyBuilding()->Name());
|
|
|
|
|
|
if (vstd::contains(town->builtBuildings, getMyBuilding()->bid))
|
|
|
{
|
|
@@ -1613,8 +1617,8 @@ CFortScreen::RecruitArea::RecruitArea(int posX, int posY, const CGTownInstance *
|
|
|
if (getMyCreature() != nullptr)
|
|
|
{
|
|
|
hoverText = boost::str(boost::format(CGI->generaltexth->tcommands[21]) % getMyCreature()->namePl);
|
|
|
- creatureAnim = new CCreaturePic(159, 4, getMyCreature(), false);
|
|
|
- creatureName = new CLabel(78, 11, FONT_SMALL, CENTER, Colors::WHITE, getMyCreature()->namePl);
|
|
|
+ new CCreaturePic(159, 4, getMyCreature(), false);
|
|
|
+ new CLabel(78, 11, FONT_SMALL, CENTER, Colors::WHITE, getMyCreature()->namePl);
|
|
|
|
|
|
Rect sizes(287, 4, 96, 18);
|
|
|
values.push_back(new LabeledValue(sizes, CGI->generaltexth->allTexts[190], CGI->generaltexth->fcommands[0], getMyCreature()->Attack()));
|