VCMI_Lib.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. #include <vcmi/Services.h>
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. class CConsoleHandler;
  14. class CArtHandler;
  15. class CHeroHandler;
  16. class CCreatureHandler;
  17. class CSpellHandler;
  18. class CSkillHandler;
  19. class CBuildingHandler;
  20. class CObjectHandler;
  21. class CObjectClassesHandler;
  22. class CTownHandler;
  23. class CGeneralTextHandler;
  24. class CModHandler;
  25. class CContentHandler;
  26. class BattleFieldHandler;
  27. class IBonusTypeHandler;
  28. class CBonusTypeHandler;
  29. class TerrainTypeHandler;
  30. class RoadTypeHandler;
  31. class RiverTypeHandler;
  32. class ObstacleHandler;
  33. class CTerrainViewPatternConfig;
  34. class CRmgTemplateStorage;
  35. class IHandlerBase;
  36. class IGameSettings;
  37. class GameSettings;
  38. class CIdentifierStorage;
  39. #if SCRIPTING_ENABLED
  40. namespace scripting
  41. {
  42. class ScriptHandler;
  43. }
  44. #endif
  45. /// Loads and constructs several handlers
  46. class DLL_LINKAGE LibClasses : public Services
  47. {
  48. CBonusTypeHandler * bth;
  49. void callWhenDeserializing(); //should be called only by serialize !!!
  50. void makeNull(); //sets all handler pointers to null
  51. std::shared_ptr<CContentHandler> getContent() const;
  52. void setContent(std::shared_ptr<CContentHandler> content);
  53. public:
  54. bool IS_AI_ENABLED = false; //unused?
  55. const ArtifactService * artifacts() const override;
  56. const CreatureService * creatures() const override;
  57. const FactionService * factions() const override;
  58. const HeroClassService * heroClasses() const override;
  59. const HeroTypeService * heroTypes() const override;
  60. #if SCRIPTING_ENABLED
  61. const scripting::Service * scripts() const override;
  62. #endif
  63. const spells::Service * spells() const override;
  64. const SkillService * skills() const override;
  65. const BattleFieldService * battlefields() const override;
  66. const ObstacleService * obstacles() const override;
  67. const IGameSettings * settings() const override;
  68. void updateEntity(Metatype metatype, int32_t index, const JsonNode & data) override;
  69. const spells::effects::Registry * spellEffects() const override;
  70. spells::effects::Registry * spellEffects() override;
  71. const IBonusTypeHandler * getBth() const; //deprecated
  72. const CIdentifierStorage * identifiers() const;
  73. CArtHandler * arth;
  74. CHeroHandler * heroh;
  75. CCreatureHandler * creh;
  76. CSpellHandler * spellh;
  77. CSkillHandler * skillh;
  78. CObjectHandler * objh;
  79. CObjectClassesHandler * objtypeh;
  80. CTownHandler * townh;
  81. CGeneralTextHandler * generaltexth;
  82. CModHandler * modh;
  83. TerrainTypeHandler * terrainTypeHandler;
  84. RoadTypeHandler * roadTypeHandler;
  85. RiverTypeHandler * riverTypeHandler;
  86. CIdentifierStorage * identifiersHandler;
  87. CTerrainViewPatternConfig * terviewh;
  88. CRmgTemplateStorage * tplh;
  89. BattleFieldHandler * battlefieldsHandler;
  90. ObstacleHandler * obstacleHandler;
  91. GameSettings * settingsHandler;
  92. #if SCRIPTING_ENABLED
  93. scripting::ScriptHandler * scriptHandler;
  94. #endif
  95. LibClasses(); //c-tor, loads .lods and NULLs handlers
  96. ~LibClasses();
  97. void init(bool onlyEssential); //uses standard config file
  98. void clear(); //deletes all handlers and its data
  99. // basic initialization. should be called before init(). Can also extract original H3 archives
  100. void loadFilesystem(bool extractArchives);
  101. void loadModFilesystem(bool onlyEssential);
  102. #if SCRIPTING_ENABLED
  103. void scriptsLoaded();
  104. #endif
  105. };
  106. extern DLL_LINKAGE LibClasses * VLC;
  107. DLL_LINKAGE void preinitDLL(CConsoleHandler * Console, bool onlyEssential = false, bool extractArchives = false);
  108. DLL_LINKAGE void loadDLLClasses(bool onlyEssential = false);
  109. VCMI_LIB_NAMESPACE_END