2007-07-26 15:00:18 +03:00
|
|
|
#ifndef CTOWNHANDLER_H
|
|
|
|
#define CTOWNHANDLER_H
|
2007-09-05 18:56:35 +03:00
|
|
|
|
2007-07-26 15:00:18 +03:00
|
|
|
#include "CDefHandler.h"
|
2007-07-29 02:01:25 +03:00
|
|
|
#include "CCreatureHandler.h"
|
2007-07-26 15:00:18 +03:00
|
|
|
#include "SDL.h"
|
2007-08-30 13:11:53 +03:00
|
|
|
#include "../int3.h"
|
2007-07-26 15:00:18 +03:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2007-09-05 18:56:35 +03:00
|
|
|
|
|
|
|
class CBuilding;
|
|
|
|
class CSpell;
|
|
|
|
class CHero;
|
2007-09-18 16:30:26 +03:00
|
|
|
class CTownInstance;
|
2007-10-27 22:38:48 +03:00
|
|
|
class CGTownInstance;
|
2008-01-09 19:21:31 +02:00
|
|
|
class CHeroInstance;
|
2007-07-26 15:00:18 +03:00
|
|
|
class CTown
|
|
|
|
{
|
|
|
|
public:
|
2007-09-16 20:21:23 +03:00
|
|
|
std::string name; //name of type
|
|
|
|
std::vector<std::string> names; //names of the town instances
|
2007-07-26 15:00:18 +03:00
|
|
|
int bonus; //pic number
|
2007-10-14 15:11:18 +03:00
|
|
|
int typeID;
|
2007-07-26 15:00:18 +03:00
|
|
|
};
|
2007-09-05 18:56:35 +03:00
|
|
|
|
2008-01-15 23:38:01 +02:00
|
|
|
struct Structure
|
|
|
|
{
|
2008-01-19 13:55:04 +02:00
|
|
|
int ID;
|
|
|
|
int3 pos;
|
2008-01-20 18:24:03 +02:00
|
|
|
std::string defName, borderName, areaName;
|
2008-01-27 15:18:18 +02:00
|
|
|
int townID, group;
|
2008-01-15 23:38:01 +02:00
|
|
|
};
|
|
|
|
|
2007-07-26 15:00:18 +03:00
|
|
|
class CTownHandler
|
|
|
|
{
|
|
|
|
CDefHandler * smallIcons;
|
|
|
|
public:
|
|
|
|
CTownHandler();
|
|
|
|
~CTownHandler();
|
|
|
|
std::vector<CTown> towns;
|
2008-01-09 19:21:31 +02:00
|
|
|
std::vector<std::string> tcommands;
|
2007-07-26 15:00:18 +03:00
|
|
|
void loadNames();
|
|
|
|
SDL_Surface * getPic(int ID, bool fort=true, bool builded=false); //ID=-1 - blank; -2 - border; -3 - random
|
2007-09-05 18:56:35 +03:00
|
|
|
static int getTypeByDefName(std::string name);
|
2007-09-18 16:30:26 +03:00
|
|
|
|
2008-01-27 15:18:18 +02:00
|
|
|
std::map<int,std::map<int, Structure*> > structures; // <town ID, <structure ID, structure>>
|
2008-01-15 23:38:01 +02:00
|
|
|
|
|
|
|
|
2007-10-27 22:38:48 +03:00
|
|
|
std::vector<CGTownInstance *> townInstances;
|
2007-09-18 16:30:26 +03:00
|
|
|
|
2007-07-26 15:00:18 +03:00
|
|
|
};
|
2007-09-05 18:56:35 +03:00
|
|
|
|
2007-07-28 18:23:15 +03:00
|
|
|
class CTownInstance
|
|
|
|
{
|
2007-09-05 18:56:35 +03:00
|
|
|
public:
|
2007-07-29 02:01:25 +03:00
|
|
|
int3 pos; //position
|
|
|
|
CTown * town;
|
|
|
|
std::string name; // name of town
|
|
|
|
CCreatureSet garrison;
|
|
|
|
int builded; //how many buildings has been built this turn
|
|
|
|
int destroyed; //how many buildings has been destroyed this turn
|
|
|
|
|
|
|
|
//TODO:
|
2008-01-09 19:21:31 +02:00
|
|
|
std::vector<CBuilding *> /*allBuildings,*/ possibleBuildings, builtBuildings;
|
2007-09-05 18:56:35 +03:00
|
|
|
std::vector<int> creatureIncome; //vector by level
|
|
|
|
std::vector<int> creaturesLeft; //that can be recruited
|
|
|
|
|
2008-01-09 19:21:31 +02:00
|
|
|
CHeroInstance * garrisonHero;
|
2007-09-05 18:56:35 +03:00
|
|
|
|
|
|
|
std::vector<CSpell *> possibleSpells, obligatorySpells, availableSpells;
|
2007-10-14 15:11:18 +03:00
|
|
|
|
2007-10-17 23:05:49 +03:00
|
|
|
int getSightDistance() const; //returns sight distance
|
|
|
|
|
2007-10-14 15:11:18 +03:00
|
|
|
CTownInstance();
|
2007-07-28 18:23:15 +03:00
|
|
|
};
|
2007-09-05 18:56:35 +03:00
|
|
|
|
2007-07-26 15:00:18 +03:00
|
|
|
#endif //CTOWNHANDLER_H
|