1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-30 08:57:00 +02:00
vcmi/hch/CTownHandler.h
Michał W. Urbańczyk fe5bcc19cf * redone def info handling
* redone randomization (mam nadziemę, że będzie toto działać)
* no more cheating pathfinder
* minor improvements
* version changed to 0.52
2008-02-05 03:56:45 +00:00

59 lines
1.2 KiB
C++

#ifndef CTOWNHANDLER_H
#define CTOWNHANDLER_H
#include "CDefHandler.h"
#include "CCreatureHandler.h"
#include "SDL.h"
#include "../int3.h"
#include <string>
#include <vector>
class CBuilding;
class CSpell;
class CHero;
class CGTownInstance;
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
int bonus; //pic number
int typeID;
};
struct Structure
{
int ID;
int3 pos;
std::string defName, borderName, areaName, name;
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);
}
};
class CTownHandler
{
CDefHandler * smallIcons;
public:
CTownHandler();
~CTownHandler();
std::vector<CTown> towns;
std::vector<std::string> tcommands;
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);
std::map<int,std::map<int, Structure*> > structures; // <town ID, <structure ID, structure>>
std::vector<CGTownInstance *> townInstances;
};
#endif //CTOWNHANDLER_H