VCMI_Lib.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. class IBonusTypeHandler;
  22. class CBonusTypeHandler;
  23. class CTerrainViewPatternConfig;
  24. class CRmgTemplateStorage;
  25. /// Loads and constructs several handlers
  26. class DLL_LINKAGE LibClasses
  27. {
  28. CBonusTypeHandler * bth;
  29. void callWhenDeserializing(); //should be called only by serialize !!!
  30. void makeNull(); //sets all handler pointers to null
  31. public:
  32. bool IS_AI_ENABLED; //VLC is the only object visible from both CMT and GeniusAI
  33. const IBonusTypeHandler * getBth() const;
  34. CArtHandler * arth;
  35. CHeroHandler * heroh;
  36. CCreatureHandler * creh;
  37. CSpellHandler * spellh;
  38. CObjectHandler * objh;
  39. CDefObjInfoHandler * dobjinfo;
  40. CTownHandler * townh;
  41. CGeneralTextHandler * generaltexth;
  42. CModHandler * modh;
  43. CTerrainViewPatternConfig * terviewh;
  44. CRmgTemplateStorage * tplh;
  45. LibClasses(); //c-tor, loads .lods and NULLs handlers
  46. ~LibClasses();
  47. void init(); //uses standard config file
  48. void clear(); //deletes all handlers and its data
  49. void loadFilesystem();// basic initialization. should be called before init()
  50. template <typename Handler> void serialize(Handler &h, const int version)
  51. {
  52. h & heroh & arth & creh & townh & objh & dobjinfo & spellh & modh & IS_AI_ENABLED;
  53. h & bth;
  54. if(!h.saving)
  55. {
  56. callWhenDeserializing();
  57. }
  58. }
  59. };
  60. extern DLL_LINKAGE LibClasses * VLC;
  61. DLL_LINKAGE void preinitDLL(CConsoleHandler *Console);
  62. DLL_LINKAGE void loadDLLClasses();