CGameInfo.cpp 2.2 KB

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