VCMI_Lib.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #pragma once
  2. /*
  3. * VCMI_Lib.h, part of VCMI engine
  4. *
  5. * Authors: listed in file AUTHORS in main folder
  6. *
  7. * License: GNU General Public License v2.0 or later
  8. * Full text of license available in license.txt file, in main folder
  9. *
  10. */
  11. class CArtHandler;
  12. class CHeroHandler;
  13. class CCreatureHandler;
  14. class CSpellHandler;
  15. class CBuildingHandler;
  16. class CObjectHandler;
  17. class CDefObjInfoHandler;
  18. class CTownHandler;
  19. class CGeneralTextHandler;
  20. /// Loads and constructs several handlers
  21. class DLL_LINKAGE LibClasses
  22. {
  23. public:
  24. bool IS_AI_ENABLED; //VLC is the only object visible from both CMT and GeniusAI
  25. CArtHandler * arth;
  26. CHeroHandler * heroh;
  27. CCreatureHandler * creh;
  28. CSpellHandler * spellh;
  29. CBuildingHandler * buildh;
  30. CObjectHandler * objh;
  31. CDefObjInfoHandler * dobjinfo;
  32. CTownHandler * townh;
  33. CGeneralTextHandler * generaltexth;
  34. LibClasses(); //c-tor, loads .lods and NULLs handlers
  35. ~LibClasses();
  36. void init(); //uses standard config file
  37. void clear(); //deletes all handlers and its data
  38. void makeNull(); //sets all handler (except of lodhs) pointers to null
  39. static void loadFilesystem();
  40. void callWhenDeserializing(); //should be called only by serialize !!!
  41. template <typename Handler> void serialize(Handler &h, const int version)
  42. {
  43. h & heroh & arth & creh & townh & objh & dobjinfo & buildh & spellh & IS_AI_ENABLED;;
  44. if(!h.saving)
  45. {
  46. callWhenDeserializing();
  47. }
  48. }
  49. };
  50. extern DLL_LINKAGE LibClasses * VLC;
  51. DLL_LINKAGE void loadToIt(std::string &dest, const std::string &src, int &iter, int mode);
  52. DLL_LINKAGE void loadToIt(si32 &dest, const std::string &src, int &iter, int mode);
  53. DLL_LINKAGE void initDLL(CConsoleHandler *Console, std::ostream *Logfile);