1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00
vcmi/hch/CTownHandler.h

61 lines
1.6 KiB
C
Raw Normal View History

2007-07-26 15:00:18 +03:00
#ifndef CTOWNHANDLER_H
#define CTOWNHANDLER_H
2007-07-26 15:00:18 +03:00
#include "CDefHandler.h"
#include "CCreatureHandler.h"
2007-07-26 15:00:18 +03:00
#include "SDL.h"
#include "../int3.h"
2007-07-26 15:00:18 +03:00
#include <string>
#include <vector>
#include <set>
class CBuilding;
class CSpell;
class CHero;
class CGTownInstance;
2007-07-26 15:00:18 +03:00
class CTown
{
public:
std::string name; //name of type
std::vector<std::string> names; //names of the town instances
std::vector<int> basicCreatures; //level (from 0) -> ID
std::vector<int> upgradedCreatures; //level (from 0) -> ID
std::map<int,int> hordeLvl; //[0] - first horde building creature level; [1] - second horde building (-1 if not present)
2007-07-26 15:00:18 +03:00
int bonus; //pic number
int typeID;
2007-07-26 15:00:18 +03:00
};
struct Structure
{
int ID;
int3 pos;
std::string defName, borderName, areaName, name;
2008-01-27 15:18:18 +02:00
int townID, group;
bool operator<(const Structure & p2) const
{
if(pos.z != p2.pos.z)
return (pos.z) < (p2.pos.z);
else
return (ID) < (p2.ID);
}
};
2007-07-26 15:00:18 +03:00
class CTownHandler
{
public:
2008-03-21 02:03:31 +02:00
CDefHandler * smallIcons, *resources; //resources 32x32
2007-07-26 15:00:18 +03:00
CTownHandler();
~CTownHandler();
std::vector<CTown> towns;
2008-03-11 23:36:59 +02:00
std::vector<std::string> tcommands, hcommands;
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
static int getTypeByDefName(std::string name);
2008-01-27 15:18:18 +02:00
std::map<int,std::map<int, Structure*> > structures; // <town ID, <structure ID, structure>>
std::map<int, std::map<int,std::set<int> > > requirements; //requirements[town_id][structure_id] -> set of required buildings
std::vector<CGTownInstance *> townInstances;
2007-07-26 15:00:18 +03:00
};
2007-07-26 15:00:18 +03:00
#endif //CTOWNHANDLER_H