mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
* added Necropolis
* townlist in town screen and switching towns * minor changes
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
#include "hch/CTownHandler.h"
|
||||
#include "AdventureMapButton.h"
|
||||
#include <sstream>
|
||||
|
||||
CBuildingRect::CBuildingRect(Structure *Str)
|
||||
:str(Str)
|
||||
{
|
||||
@@ -151,23 +150,32 @@ public:
|
||||
} srthlp ;
|
||||
|
||||
CCastleInterface::CCastleInterface(const CGTownInstance * Town, bool Activate)
|
||||
{
|
||||
hBuild = NULL;
|
||||
count=0;
|
||||
town = Town;
|
||||
{
|
||||
townInt = CGI->bitmaph->loadBitmap("TOWNSCRN.bmp");
|
||||
cityBg = CGI->bitmaph->loadBitmap(getBgName(town->subID));
|
||||
cityBg = CGI->bitmaph->loadBitmap(getBgName(Town->subID));
|
||||
hall = CGI->spriteh->giveDef("ITMTL.DEF");
|
||||
fort = CGI->spriteh->giveDef("ITMCL.DEF");
|
||||
bigTownPic = CGI->spriteh->giveDef("ITPT.DEF");
|
||||
flag = CGI->spriteh->giveDef("CREST58.DEF");
|
||||
CSDL_Ext::blueToPlayersAdv(townInt,LOCPLINT->playerID);
|
||||
townlist = new CTownList<CCastleInterface>(3,&genRect(128,48,744,414),744,414,744,526);
|
||||
exit = new AdventureMapButton<CCastleInterface>
|
||||
(CGI->townh->tcommands[8],"",&CCastleInterface::close,744,544,"TSBTNS.DEF",this,false);
|
||||
split = new AdventureMapButton<CCastleInterface>
|
||||
(CGI->townh->tcommands[8],"",&CCastleInterface::splitF,744,382,"TSBTNS.DEF",this,false);
|
||||
exit->bitmapOffset = 4;
|
||||
(CGI->townh->tcommands[3],"",&CCastleInterface::splitF,744,382,"TSBTNS.DEF",this,false);
|
||||
statusbar = new CStatusBar(8,555,"TSTATBAR.bmp",732);
|
||||
|
||||
townlist->owner = this;
|
||||
townlist->fun = &CCastleInterface::townChange;
|
||||
townlist->genList();
|
||||
townlist->selected = getIndexOf(townlist->items,Town);
|
||||
if((townlist->selected+1) > townlist->SIZE)
|
||||
townlist->from = townlist->selected - townlist->SIZE + 1;
|
||||
hBuild = NULL;
|
||||
count=0;
|
||||
town = Town;
|
||||
|
||||
CSDL_Ext::blueToPlayersAdv(townInt,LOCPLINT->playerID);
|
||||
exit->bitmapOffset = 4;
|
||||
std::set< std::pair<int,int> > s; //group - id
|
||||
|
||||
|
||||
@@ -251,6 +259,8 @@ CCastleInterface::~CCastleInterface()
|
||||
delete bigTownPic;
|
||||
delete flag;
|
||||
delete garr;
|
||||
delete townlist;
|
||||
delete statusbar;
|
||||
for(int i=0;i<buildings.size();i++)
|
||||
{
|
||||
delete buildings[i];
|
||||
@@ -276,6 +286,7 @@ void CCastleInterface::showAll(SDL_Surface * to)
|
||||
blitAt(cityBg,0,0,to);
|
||||
blitAt(townInt,0,374,to);
|
||||
LOCPLINT->adventureInt->resdatabar.draw();
|
||||
townlist->draw();
|
||||
|
||||
int pom;
|
||||
|
||||
@@ -353,6 +364,14 @@ void CCastleInterface::showAll(SDL_Surface * to)
|
||||
//}
|
||||
show();
|
||||
}
|
||||
void CCastleInterface::townChange()
|
||||
{
|
||||
const CGTownInstance * nt = townlist->items[townlist->selected];
|
||||
deactivate();
|
||||
LOCPLINT->objsToBlit.erase(std::find(LOCPLINT->objsToBlit.begin(),LOCPLINT->objsToBlit.end(),this));
|
||||
delete this;
|
||||
LOCPLINT->castleInt = new CCastleInterface(nt,true);
|
||||
}
|
||||
void CCastleInterface::show(SDL_Surface * to)
|
||||
{
|
||||
if (!to)
|
||||
@@ -393,6 +412,7 @@ void CCastleInterface::show(SDL_Surface * to)
|
||||
}
|
||||
void CCastleInterface::activate()
|
||||
{
|
||||
townlist->activate();
|
||||
garr->activate();
|
||||
LOCPLINT->curint = this;
|
||||
LOCPLINT->statusbar = statusbar;
|
||||
@@ -403,6 +423,7 @@ void CCastleInterface::activate()
|
||||
}
|
||||
void CCastleInterface::deactivate()
|
||||
{
|
||||
townlist->deactivate();
|
||||
garr->deactivate();
|
||||
exit->deactivate();
|
||||
split->deactivate();
|
||||
|
||||
Reference in New Issue
Block a user