VCMI_Lib.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. class CModHandler;
  21. /// Loads and constructs several handlers
  22. class DLL_LINKAGE LibClasses
  23. {
  24. public:
  25. bool IS_AI_ENABLED; //VLC is the only object visible from both CMT and GeniusAI
  26. CArtHandler * arth;
  27. CHeroHandler * heroh;
  28. CCreatureHandler * creh;
  29. CSpellHandler * spellh;
  30. CBuildingHandler * buildh;
  31. CObjectHandler * objh;
  32. CDefObjInfoHandler * dobjinfo;
  33. CTownHandler * townh;
  34. CGeneralTextHandler * generaltexth;
  35. CModHandler * modh;
  36. LibClasses(); //c-tor, loads .lods and NULLs handlers
  37. ~LibClasses();
  38. void init(); //uses standard config file
  39. void clear(); //deletes all handlers and its data
  40. void makeNull(); //sets all handler (except of lodhs) pointers to null
  41. static void loadFilesystem();
  42. void callWhenDeserializing(); //should be called only by serialize !!!
  43. template <typename Handler> void serialize(Handler &h, const int version)
  44. {
  45. h & heroh & arth & creh & townh & objh & dobjinfo & buildh & spellh & modh & IS_AI_ENABLED;;
  46. if(!h.saving)
  47. {
  48. callWhenDeserializing();
  49. }
  50. }
  51. };
  52. extern DLL_LINKAGE LibClasses * VLC;
  53. DLL_LINKAGE void loadToIt(std::string &dest, const std::string &src, int &iter, int mode);
  54. DLL_LINKAGE void loadToIt(si32 &dest, const std::string &src, int &iter, int mode);
  55. DLL_LINKAGE void initDLL(CConsoleHandler *Console, std::ostream *Logfile);