VCMI_Lib.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. CObjectHandler * objh;
  31. CDefObjInfoHandler * dobjinfo;
  32. CTownHandler * townh;
  33. CGeneralTextHandler * generaltexth;
  34. CModHandler * modh;
  35. LibClasses(); //c-tor, loads .lods and NULLs handlers
  36. ~LibClasses();
  37. void init(); //uses standard config file
  38. void clear(); //deletes all handlers and its data
  39. void makeNull(); //sets all handler pointers to null
  40. void loadFilesystem();// basic initialization. should be called before init()
  41. void callWhenDeserializing(); //should be called only by serialize !!!
  42. template <typename Handler> void serialize(Handler &h, const int version)
  43. {
  44. h & heroh & arth & creh & townh & objh & dobjinfo & spellh & modh & IS_AI_ENABLED;;
  45. if(!h.saving)
  46. {
  47. callWhenDeserializing();
  48. }
  49. }
  50. };
  51. extern DLL_LINKAGE LibClasses * VLC;
  52. DLL_LINKAGE void preinitDLL(CConsoleHandler *Console, std::ostream *Logfile);
  53. DLL_LINKAGE void loadDLLClasses();