#ifndef CTOWNHANDLER_H #define CTOWNHANDLER_H #include "CDefHandler.h" #include "CCreatureHandler.h" #include "SDL.h" #include "../int3.h" #include #include #include class CBuilding; class CSpell; class CHero; class CGTownInstance; class CTown { public: std::string name; //name of type std::vector names; //names of the town instances std::vector basicCreatures; //level (from 0) -> ID std::vector upgradedCreatures; //level (from 0) -> ID std::map hordeLvl; //[0] - first horde building creature level; [1] - second horde building (-1 if not present) 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 { public: CDefHandler * smallIcons, *resources; //resources 32x32 CTownHandler(); ~CTownHandler(); std::vector towns; std::vector tcommands, hcommands; 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 > structures; // > std::map > > requirements; //requirements[town_id][structure_id] -> set of required buildings std::vector townInstances; }; #endif //CTOWNHANDLER_H