2
0

GameLibrary.h 3.7 KB

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