GameLibrary.h 3.6 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. class SpellSchoolHandler;
  41. #if SCRIPTING_ENABLED
  42. namespace scripting
  43. {
  44. class ScriptHandler;
  45. }
  46. #endif
  47. /// Loads and constructs several handlers
  48. class DLL_LINKAGE GameLibrary final : public Services
  49. {
  50. public:
  51. const ArtifactService * artifacts() const override;
  52. const CreatureService * creatures() const override;
  53. const FactionService * factions() const override;
  54. const HeroClassService * heroClasses() const override;
  55. const HeroTypeService * heroTypes() const override;
  56. #if SCRIPTING_ENABLED
  57. const scripting::Service * scripts() const override;
  58. #endif
  59. const spells::Service * spells() const override;
  60. const SkillService * skills() const override;
  61. const BattleFieldService * battlefields() const override;
  62. const ObstacleService * obstacles() const override;
  63. const IGameSettings * engineSettings() const override;
  64. const spells::effects::Registry * spellEffects() const override;
  65. spells::effects::Registry * spellEffects() override;
  66. const IBonusTypeHandler * getBth() const; //deprecated
  67. const CIdentifierStorage * identifiers() const;
  68. std::unique_ptr<CArtHandler> arth;
  69. std::unique_ptr<CBonusTypeHandler> bth;
  70. std::unique_ptr<CHeroHandler> heroh;
  71. std::unique_ptr<CHeroClassHandler> heroclassesh;
  72. std::unique_ptr<CCreatureHandler> creh;
  73. std::unique_ptr<CSpellHandler> spellh;
  74. std::unique_ptr<SpellSchoolHandler> spellSchoolHandler;
  75. std::unique_ptr<CSkillHandler> skillh;
  76. // TODO: Remove ObjectHandler altogether?
  77. std::unique_ptr<CObjectHandler> objh;
  78. std::unique_ptr<CObjectClassesHandler> objtypeh;
  79. std::unique_ptr<CTownHandler> townh;
  80. std::unique_ptr<CGeneralTextHandler> generaltexth;
  81. std::unique_ptr<CModHandler> modh;
  82. std::unique_ptr<TerrainTypeHandler> terrainTypeHandler;
  83. std::unique_ptr<RoadTypeHandler> roadTypeHandler;
  84. std::unique_ptr<RiverTypeHandler> riverTypeHandler;
  85. std::unique_ptr<CIdentifierStorage> identifiersHandler;
  86. std::unique_ptr<CTerrainViewPatternConfig> terviewh;
  87. std::unique_ptr<CRmgTemplateStorage> tplh;
  88. std::unique_ptr<BattleFieldHandler> battlefieldsHandler;
  89. std::unique_ptr<ObstacleHandler> obstacleHandler;
  90. std::unique_ptr<GameSettings> settingsHandler;
  91. std::unique_ptr<ObstacleSetHandler> biomeHandler;
  92. #if SCRIPTING_ENABLED
  93. std::unique_ptr<scripting::ScriptHandler> scriptHandler;
  94. #endif
  95. GameLibrary();
  96. ~GameLibrary();
  97. /// initializes settings and filesystem
  98. void initializeFilesystem(bool extractArchives);
  99. /// Loads all game entities
  100. void initializeLibrary();
  101. private:
  102. // basic initialization. should be called before init(). Can also extract original H3 archives
  103. void loadFilesystem(bool extractArchives);
  104. void loadModFilesystem();
  105. #if SCRIPTING_ENABLED
  106. void scriptsLoaded();
  107. #endif
  108. };
  109. extern DLL_LINKAGE GameLibrary * LIBRARY;
  110. VCMI_LIB_NAMESPACE_END