GameLibrary.h 3.8 KB

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