VCMI_Lib.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * VCMI_Lib.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. class CConsoleHandler;
  12. class CArtHandler;
  13. class CHeroHandler;
  14. class CCreatureHandler;
  15. class CSpellHandler;
  16. class CBuildingHandler;
  17. class CObjectHandler;
  18. class CObjectClassesHandler;
  19. class CTownHandler;
  20. class CGeneralTextHandler;
  21. class CModHandler;
  22. class IBonusTypeHandler;
  23. class CBonusTypeHandler;
  24. class CTerrainViewPatternConfig;
  25. class CRmgTemplateStorage;
  26. /// Loads and constructs several handlers
  27. class DLL_LINKAGE LibClasses
  28. {
  29. CBonusTypeHandler * bth;
  30. void callWhenDeserializing(); //should be called only by serialize !!!
  31. void makeNull(); //sets all handler pointers to null
  32. public:
  33. bool IS_AI_ENABLED; //unused?
  34. const IBonusTypeHandler * getBth() const;
  35. CArtHandler * arth;
  36. CHeroHandler * heroh;
  37. CCreatureHandler * creh;
  38. CSpellHandler * spellh;
  39. CObjectHandler * objh;
  40. CObjectClassesHandler * objtypeh;
  41. CTownHandler * townh;
  42. CGeneralTextHandler * generaltexth;
  43. CModHandler * modh;
  44. CTerrainViewPatternConfig * terviewh;
  45. CRmgTemplateStorage * tplh;
  46. LibClasses(); //c-tor, loads .lods and NULLs handlers
  47. ~LibClasses();
  48. void init(); //uses standard config file
  49. void clear(); //deletes all handlers and its data
  50. void loadFilesystem();// basic initialization. should be called before init()
  51. template <typename Handler> void serialize(Handler &h, const int version)
  52. {
  53. h & heroh;
  54. h & arth;
  55. h & creh;
  56. h & townh;
  57. h & objh;
  58. h & objtypeh;
  59. h & spellh;
  60. h & modh;
  61. h & IS_AI_ENABLED;
  62. h & bth;
  63. if(!h.saving)
  64. {
  65. callWhenDeserializing();
  66. }
  67. }
  68. };
  69. extern DLL_LINKAGE LibClasses * VLC;
  70. DLL_LINKAGE void preinitDLL(CConsoleHandler *Console);
  71. DLL_LINKAGE void loadDLLClasses();