VCMI_Lib.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 CSkillHandler;
  17. class CBuildingHandler;
  18. class CObjectHandler;
  19. class CObjectClassesHandler;
  20. class CTownHandler;
  21. class CGeneralTextHandler;
  22. class CModHandler;
  23. class IBonusTypeHandler;
  24. class CBonusTypeHandler;
  25. class CTerrainViewPatternConfig;
  26. class CRmgTemplateStorage;
  27. /// Loads and constructs several handlers
  28. class DLL_LINKAGE LibClasses
  29. {
  30. CBonusTypeHandler * bth;
  31. void callWhenDeserializing(); //should be called only by serialize !!!
  32. void makeNull(); //sets all handler pointers to null
  33. public:
  34. bool IS_AI_ENABLED; //unused?
  35. const IBonusTypeHandler * getBth() const;
  36. CArtHandler * arth;
  37. CHeroHandler * heroh;
  38. CCreatureHandler * creh;
  39. CSpellHandler * spellh;
  40. CSkillHandler * skillh;
  41. CObjectHandler * objh;
  42. CObjectClassesHandler * objtypeh;
  43. CTownHandler * townh;
  44. CGeneralTextHandler * generaltexth;
  45. CModHandler * modh;
  46. CTerrainViewPatternConfig * terviewh;
  47. CRmgTemplateStorage * tplh;
  48. LibClasses(); //c-tor, loads .lods and NULLs handlers
  49. ~LibClasses();
  50. void init(bool onlyEssential); //uses standard config file
  51. void clear(); //deletes all handlers and its data
  52. void loadFilesystem(bool onlyEssential);// basic initialization. should be called before init()
  53. template <typename Handler> void serialize(Handler &h, const int version)
  54. {
  55. h & heroh;
  56. h & arth;
  57. h & creh;
  58. h & townh;
  59. h & objh;
  60. h & objtypeh;
  61. h & spellh;
  62. if(version >= 777)
  63. {
  64. h & skillh;
  65. }
  66. h & modh;
  67. h & IS_AI_ENABLED;
  68. h & bth;
  69. if(!h.saving)
  70. {
  71. callWhenDeserializing();
  72. }
  73. }
  74. };
  75. extern DLL_LINKAGE LibClasses * VLC;
  76. DLL_LINKAGE void preinitDLL(CConsoleHandler * Console, bool onlyEssential = false);
  77. DLL_LINKAGE void loadDLLClasses(bool onlyEssential = false);