2008-01-10 21:01:25 +02:00
|
|
|
#pragma once
|
2008-01-09 19:21:31 +02:00
|
|
|
#include "global.h"
|
|
|
|
#include "SDL.h"
|
|
|
|
#include "CPlayerInterface.h"
|
2008-01-19 13:55:04 +02:00
|
|
|
//#include "boost/tuple/tuple.hpp"
|
2008-01-09 19:21:31 +02:00
|
|
|
class CGTownInstance;
|
2008-01-15 23:38:01 +02:00
|
|
|
class CTownHandler;
|
|
|
|
struct Structure;
|
2008-01-09 19:21:31 +02:00
|
|
|
template <typename T> class AdventureMapButton;
|
2008-01-24 00:15:33 +02:00
|
|
|
class CBuildingRect : public Hoverable, public MotionInterested, public ClickableL, public ClickableR//, public TimeInterested
|
2008-01-09 19:21:31 +02:00
|
|
|
{
|
2008-01-19 13:55:04 +02:00
|
|
|
public:
|
|
|
|
Structure* str;
|
|
|
|
CDefHandler* def;
|
|
|
|
SDL_Surface* border;
|
|
|
|
SDL_Surface* area;
|
|
|
|
CBuildingRect(Structure *Str);
|
|
|
|
~CBuildingRect();
|
2008-01-09 19:21:31 +02:00
|
|
|
void activate();
|
|
|
|
void deactivate();
|
2008-01-19 13:55:04 +02:00
|
|
|
bool operator<(const CBuildingRect & p2) const;
|
2008-01-20 18:24:03 +02:00
|
|
|
void hover(bool on);
|
2008-01-19 13:55:04 +02:00
|
|
|
void clickLeft (tribool down);
|
|
|
|
void clickRight (tribool down);
|
2008-01-24 00:15:33 +02:00
|
|
|
void mouseMoved (SDL_MouseMotionEvent & sEvent);
|
2008-01-09 19:21:31 +02:00
|
|
|
};
|
|
|
|
|
2008-01-20 14:34:39 +02:00
|
|
|
class CCastleInterface : public IShowable, public IActivable
|
2008-01-09 19:21:31 +02:00
|
|
|
{
|
|
|
|
public:
|
2008-01-24 00:15:33 +02:00
|
|
|
CBuildingRect * hBuild; //highlighted building
|
2008-01-09 19:21:31 +02:00
|
|
|
SDL_Surface * townInt;
|
|
|
|
SDL_Surface * cityBg;
|
|
|
|
const CGTownInstance * town;
|
2008-01-27 22:37:10 +02:00
|
|
|
CStatusBar * statusbar;
|
2008-01-09 19:21:31 +02:00
|
|
|
|
2008-01-19 14:26:55 +02:00
|
|
|
unsigned char animval, count;
|
|
|
|
|
2008-02-18 23:14:28 +02:00
|
|
|
CDefHandler *hall,*fort, *flag;
|
2008-03-06 20:54:35 +02:00
|
|
|
CDefEssential* bicons; //150x70 buildings imgs
|
2008-01-31 23:35:30 +02:00
|
|
|
CTownList<CCastleInterface> * townlist;
|
|
|
|
|
2008-01-26 21:36:31 +02:00
|
|
|
CGarrisonInt * garr;
|
2008-01-30 00:47:43 +02:00
|
|
|
AdventureMapButton<CCastleInterface> * exit, *split;
|
2008-01-09 19:21:31 +02:00
|
|
|
|
2008-01-19 13:55:04 +02:00
|
|
|
std::vector<CBuildingRect*> buildings; //building id, building def, structure struct, border, filling
|
2008-01-15 23:38:01 +02:00
|
|
|
|
2008-01-09 19:21:31 +02:00
|
|
|
CCastleInterface(const CGTownInstance * Town, bool Activate=true);
|
|
|
|
~CCastleInterface();
|
2008-01-31 23:35:30 +02:00
|
|
|
void townChange();
|
2008-01-19 14:26:55 +02:00
|
|
|
void show(SDL_Surface * to=NULL);
|
|
|
|
void showAll(SDL_Surface * to=NULL);
|
2008-03-10 01:06:35 +02:00
|
|
|
void buildingClicked(int building);
|
|
|
|
void enterHall();
|
2008-01-09 19:21:31 +02:00
|
|
|
void close();
|
2008-01-30 00:47:43 +02:00
|
|
|
void splitF();
|
2008-01-09 19:21:31 +02:00
|
|
|
void activate();
|
|
|
|
void deactivate();
|
2008-03-10 01:06:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class CHallInterface : public IShowable, public IActivable
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
class CResDataBar : public IShowable, public CIntObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SDL_Surface *bg;
|
|
|
|
void show(SDL_Surface * to=NULL);
|
|
|
|
CResDataBar();
|
|
|
|
~CResDataBar();
|
|
|
|
} resdatabar;
|
|
|
|
|
|
|
|
class CBuildingBox : public Hoverable, public ClickableL, public ClickableR
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int ID;
|
|
|
|
int state;//(-1) - forbidden in this town, 0 - possible, 1 - lack of res, 2 - requirements/buildings per turn limit, (3) - already exists
|
|
|
|
void hover(bool on);
|
|
|
|
void clickLeft (tribool down);
|
|
|
|
void clickRight (tribool down);
|
|
|
|
void activate();
|
|
|
|
void deactivate();
|
|
|
|
~CBuildingBox();
|
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<CBuildingBox*> boxes[5];
|
|
|
|
|
|
|
|
AdventureMapButton<CHallInterface> * exit;
|
|
|
|
|
|
|
|
SDL_Surface * bg;
|
|
|
|
|
|
|
|
|
|
|
|
CHallInterface(CCastleInterface * owner);
|
|
|
|
~CHallInterface();
|
|
|
|
void close();
|
|
|
|
void show(SDL_Surface * to=NULL);
|
|
|
|
void activate();
|
|
|
|
void deactivate();
|
2008-01-09 19:21:31 +02:00
|
|
|
};
|