1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-26 08:41:13 +02:00

get rid of CCastleInterface::bicons

This commit is contained in:
AlexVinS 2016-10-16 03:00:57 +03:00
parent 153af6e07b
commit 41a5cc1b69
2 changed files with 16 additions and 22 deletions

View File

@ -783,8 +783,8 @@ void CCastleBuildings::enterCastleGate()
availableTowns.push_back(t->id.getNum());//add to the list
}
}
auto titlePic = new CPicture (LOCPLINT->castleInt->bicons->ourImages[BuildingID::CASTLE_GATE].bitmap, 0,0, false);//will be deleted by selection window
GH.pushInt (new CObjectListWindow(availableTowns, titlePic, CGI->generaltexth->jktexts[40],
auto gateIcon = new CAnimImage(town->town->clientInfo.buildingsIcons, BuildingID::CASTLE_GATE);//will be deleted by selection window
GH.pushInt (new CObjectListWindow(availableTowns, gateIcon, CGI->generaltexth->jktexts[40],
CGI->generaltexth->jktexts[41], std::bind (&CCastleInterface::castleTeleport, LOCPLINT->castleInt, _1)));
}
@ -923,14 +923,11 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, const CGTownInst
recreateIcons();
CCS->musich->playMusic(town->town->clientInfo.musicTheme, true);
bicons = CDefHandler::giveDefEss(town->town->clientInfo.buildingsIcons);
}
CCastleInterface::~CCastleInterface()
{
LOCPLINT->castleInt = nullptr;
delete bicons;
}
void CCastleInterface::close()
@ -1476,7 +1473,7 @@ CFortScreen::CFortScreen(const CGTownInstance * town):
{
positions.push_back(Point(10, 421));
positions.push_back(Point(404,421));
}
}
for (ui32 i=0; i<fortSize; i++)
{
@ -1677,7 +1674,7 @@ CMageGuildScreen::CMageGuildScreen(CCastleInterface * owner,std::string imagem)
exit = new CButton(Point(748, 556), "TPMAGE1.DEF", CButton::tooltip(CGI->generaltexth->allTexts[593]), [&]{ close(); }, SDLK_RETURN);
exit->assignedKeys.insert(SDLK_ESCAPE);
static const std::vector<std::vector<Point> > positions =
static const std::vector<std::vector<Point> > positions =
{
{Point(222,445), Point(312,445), Point(402,445), Point(520,445), Point(610,445), Point(700,445)},
{Point(48,53), Point(48,147), Point(48,241), Point(48,335), Point(48,429)},

View File

@ -45,9 +45,9 @@ public:
const CStructure* str;
SDL_Surface* border;
SDL_Surface* area;
ui32 stateCounter;//For building construction - current stage in animation
CBuildingRect(CCastleBuildings * Par, const CGTownInstance *Town, const CStructure *Str); //c-tor
~CBuildingRect(); //d-tor
bool operator<(const CBuildingRect & p2) const;
@ -66,7 +66,7 @@ class CDwellingInfoBox : public CWindowObject
CCreaturePic *animation;
CLabel *available;
CLabel *costPerTroop;
std::vector<CAnimImage *> resPicture;
std::vector<CLabel *> resAmount;
public:
@ -84,7 +84,7 @@ public:
CAnimImage *image;
CAnimImage *selection; //selection border. nullptr if not selected
void setHighlight(bool on);
void set(const CGHeroInstance *newHero);
@ -149,7 +149,7 @@ public:
void buildingClicked(BuildingID building);
void addBuilding(BuildingID building);
void removeBuilding(BuildingID building);//FIXME: not tested!!!
void show(SDL_Surface * to) override;
void showAll(SDL_Surface * to) override;
};
@ -161,16 +161,16 @@ class CCreaInfo : public CIntObject
const CCreature *creature;
int level;
bool showAvailable;
CAnimImage *picture;
CLabel * label;
int AddToString(std::string from, std::string & to, int numb);
std::string genGrowthText();
public:
CCreaInfo(Point position, const CGTownInstance *Town, int Level, bool compact=false, bool showAvailable=false);
void update();
void hover(bool on) override;
void clickLeft(tribool down, bool previousState) override;
@ -186,7 +186,7 @@ class CTownInfo : public CIntObject
public:
//if (townHall) hall-capital else fort - castle
CTownInfo(int posX, int posY, const CGTownInstance* town, bool townHall);
void hover(bool on) override;
void clickRight(tribool down, bool previousState) override;
};
@ -212,9 +212,6 @@ class CCastleInterface : public CWindowObject, public CWindowWithGarrison
public:
CTownList * townlist;
//TODO: remove - currently used only in dialog messages
CDefEssential* bicons; //150x70 buildings imgs
//TODO: move to private
const CGTownInstance * town;
HeroSlots *heroes;
@ -256,7 +253,7 @@ class CHallInterface : public CWindowObject
void clickRight(tribool down, bool previousState) override;
};
const CGTownInstance * town;
std::vector< std::vector<CBuildingBox*> >boxes;
CLabel *title;
CGStatusBar *statusBar;
@ -283,7 +280,7 @@ public:
CBuildWindow(const CGTownInstance *Town, const CBuilding * building, int State, bool rightClick); //c-tor
};
//Small class to display
//Small class to display
class LabeledValue : public CIntObject
{
std::string hoverText;
@ -319,7 +316,7 @@ class CFortScreen : public CWindowObject
const CBuilding * getMyBuilding();
public:
RecruitArea(int posX, int posY, const CGTownInstance *town, int level);
void creaturesChanged();
void hover(bool on) override;
void clickLeft(tribool down, bool previousState) override;