CGameInfo.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. battleFieldHandler = VLC->battlefieldsHandler;
  36. obstacleHandler = VLC->obstacleHandler;
  37. }
  38. const ArtifactService * CGameInfo::artifacts() const
  39. {
  40. return globalServices->artifacts();
  41. }
  42. const BattleFieldService * CGameInfo::battlefields() const
  43. {
  44. return globalServices->battlefields();
  45. }
  46. const CreatureService * CGameInfo::creatures() const
  47. {
  48. return globalServices->creatures();
  49. }
  50. const FactionService * CGameInfo::factions() const
  51. {
  52. return globalServices->factions();
  53. }
  54. const HeroClassService * CGameInfo::heroClasses() const
  55. {
  56. return globalServices->heroClasses();
  57. }
  58. const HeroTypeService * CGameInfo::heroTypes() const
  59. {
  60. return globalServices->heroTypes();
  61. }
  62. #if SCRIPTING_ENABLED
  63. const scripting::Service * CGameInfo::scripts() const
  64. {
  65. return globalServices->scripts();
  66. }
  67. #endif
  68. const spells::Service * CGameInfo::spells() const
  69. {
  70. return globalServices->spells();
  71. }
  72. const SkillService * CGameInfo::skills() const
  73. {
  74. return globalServices->skills();
  75. }
  76. const ObstacleService * CGameInfo::obstacles() const
  77. {
  78. return globalServices->obstacles();
  79. }
  80. void CGameInfo::updateEntity(Metatype metatype, int32_t index, const JsonNode & data)
  81. {
  82. logGlobal->error("CGameInfo::updateEntity call is not expected.");
  83. }
  84. spells::effects::Registry * CGameInfo::spellEffects()
  85. {
  86. return nullptr;
  87. }
  88. const spells::effects::Registry * CGameInfo::spellEffects() const
  89. {
  90. return globalServices->spellEffects();
  91. }