CGameInfo.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * CGameInfo.cpp, 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. #include "StdInc.h"
  11. #include "CGameInfo.h"
  12. #include "../lib/VCMI_Lib.h"
  13. const CGameInfo * CGI;
  14. CClientState * CCS = nullptr;
  15. CServerHandler * CSH;
  16. CGameInfo::CGameInfo()
  17. {
  18. generaltexth = nullptr;
  19. mh = nullptr;
  20. townh = nullptr;
  21. globalServices = nullptr;
  22. }
  23. void CGameInfo::setFromLib()
  24. {
  25. globalServices = VLC;
  26. modh = VLC->modh;
  27. generaltexth = VLC->generaltexth;
  28. creh = VLC->creh;
  29. townh = VLC->townh;
  30. heroh = VLC->heroh;
  31. objh = VLC->objh;
  32. spellh = VLC->spellh;
  33. skillh = VLC->skillh;
  34. objtypeh = VLC->objtypeh;
  35. terrainTypeHandler = VLC->terrainTypeHandler;
  36. battleFieldHandler = VLC->battlefieldsHandler;
  37. obstacleHandler = VLC->obstacleHandler;
  38. }
  39. const ArtifactService * CGameInfo::artifacts() const
  40. {
  41. return globalServices->artifacts();
  42. }
  43. const BattleFieldService * CGameInfo::battlefields() const
  44. {
  45. return globalServices->battlefields();
  46. }
  47. const CreatureService * CGameInfo::creatures() const
  48. {
  49. return globalServices->creatures();
  50. }
  51. const FactionService * CGameInfo::factions() const
  52. {
  53. return globalServices->factions();
  54. }
  55. const HeroClassService * CGameInfo::heroClasses() const
  56. {
  57. return globalServices->heroClasses();
  58. }
  59. const HeroTypeService * CGameInfo::heroTypes() const
  60. {
  61. return globalServices->heroTypes();
  62. }
  63. #if SCRIPTING_ENABLED
  64. const scripting::Service * CGameInfo::scripts() const
  65. {
  66. return globalServices->scripts();
  67. }
  68. #endif
  69. const spells::Service * CGameInfo::spells() const
  70. {
  71. return globalServices->spells();
  72. }
  73. const SkillService * CGameInfo::skills() const
  74. {
  75. return globalServices->skills();
  76. }
  77. const ObstacleService * CGameInfo::obstacles() const
  78. {
  79. return globalServices->obstacles();
  80. }
  81. const IGameSettings * CGameInfo::settings() const
  82. {
  83. return globalServices->settings();
  84. }
  85. void CGameInfo::updateEntity(Metatype metatype, int32_t index, const JsonNode & data)
  86. {
  87. logGlobal->error("CGameInfo::updateEntity call is not expected.");
  88. }
  89. spells::effects::Registry * CGameInfo::spellEffects()
  90. {
  91. return nullptr;
  92. }
  93. const spells::effects::Registry * CGameInfo::spellEffects() const
  94. {
  95. return globalServices->spellEffects();
  96. }