mapHandler.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef MAPHANDLER_H
  2. #define MAPHANDLER_H
  3. #include "CAmbarCendamo.h"
  4. #include "CSemiDefHandler.h"
  5. #include "CGameInfo.h"
  6. #include "CDefHandler.h"
  7. #include <boost/logic/tribool.hpp>
  8. const int Woff = 4; //width of map's frame
  9. const int Hoff = 4;
  10. struct TerrainTile2
  11. {
  12. int3 pos;
  13. EterrainType typ;
  14. Eroad malle;
  15. unsigned char roaddir;
  16. Eriver nuine;
  17. unsigned char rivdir;
  18. std::vector<SDL_Surface *> terbitmap; //frames of animation
  19. std::vector<SDL_Surface *> rivbitmap; //frames of animation
  20. std::vector<SDL_Surface *> roadbitmap; //frames of animation
  21. boost::logic::tribool state; //false = free; true = blocked; middle = visitable
  22. std::vector < std::pair<CObjectInstance*,SDL_Rect> > objects;
  23. std::vector <CObjectInstance*> visitableObjects;
  24. };
  25. //pathfinder
  26. // map<int,int> iDTerenu=>koszt_pola
  27. // map<int,int> IDdrogi=>koszt_drogi
  28. class CMapHandler
  29. {
  30. public:
  31. std::vector< std::vector< std::vector<TerrainTile2> > > ttiles;
  32. CAmbarCendamo * reader;
  33. SDL_Surface * terrainRect(int x, int y, int dx, int dy, int level=0, unsigned char anim=0);
  34. SDL_Surface * terrBitmap(int x, int y);
  35. SDL_Surface * undTerrBitmap(int x, int y);
  36. CDefHandler * fullHide;
  37. CDefHandler * partialHide;
  38. std::vector< std::vector<char> > visibility; //true means that pointed place is visible
  39. std::vector< std::vector<char> > undVisibility; //true means that pointed place is visible
  40. std::vector<CDefHandler *> roadDefs;
  41. std::vector<CDefHandler *> staticRiverDefs;
  42. char & visAccess(int x, int y);
  43. char & undVisAccess(int x, int y);
  44. SDL_Surface mirrorImage(SDL_Surface *src); //what is this??
  45. SDL_Surface * getVisBitmap(int x, int y, std::vector< std::vector<char> > & visibility);
  46. void init();
  47. };
  48. #endif //MAPHANDLER_H