Quellcode durchsuchen

Merge pull request #2175 from IvanSavenko/map_format_mappings

HotA map format support  - object mapping
Ivan Savenko vor 2 Jahren
Ursprung
Commit
b04b11b9d1
100 geänderte Dateien mit 412 neuen und 691 gelöschten Zeilen
  1. 0 1
      AI/Nullkiller/Analyzers/BuildAnalyzer.cpp
  2. 2 1
      AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp
  3. 2 0
      AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.h
  4. 0 1
      AI/Nullkiller/Analyzers/ObjectClusterizer.cpp
  5. 0 1
      AI/Nullkiller/Behaviors/BuildingBehavior.cpp
  6. 0 1
      AI/Nullkiller/Behaviors/BuyArmyBehavior.cpp
  7. 0 1
      AI/Nullkiller/Behaviors/DefenceBehavior.cpp
  8. 0 1
      AI/Nullkiller/Behaviors/GatherArmyBehavior.cpp
  9. 0 1
      AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp
  10. 0 1
      AI/Nullkiller/Behaviors/StartupBehavior.cpp
  11. 0 1
      AI/Nullkiller/Goals/AbstractGoal.cpp
  12. 0 1
      AI/Nullkiller/Goals/AdventureSpellCast.cpp
  13. 0 1
      AI/Nullkiller/Goals/BuildBoat.cpp
  14. 0 1
      AI/Nullkiller/Goals/BuildThis.cpp
  15. 0 1
      AI/Nullkiller/Goals/CompleteQuest.cpp
  16. 0 1
      AI/Nullkiller/Goals/Composition.cpp
  17. 0 1
      AI/Nullkiller/Goals/DismissHero.cpp
  18. 0 1
      AI/Nullkiller/Goals/ExchangeSwapTownHeroes.cpp
  19. 0 1
      AI/Nullkiller/Goals/ExecuteHeroChain.cpp
  20. 0 1
      AI/Nullkiller/Goals/RecruitHero.cpp
  21. 0 1
      AI/Nullkiller/Goals/SaveResources.cpp
  22. 0 1
      AI/Nullkiller/Pathfinding/Actions/BattleAction.cpp
  23. 0 1
      AI/Nullkiller/Pathfinding/Actions/BoatActions.cpp
  24. 0 1
      AI/Nullkiller/Pathfinding/Actions/BoatActions.h
  25. 0 1
      AI/Nullkiller/Pathfinding/Actions/BuyArmyAction.cpp
  26. 0 1
      AI/Nullkiller/Pathfinding/Actions/QuestAction.cpp
  27. 0 1
      AI/Nullkiller/Pathfinding/Actions/TownPortalAction.cpp
  28. 0 1
      AI/Nullkiller/Pathfinding/Actions/TownPortalAction.h
  29. 0 1
      AI/Nullkiller/Pathfinding/Actors.cpp
  30. 0 1
      AI/Nullkiller/Pathfinding/Rules/AILayerTransitionRule.h
  31. 0 1
      AI/Nullkiller/Pathfinding/Rules/AIMovementAfterDestinationRule.h
  32. 0 1
      AI/Nullkiller/Pathfinding/Rules/AIMovementToDestinationRule.h
  33. 0 1
      AI/Nullkiller/Pathfinding/Rules/AIPreviousNodeRule.h
  34. 0 1
      AI/VCAI/Goals/AbstractGoal.cpp
  35. 1 1
      AI/VCAI/Goals/AdventureSpellCast.cpp
  36. 1 1
      AI/VCAI/Goals/Build.cpp
  37. 0 1
      AI/VCAI/Goals/BuildBoat.cpp
  38. 1 1
      AI/VCAI/Goals/BuildThis.cpp
  39. 1 1
      AI/VCAI/Goals/CollectRes.cpp
  40. 1 1
      AI/VCAI/Goals/CompleteQuest.cpp
  41. 0 1
      AI/VCAI/Goals/Conquer.cpp
  42. 0 1
      AI/VCAI/Goals/Explore.cpp
  43. 1 1
      AI/VCAI/Goals/GatherArmy.cpp
  44. 1 1
      AI/VCAI/Goals/GatherTroops.cpp
  45. 0 1
      AI/VCAI/Goals/RecruitHero.cpp
  46. 0 2
      AI/VCAI/Goals/VisitHero.cpp
  47. 0 1
      AI/VCAI/Goals/VisitObj.cpp
  48. 0 1
      AI/VCAI/Goals/VisitTile.cpp
  49. 2 1
      AI/VCAI/Goals/Win.cpp
  50. 1 1
      AI/VCAI/Pathfinding/AIPathfinder.cpp
  51. 1 2
      AI/VCAI/Pathfinding/Actions/BoatActions.cpp
  52. 1 2
      AI/VCAI/Pathfinding/Actions/BoatActions.h
  53. 1 2
      AI/VCAI/Pathfinding/Actions/TownPortalAction.cpp
  54. 1 2
      AI/VCAI/Pathfinding/Actions/TownPortalAction.h
  55. 2 1
      AI/VCAI/Pathfinding/PathfindingManager.cpp
  56. 0 1
      AI/VCAI/Pathfinding/Rules/AILayerTransitionRule.h
  57. 0 1
      AI/VCAI/Pathfinding/Rules/AIMovementAfterDestinationRule.h
  58. 0 1
      AI/VCAI/Pathfinding/Rules/AIMovementToDestinationRule.h
  59. 0 1
      AI/VCAI/Pathfinding/Rules/AIPreviousNodeRule.h
  60. BIN
      Mods/vcmi/Maps/VCMI_Tests_2011b.h3m
  61. 2 2
      Mods/vcmi/Sprites/ScSelC.json
  62. 2 1
      client/CPlayerInterface.cpp
  63. 0 1
      client/CServerHandler.cpp
  64. 2 1
      client/adventureMap/AdventureMapInterface.cpp
  65. 2 1
      client/lobby/CBonusSelection.h
  66. 1 1
      client/lobby/CCampaignInfoScreen.cpp
  67. 2 1
      client/lobby/CLobbyScreen.cpp
  68. 1 1
      client/lobby/CSavingScreen.cpp
  69. 1 0
      client/lobby/CScenarioInfoScreen.cpp
  70. 1 0
      client/lobby/CSelectionBase.cpp
  71. 24 22
      client/lobby/OptionsTab.cpp
  72. 11 4
      client/lobby/OptionsTab.h
  73. 3 2
      client/lobby/RandomMapTab.cpp
  74. 24 5
      client/lobby/SelectionTab.cpp
  75. 1 0
      client/lobby/SelectionTab.h
  76. 0 1
      client/mainmenu/CMainMenu.cpp
  77. 1 1
      client/mapView/MapRenderer.cpp
  78. 0 1
      client/mapView/MapView.cpp
  79. 1 1
      client/windows/GUIClasses.cpp
  80. 7 0
      cmake_modules/VCMI_lib.cmake
  81. 0 61
      config/buildings5.json
  82. 123 2
      config/gameConfig.json
  83. 0 379
      config/objects/hotaObjects.json
  84. 7 13
      config/objects/moddables.json
  85. 20 20
      config/terrainViewPatterns.json
  86. 13 8
      lib/CGameState.cpp
  87. 5 52
      lib/CModHandler.cpp
  88. 4 27
      lib/CModHandler.h
  89. 63 0
      lib/CModVersion.cpp
  90. 39 0
      lib/CModVersion.h
  91. 0 1
      lib/GameConstants.h
  92. 7 2
      lib/GameSettings.cpp
  93. 6 1
      lib/GameSettings.h
  94. 0 1
      lib/PathfinderUtil.h
  95. 3 1
      lib/StartInfo.cpp
  96. 8 8
      lib/StringConstants.h
  97. 1 0
      lib/mapObjects/CRewardableConstructor.cpp
  98. 3 2
      lib/mapObjects/CommonConstructors.cpp
  99. 2 2
      lib/mapObjects/MiscObjects.cpp
  100. 2 2
      lib/mapObjects/MiscObjects.h

+ 0 - 1
AI/Nullkiller/Analyzers/BuildAnalyzer.cpp

@@ -9,7 +9,6 @@
 */
 #include "../StdInc.h"
 #include "../Engine/Nullkiller.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
 #include "../Engine/Nullkiller.h"
 
 namespace NKAI

+ 2 - 1
AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp

@@ -8,7 +8,8 @@
 *
 */
 #include "../StdInc.h"
-#include "lib/mapping/CMap.h" //for victory conditions
+#include "DangerHitMapAnalyzer.h"
+
 #include "../Engine/Nullkiller.h"
 
 namespace NKAI

+ 2 - 0
AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.h

@@ -14,6 +14,8 @@
 namespace NKAI
 {
 
+struct AIPath;
+
 struct HitMapInfo
 {
 	static HitMapInfo NoTreat;

+ 0 - 1
AI/Nullkiller/Analyzers/ObjectClusterizer.cpp

@@ -12,7 +12,6 @@
 #include "../Goals/ExecuteHeroChain.h"
 #include "../AIGateway.h"
 #include "../Engine/Nullkiller.h"
-#include "lib/mapping/CMap.h" //for victory conditions
 
 namespace NKAI
 {

+ 0 - 1
AI/Nullkiller/Behaviors/BuildingBehavior.cpp

@@ -15,7 +15,6 @@
 #include "../Goals/Composition.h"
 #include "../Goals/BuildThis.h"
 #include "../Goals/SaveResources.h"
-#include "lib/mapping/CMap.h" //for victory conditions
 #include "lib/CPathfinder.h"
 #include "../Engine/Nullkiller.h"
 

+ 0 - 1
AI/Nullkiller/Behaviors/BuyArmyBehavior.cpp

@@ -13,7 +13,6 @@
 #include "../AIUtility.h"
 #include "../Goals/BuyArmy.h"
 #include "../Engine/Nullkiller.h"
-#include "lib/mapping/CMap.h" //for victory conditions
 #include "lib/CPathfinder.h"
 
 namespace NKAI

+ 0 - 1
AI/Nullkiller/Behaviors/DefenceBehavior.cpp

@@ -21,7 +21,6 @@
 #include "../Goals/CaptureObject.h"
 #include "../Markers/DefendTown.h"
 #include "../Goals/ExchangeSwapTownHeroes.h"
-#include "lib/mapping/CMap.h" //for victory conditions
 #include "lib/CPathfinder.h"
 
 namespace NKAI

+ 0 - 1
AI/Nullkiller/Behaviors/GatherArmyBehavior.cpp

@@ -16,7 +16,6 @@
 #include "../Markers/ArmyUpgrade.h"
 #include "GatherArmyBehavior.h"
 #include "../AIUtility.h"
-#include "lib/mapping/CMap.h" //for victory conditions
 #include "lib/CPathfinder.h"
 
 namespace NKAI

+ 0 - 1
AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp

@@ -13,7 +13,6 @@
 #include "../AIUtility.h"
 #include "../Goals/RecruitHero.h"
 #include "../Goals/ExecuteHeroChain.h"
-#include "lib/mapping/CMap.h" //for victory conditions
 #include "lib/CPathfinder.h"
 
 namespace NKAI

+ 0 - 1
AI/Nullkiller/Behaviors/StartupBehavior.cpp

@@ -15,7 +15,6 @@
 #include "../Goals/RecruitHero.h"
 #include "../Goals/ExecuteHeroChain.h"
 #include "../Goals/ExchangeSwapTownHeroes.h"
-#include "lib/mapping/CMap.h" //for victory conditions
 #include "lib/mapObjects/MapObjects.h" //for victory conditions
 #include "lib/CPathfinder.h"
 #include "../Engine/Nullkiller.h"

+ 0 - 1
AI/Nullkiller/Goals/AbstractGoal.cpp

@@ -10,7 +10,6 @@
 #include "StdInc.h"
 #include "AbstractGoal.h"
 #include "../AIGateway.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
 #include "../../../lib/CPathfinder.h"
 #include "../../../lib/StringConstants.h"
 

+ 0 - 1
AI/Nullkiller/Goals/AdventureSpellCast.cpp

@@ -10,7 +10,6 @@
 #include "StdInc.h"
 #include "AdventureSpellCast.h"
 #include "../AIGateway.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
 #include "../../../lib/CPathfinder.h"
 
 namespace NKAI

+ 0 - 1
AI/Nullkiller/Goals/BuildBoat.cpp

@@ -10,7 +10,6 @@
 #include "StdInc.h"
 #include "BuildBoat.h"
 #include "../AIGateway.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
 #include "../../../lib/CPathfinder.h"
 #include "../Behaviors/CaptureObjectsBehavior.h"
 

+ 0 - 1
AI/Nullkiller/Goals/BuildThis.cpp

@@ -11,7 +11,6 @@
 #include "BuildThis.h"
 #include "../AIGateway.h"
 #include "../AIUtility.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
 #include "../../../lib/CPathfinder.h"
 #include "../../../lib/StringConstants.h"
 

+ 0 - 1
AI/Nullkiller/Goals/CompleteQuest.cpp

@@ -11,7 +11,6 @@
 #include "CompleteQuest.h"
 #include "../Behaviors/CaptureObjectsBehavior.h"
 #include "../AIGateway.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
 #include "../../../lib/CPathfinder.h"
 #include "../../../lib/VCMI_Lib.h"
 #include "../../../lib/CGeneralTextHandler.h"

+ 0 - 1
AI/Nullkiller/Goals/Composition.cpp

@@ -11,7 +11,6 @@
 #include "Composition.h"
 #include "../AIGateway.h"
 #include "../AIUtility.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
 #include "../../../lib/CPathfinder.h"
 #include "../../../lib/StringConstants.h"
 

+ 0 - 1
AI/Nullkiller/Goals/DismissHero.cpp

@@ -10,7 +10,6 @@
 #include "StdInc.h"
 #include "DismissHero.h"
 #include "../AIGateway.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
 #include "../../../lib/CPathfinder.h"
 
 namespace NKAI

+ 0 - 1
AI/Nullkiller/Goals/ExchangeSwapTownHeroes.cpp

@@ -11,7 +11,6 @@
 #include "ExchangeSwapTownHeroes.h"
 #include "ExecuteHeroChain.h"
 #include "../AIGateway.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
 #include "../../../lib/CPathfinder.h"
 #include "../Engine/Nullkiller.h"
 

+ 0 - 1
AI/Nullkiller/Goals/ExecuteHeroChain.cpp

@@ -10,7 +10,6 @@
 #include "StdInc.h"
 #include "ExecuteHeroChain.h"
 #include "../AIGateway.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
 #include "../../../lib/CPathfinder.h"
 #include "../Engine/Nullkiller.h"
 

+ 0 - 1
AI/Nullkiller/Goals/RecruitHero.cpp

@@ -11,7 +11,6 @@
 #include "Goals.h"
 #include "../AIGateway.h"
 #include "../AIUtility.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
 #include "../../../lib/CPathfinder.h"
 #include "../../../lib/StringConstants.h"
 

+ 0 - 1
AI/Nullkiller/Goals/SaveResources.cpp

@@ -10,7 +10,6 @@
 #include "StdInc.h"
 #include "SaveResources.h"
 #include "../AIGateway.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
 #include "../../../lib/CPathfinder.h"
 #include "../Behaviors/CaptureObjectsBehavior.h"
 

+ 0 - 1
AI/Nullkiller/Pathfinding/Actions/BattleAction.cpp

@@ -12,7 +12,6 @@
 #include "BattleAction.h"
 #include "../../AIGateway.h"
 #include "../../Goals/CompleteQuest.h"
-#include "../../../../lib/mapping/CMap.h" //for victory conditions
 
 namespace NKAI
 {

+ 0 - 1
AI/Nullkiller/Pathfinding/Actions/BoatActions.cpp

@@ -14,7 +14,6 @@
 #include "../../Goals/CaptureObject.h"
 #include "../../Goals/Invalid.h"
 #include "../../Goals/BuildBoat.h"
-#include "../../../../lib/mapping/CMap.h"
 #include "../../../../lib/mapObjects/MapObjects.h"
 #include "BoatActions.h"
 

+ 0 - 1
AI/Nullkiller/Pathfinding/Actions/BoatActions.h

@@ -11,7 +11,6 @@
 #pragma once
 
 #include "SpecialAction.h"
-#include "../../../../lib/mapping/CMap.h"
 #include "../../../../lib/mapObjects/MapObjects.h"
 
 namespace NKAI

+ 0 - 1
AI/Nullkiller/Pathfinding/Actions/BuyArmyAction.cpp

@@ -12,7 +12,6 @@
 #include "BuyArmyAction.h"
 #include "../../AIGateway.h"
 #include "../../Goals/CompleteQuest.h"
-#include "../../../../lib/mapping/CMap.h" //for victory conditions
 
 namespace NKAI
 {

+ 0 - 1
AI/Nullkiller/Pathfinding/Actions/QuestAction.cpp

@@ -12,7 +12,6 @@
 #include "QuestAction.h"
 #include "../../AIGateway.h"
 #include "../../Goals/CompleteQuest.h"
-#include "../../../../lib/mapping/CMap.h" //for victory conditions
 
 namespace NKAI
 {

+ 0 - 1
AI/Nullkiller/Pathfinding/Actions/TownPortalAction.cpp

@@ -10,7 +10,6 @@
 
 #include "StdInc.h"
 #include "../../Goals/AdventureSpellCast.h"
-#include "../../../../lib/mapping/CMap.h"
 #include "../../../../lib/mapObjects/MapObjects.h"
 #include "TownPortalAction.h"
 

+ 0 - 1
AI/Nullkiller/Pathfinding/Actions/TownPortalAction.h

@@ -11,7 +11,6 @@
 #pragma once
 
 #include "SpecialAction.h"
-#include "../../../../lib/mapping/CMap.h"
 #include "../../../../lib/mapObjects/MapObjects.h"
 #include "../../Goals/AdventureSpellCast.h"
 

+ 0 - 1
AI/Nullkiller/Pathfinding/Actors.cpp

@@ -12,7 +12,6 @@
 #include "../AIGateway.h"
 #include "../Engine/Nullkiller.h"
 #include "../../../CCallback.h"
-#include "../../../lib/mapping/CMap.h"
 #include "../../../lib/mapObjects/MapObjects.h"
 #include "Actions/BuyArmyAction.h"
 

+ 0 - 1
AI/Nullkiller/Pathfinding/Rules/AILayerTransitionRule.h

@@ -14,7 +14,6 @@
 #include "../../AIGateway.h"
 #include "../Actions/BoatActions.h"
 #include "../../../../CCallback.h"
-#include "../../../../lib/mapping/CMap.h"
 #include "../../../../lib/mapObjects/MapObjects.h"
 
 namespace NKAI

+ 0 - 1
AI/Nullkiller/Pathfinding/Rules/AIMovementAfterDestinationRule.h

@@ -13,7 +13,6 @@
 #include "../AINodeStorage.h"
 #include "../../AIGateway.h"
 #include "../../../../CCallback.h"
-#include "../../../../lib/mapping/CMap.h"
 #include "../../../../lib/mapObjects/MapObjects.h"
 
 namespace NKAI

+ 0 - 1
AI/Nullkiller/Pathfinding/Rules/AIMovementToDestinationRule.h

@@ -13,7 +13,6 @@
 #include "../AINodeStorage.h"
 #include "../../AIGateway.h"
 #include "../../../../CCallback.h"
-#include "../../../../lib/mapping/CMap.h"
 #include "../../../../lib/mapObjects/MapObjects.h"
 
 namespace NKAI

+ 0 - 1
AI/Nullkiller/Pathfinding/Rules/AIPreviousNodeRule.h

@@ -13,7 +13,6 @@
 #include "../AINodeStorage.h"
 #include "../../AIGateway.h"
 #include "../../../../CCallback.h"
-#include "../../../../lib/mapping/CMap.h"
 #include "../../../../lib/mapObjects/MapObjects.h"
 
 namespace NKAI

+ 0 - 1
AI/VCAI/Goals/AbstractGoal.cpp

@@ -14,7 +14,6 @@
 #include "../FuzzyHelper.h"
 #include "../ResourceManager.h"
 #include "../BuildingManager.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
 #include "../../../lib/CPathfinder.h"
 #include "../../../lib/StringConstants.h"
 

+ 1 - 1
AI/VCAI/Goals/AdventureSpellCast.cpp

@@ -12,7 +12,7 @@
 #include "../VCAI.h"
 #include "../FuzzyHelper.h"
 #include "../AIhelper.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
+#include "../../../lib/mapObjects/CGTownInstance.h"
 #include "../../../lib/CPathfinder.h"
 
 extern boost::thread_specific_ptr<CCallback> cb;

+ 1 - 1
AI/VCAI/Goals/Build.cpp

@@ -16,7 +16,7 @@
 #include "../FuzzyHelper.h"
 #include "../ResourceManager.h"
 #include "../BuildingManager.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
+#include "../../../lib/mapObjects/CGTownInstance.h"
 #include "../../../lib/CPathfinder.h"
 #include "../../../lib/StringConstants.h"
 

+ 0 - 1
AI/VCAI/Goals/BuildBoat.cpp

@@ -12,7 +12,6 @@
 #include "../VCAI.h"
 #include "../FuzzyHelper.h"
 #include "../AIhelper.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
 #include "../../../lib/CPathfinder.h"
 
 extern boost::thread_specific_ptr<CCallback> cb;

+ 1 - 1
AI/VCAI/Goals/BuildThis.cpp

@@ -15,7 +15,7 @@
 #include "../FuzzyHelper.h"
 #include "../ResourceManager.h"
 #include "../BuildingManager.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
+#include "../../../lib/mapObjects/CGTownInstance.h"
 #include "../../../lib/CPathfinder.h"
 #include "../../../lib/StringConstants.h"
 

+ 1 - 1
AI/VCAI/Goals/CollectRes.cpp

@@ -15,7 +15,7 @@
 #include "../FuzzyHelper.h"
 #include "../ResourceManager.h"
 #include "../BuildingManager.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
+#include "../../../lib/mapObjects/CGMarket.h"
 #include "../../../lib/CPathfinder.h"
 #include "../../../lib/StringConstants.h"
 

+ 1 - 1
AI/VCAI/Goals/CompleteQuest.cpp

@@ -12,7 +12,7 @@
 #include "../VCAI.h"
 #include "../FuzzyHelper.h"
 #include "../AIhelper.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
+#include "../../../lib/mapObjects/CQuest.h"
 #include "../../../lib/CPathfinder.h"
 
 extern boost::thread_specific_ptr<CCallback> cb;

+ 0 - 1
AI/VCAI/Goals/Conquer.cpp

@@ -15,7 +15,6 @@
 #include "../FuzzyHelper.h"
 #include "../ResourceManager.h"
 #include "../BuildingManager.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
 #include "../../../lib/CPathfinder.h"
 #include "../../../lib/StringConstants.h"
 

+ 0 - 1
AI/VCAI/Goals/Explore.cpp

@@ -15,7 +15,6 @@
 #include "../FuzzyHelper.h"
 #include "../ResourceManager.h"
 #include "../BuildingManager.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
 #include "../../../lib/CPathfinder.h"
 #include "../../../lib/StringConstants.h"
 #include "../../../lib/CPlayerState.h"

+ 1 - 1
AI/VCAI/Goals/GatherArmy.cpp

@@ -15,7 +15,7 @@
 #include "../FuzzyHelper.h"
 #include "../ResourceManager.h"
 #include "../BuildingManager.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
+#include "../../../lib/mapObjects/CGTownInstance.h"
 #include "../../../lib/CPathfinder.h"
 #include "../../../lib/StringConstants.h"
 

+ 1 - 1
AI/VCAI/Goals/GatherTroops.cpp

@@ -15,7 +15,7 @@
 #include "../FuzzyHelper.h"
 #include "../ResourceManager.h"
 #include "../BuildingManager.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
+#include "../../../lib/mapObjects/CGTownInstance.h"
 #include "../../../lib/CPathfinder.h"
 #include "../../../lib/StringConstants.h"
 

+ 0 - 1
AI/VCAI/Goals/RecruitHero.cpp

@@ -15,7 +15,6 @@
 #include "../FuzzyHelper.h"
 #include "../ResourceManager.h"
 #include "../BuildingManager.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
 #include "../../../lib/CPathfinder.h"
 #include "../../../lib/StringConstants.h"
 

+ 0 - 2
AI/VCAI/Goals/VisitHero.cpp

@@ -17,8 +17,6 @@
 #include "../FuzzyHelper.h"
 #include "../ResourceManager.h"
 #include "../BuildingManager.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
-
 
 extern boost::thread_specific_ptr<CCallback> cb;
 extern boost::thread_specific_ptr<VCAI> ai;

+ 0 - 1
AI/VCAI/Goals/VisitObj.cpp

@@ -15,7 +15,6 @@
 #include "../FuzzyHelper.h"
 #include "../ResourceManager.h"
 #include "../BuildingManager.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
 #include "../../../lib/CPathfinder.h"
 #include "../../../lib/StringConstants.h"
 

+ 0 - 1
AI/VCAI/Goals/VisitTile.cpp

@@ -15,7 +15,6 @@
 #include "../FuzzyHelper.h"
 #include "../ResourceManager.h"
 #include "../BuildingManager.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
 #include "../../../lib/CPathfinder.h"
 #include "../../../lib/StringConstants.h"
 

+ 2 - 1
AI/VCAI/Goals/Win.cpp

@@ -15,7 +15,8 @@
 #include "../FuzzyHelper.h"
 #include "../ResourceManager.h"
 #include "../BuildingManager.h"
-#include "../../../lib/mapping/CMap.h" //for victory conditions
+#include "../../../lib/mapping/CMapHeader.h" //for victory conditions
+#include "../../../lib/mapObjects/CGTownInstance.h"
 #include "../../../lib/CPathfinder.h"
 #include "../../../lib/StringConstants.h"
 

+ 1 - 1
AI/VCAI/Pathfinding/AIPathfinder.cpp

@@ -11,7 +11,7 @@
 #include "AIPathfinder.h"
 #include "AIPathfinderConfig.h"
 #include "../../../CCallback.h"
-#include "../../../lib/mapping/CMap.h"
+#include "../../../lib/mapping/CMapDefines.h"
 
 std::vector<std::shared_ptr<AINodeStorage>> AIPathfinder::storagePool;
 std::map<HeroPtr, std::shared_ptr<AINodeStorage>> AIPathfinder::storageMap;

+ 1 - 2
AI/VCAI/Pathfinding/Actions/BoatActions.cpp

@@ -11,7 +11,6 @@
 #include "StdInc.h"
 #include "../../Goals/AdventureSpellCast.h"
 #include "../../Goals/BuildBoat.h"
-#include "../../../../lib/mapping/CMap.h"
 #include "../../../../lib/mapObjects/MapObjects.h"
 #include "BoatActions.h"
 
@@ -58,4 +57,4 @@ namespace AIPathfinding
 
 		return hero->getSpellCost(summonBoat.toSpell());
 	}
-}
+}

+ 1 - 2
AI/VCAI/Pathfinding/Actions/BoatActions.h

@@ -11,7 +11,6 @@
 #pragma once
 
 #include "ISpecialAction.h"
-#include "../../../../lib/mapping/CMap.h"
 #include "../../../../lib/mapObjects/MapObjects.h"
 
 namespace AIPathfinding
@@ -69,4 +68,4 @@ namespace AIPathfinding
 
 		virtual Goals::TSubgoal whatToDo(const HeroPtr & hero) const override;
 	};
-}
+}

+ 1 - 2
AI/VCAI/Pathfinding/Actions/TownPortalAction.cpp

@@ -10,7 +10,6 @@
 
 #include "StdInc.h"
 #include "../../Goals/AdventureSpellCast.h"
-#include "../../../../lib/mapping/CMap.h"
 #include "../../../../lib/mapObjects/MapObjects.h"
 #include "TownPortalAction.h"
 
@@ -21,4 +20,4 @@ Goals::TSubgoal TownPortalAction::whatToDo(const HeroPtr & hero) const
 	const CGTownInstance * targetTown = target; // const pointer is not allowed in settown
 
 	return Goals::sptr(Goals::AdventureSpellCast(hero, SpellID::TOWN_PORTAL).settown(targetTown).settile(targetTown->visitablePos()));
-}
+}

+ 1 - 2
AI/VCAI/Pathfinding/Actions/TownPortalAction.h

@@ -11,7 +11,6 @@
 #pragma once
 
 #include "ISpecialAction.h"
-#include "../../../../lib/mapping/CMap.h"
 #include "../../../../lib/mapObjects/MapObjects.h"
 #include "../../Goals/AdventureSpellCast.h"
 
@@ -30,4 +29,4 @@ namespace AIPathfinding
 
 		virtual Goals::TSubgoal whatToDo(const HeroPtr & hero) const override;
 	};
-}
+}

+ 2 - 1
AI/VCAI/Pathfinding/PathfindingManager.cpp

@@ -13,7 +13,8 @@
 #include "AIPathfinderConfig.h"
 #include "../Goals/Goals.h"
 #include "../../../lib/CGameInfoCallback.h"
-#include "../../../lib/mapping/CMap.h"
+#include "../../../lib/mapping/CMapDefines.h"
+#include "../../../lib/mapObjects/CQuest.h"
 
 PathfindingManager::PathfindingManager(CPlayerSpecificInfoCallback * CB, VCAI * AI)
 	: ai(AI), cb(CB)

+ 0 - 1
AI/VCAI/Pathfinding/Rules/AILayerTransitionRule.h

@@ -14,7 +14,6 @@
 #include "../../VCAI.h"
 #include "../Actions/BoatActions.h"
 #include "../../../../CCallback.h"
-#include "../../../../lib/mapping/CMap.h"
 #include "../../../../lib/mapObjects/MapObjects.h"
 
 namespace AIPathfinding

+ 0 - 1
AI/VCAI/Pathfinding/Rules/AIMovementAfterDestinationRule.h

@@ -13,7 +13,6 @@
 #include "../AINodeStorage.h"
 #include "../../VCAI.h"
 #include "../../../../CCallback.h"
-#include "../../../../lib/mapping/CMap.h"
 #include "../../../../lib/mapObjects/MapObjects.h"
 
 namespace AIPathfinding

+ 0 - 1
AI/VCAI/Pathfinding/Rules/AIMovementToDestinationRule.h

@@ -13,7 +13,6 @@
 #include "../AINodeStorage.h"
 #include "../../VCAI.h"
 #include "../../../../CCallback.h"
-#include "../../../../lib/mapping/CMap.h"
 #include "../../../../lib/mapObjects/MapObjects.h"
 
 namespace AIPathfinding

+ 0 - 1
AI/VCAI/Pathfinding/Rules/AIPreviousNodeRule.h

@@ -13,7 +13,6 @@
 #include "../AINodeStorage.h"
 #include "../../VCAI.h"
 #include "../../../../CCallback.h"
-#include "../../../../lib/mapping/CMap.h"
 #include "../../../../lib/mapObjects/MapObjects.h"
 
 namespace AIPathfinding

BIN
Mods/vcmi/Maps/VCMI_Tests_2011b.h3m


+ 2 - 2
Mods/vcmi/Sprites/ScSelC.json

@@ -1,7 +1,7 @@
 {
-        "basepath" : "mapFormatIcons/",
+	"basepath" : "mapFormatIcons/",
 	"images" :
 	[
-		{ "group" : 1, "frame" : 0, "file" : "vcmi1.png"}
+		{ "frame" : 3, "file" : "vcmi1.png"}
 	]
 }

+ 2 - 1
client/CPlayerInterface.cpp

@@ -53,13 +53,14 @@
 #include "../lib/spells/CSpellHandler.h"
 #include "../lib/CTownHandler.h"
 #include "../lib/mapObjects/CObjectClassesHandler.h" // For displaying correct UI when interacting with objects
+#include "../lib/mapObjects/CGTownInstance.h"
+#include "../lib/mapObjects/MiscObjects.h"
 #include "../lib/CStack.h"
 #include "../lib/JsonNode.h"
 #include "CMusicHandler.h"
 #include "../lib/CondSh.h"
 #include "../lib/NetPacksBase.h"
 #include "../lib/NetPacks.h"//todo: remove
-#include "../lib/mapping/CMap.h"
 #include "../lib/VCMIDirs.h"
 #include "../lib/CStopWatch.h"
 #include "../lib/StartInfo.h"

+ 0 - 1
client/CServerHandler.cpp

@@ -42,7 +42,6 @@
 #include "../lib/StartInfo.h"
 #include "../lib/VCMIDirs.h"
 #include "../lib/mapping/CCampaignHandler.h"
-#include "../lib/mapping/CMap.h"
 #include "../lib/mapping/CMapInfo.h"
 #include "../lib/mapObjects/MiscObjects.h"
 #include "../lib/rmg/CMapGenOptions.h"

+ 2 - 1
client/adventureMap/AdventureMapInterface.cpp

@@ -37,8 +37,9 @@
 #include "../../lib/CGeneralTextHandler.h"
 #include "../../lib/spells/CSpellHandler.h"
 #include "../../lib/mapObjects/CGHeroInstance.h"
+#include "../../lib/mapObjects/CGTownInstance.h"
 #include "../../lib/CPathfinder.h"
-#include "../../lib/mapping/CMap.h"
+#include "../../lib/mapping/CMapDefines.h"
 
 std::shared_ptr<AdventureMapInterface> adventureInt;
 

+ 2 - 1
client/lobby/CBonusSelection.h

@@ -8,12 +8,13 @@
  *
  */
 #pragma once
-#include "../../lib/mapping/CCampaignHandler.h"
+
 #include "../windows/CWindowObject.h"
 
 VCMI_LIB_NAMESPACE_BEGIN
 
 class CCampaignState;
+struct CampaignRegions;
 
 VCMI_LIB_NAMESPACE_END
 

+ 1 - 1
client/lobby/CCampaignInfoScreen.cpp

@@ -15,7 +15,7 @@
 #include "../../lib/CGeneralTextHandler.h"
 #include "../../lib/StartInfo.h"
 #include "../../lib/mapping/CMapInfo.h"
-#include "../../lib/mapping/CMap.h"
+#include "../../lib/mapping/CMapHeader.h"
 #include "../gui/CGuiHandler.h"
 #include "../CGameInfo.h"
 #include "../CPlayerInterface.h"

+ 2 - 1
client/lobby/CLobbyScreen.cpp

@@ -24,6 +24,7 @@
 #include "../../CCallback.h"
 
 #include "../CGameInfo.h"
+#include "../../lib/CModHandler.h"
 #include "../../lib/NetPacksLobby.h"
 #include "../../lib/CGeneralTextHandler.h"
 #include "../../lib/mapping/CMapInfo.h"
@@ -134,7 +135,7 @@ void CLobbyScreen::startScenario(bool allowOnlyAI)
 	{
 		logGlobal->warn("Incompatibility exception during start scenario: %s", e.what());
 		
-		auto errorMsg = VLC->generaltexth->translate("vcmi.server.errors.modsIncompatibility") + '\n';
+		auto errorMsg = CGI->generaltexth->translate("vcmi.server.errors.modsIncompatibility") + '\n';
 		errorMsg += e.what();
 		
 		CInfoWindow::showInfoDialog(errorMsg, CInfoWindow::TCompsInfo(), PlayerColor(1));

+ 1 - 1
client/lobby/CSavingScreen.cpp

@@ -25,7 +25,7 @@
 #include "../../lib/StartInfo.h"
 #include "../../lib/filesystem/Filesystem.h"
 #include "../../lib/mapping/CMapInfo.h"
-#include "../../lib/mapping/CMap.h"
+#include "../../lib/mapping/CMapHeader.h"
 
 CSavingScreen::CSavingScreen()
 	: CSelectionBase(ESelectionScreen::saveGame)

+ 1 - 0
client/lobby/CScenarioInfoScreen.cpp

@@ -23,6 +23,7 @@
 #include "../../lib/CGeneralTextHandler.h"
 #include "../../lib/StartInfo.h"
 #include "../../lib/mapping/CMapInfo.h"
+#include "../../lib/mapping/CMapHeader.h"
 
 CScenarioInfoScreen::CScenarioInfoScreen()
 {

+ 1 - 0
client/lobby/CSelectionBase.cpp

@@ -43,6 +43,7 @@
 #include "../../lib/CThreadHelper.h"
 #include "../../lib/filesystem/Filesystem.h"
 #include "../../lib/mapping/CMapInfo.h"
+#include "../../lib/mapping/CMapHeader.h"
 #include "../../lib/serializer/Connection.h"
 
 ISelectionScreenInfo::ISelectionScreenInfo(ESelectionScreen ScreenType)

+ 24 - 22
client/lobby/OptionsTab.cpp

@@ -8,9 +8,9 @@
  *
  */
 #include "StdInc.h"
+#include "OptionsTab.h"
 
 #include "CSelectionBase.h"
-#include "OptionsTab.h"
 
 #include "../CGameInfo.h"
 #include "../CServerHandler.h"
@@ -29,8 +29,8 @@
 #include "../../lib/CArtHandler.h"
 #include "../../lib/CTownHandler.h"
 #include "../../lib/CHeroHandler.h"
-#include "../../lib/mapping/CMap.h"
 #include "../../lib/mapping/CMapInfo.h"
+#include "../../lib/mapping/CMapHeader.h"
 
 OptionsTab::OptionsTab() : humanPlayers(0)
 {
@@ -441,13 +441,15 @@ void OptionsTab::SelectedBox::clickRight(tribool down, bool previousState)
 }
 
 OptionsTab::PlayerOptionsEntry::PlayerOptionsEntry(const PlayerSettings & S, const OptionsTab & parent)
-	: pi(SEL->getPlayerInfo(S.color.getNum())), s(S), parentTab(parent)
+	: pi(std::make_unique<PlayerInfo>(SEL->getPlayerInfo(S.color.getNum())))
+	, s(std::make_unique<PlayerSettings>(S))
+	, parentTab(parent)
 {
 	OBJ_CONSTRUCTION;
 	defActions |= SHARE_POS;
 
 	int serial = 0;
-	for(int g = 0; g < s.color.getNum(); ++g)
+	for(int g = 0; g < s->color.getNum(); ++g)
 	{
 		auto itred = SEL->getPlayerInfo(g);
 		if(itred.canComputerPlay || itred.canHumanPlay)
@@ -458,7 +460,7 @@ OptionsTab::PlayerOptionsEntry::PlayerOptionsEntry(const PlayerSettings & S, con
 	pos.y += 122 + serial * 50;
 
 	assert(CSH->mi && CSH->mi->mapHeader);
-	const PlayerInfo & p = SEL->getPlayerInfo(s.color.getNum());
+	const PlayerInfo & p = SEL->getPlayerInfo(s->color.getNum());
 	assert(p.canComputerPlay || p.canHumanPlay); //someone must be able to control this player
 	if(p.canHumanPlay && p.canComputerPlay)
 		whoCanPlay = HUMAN_OR_CPU;
@@ -478,29 +480,29 @@ OptionsTab::PlayerOptionsEntry::PlayerOptionsEntry(const PlayerSettings & S, con
 		"ADOPOPNL.bmp", "ADOPPPNL.bmp", "ADOPTPNL.bmp", "ADOPSPNL.bmp"
 	}};
 
-	background = std::make_shared<CPicture>(bgs[s.color.getNum()], 0, 0);
-	labelPlayerName = std::make_shared<CLabel>(55, 10, EFonts::FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, s.name);
+	background = std::make_shared<CPicture>(bgs[s->color.getNum()], 0, 0);
+	labelPlayerName = std::make_shared<CLabel>(55, 10, EFonts::FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, s->name);
 	labelWhoCanPlay = std::make_shared<CMultiLineLabel>(Rect(6, 23, 45, (int)graphics->fonts[EFonts::FONT_TINY]->getLineHeight()*2), EFonts::FONT_TINY, ETextAlignment::CENTER, Colors::WHITE, CGI->generaltexth->arraytxt[206 + whoCanPlay]);
 
 	if(SEL->screenType == ESelectionScreen::newGame)
 	{
-		buttonTownLeft = std::make_shared<CButton>(Point(107, 5), "ADOPLFA.DEF", CGI->generaltexth->zelp[132], std::bind(&IServerAPI::setPlayerOption, CSH, LobbyChangePlayerOption::TOWN, -1, s.color));
-		buttonTownRight = std::make_shared<CButton>(Point(168, 5), "ADOPRTA.DEF", CGI->generaltexth->zelp[133], std::bind(&IServerAPI::setPlayerOption, CSH, LobbyChangePlayerOption::TOWN, +1, s.color));
-		buttonHeroLeft = std::make_shared<CButton>(Point(183, 5), "ADOPLFA.DEF", CGI->generaltexth->zelp[148], std::bind(&IServerAPI::setPlayerOption, CSH, LobbyChangePlayerOption::HERO, -1, s.color));
-		buttonHeroRight = std::make_shared<CButton>(Point(244, 5), "ADOPRTA.DEF", CGI->generaltexth->zelp[149], std::bind(&IServerAPI::setPlayerOption, CSH, LobbyChangePlayerOption::HERO, +1, s.color));
-		buttonBonusLeft = std::make_shared<CButton>(Point(259, 5), "ADOPLFA.DEF", CGI->generaltexth->zelp[164], std::bind(&IServerAPI::setPlayerOption, CSH, LobbyChangePlayerOption::BONUS, -1, s.color));
-		buttonBonusRight = std::make_shared<CButton>(Point(320, 5), "ADOPRTA.DEF", CGI->generaltexth->zelp[165], std::bind(&IServerAPI::setPlayerOption, CSH, LobbyChangePlayerOption::BONUS, +1, s.color));
+		buttonTownLeft = std::make_shared<CButton>(Point(107, 5), "ADOPLFA.DEF", CGI->generaltexth->zelp[132], std::bind(&IServerAPI::setPlayerOption, CSH, LobbyChangePlayerOption::TOWN, -1, s->color));
+		buttonTownRight = std::make_shared<CButton>(Point(168, 5), "ADOPRTA.DEF", CGI->generaltexth->zelp[133], std::bind(&IServerAPI::setPlayerOption, CSH, LobbyChangePlayerOption::TOWN, +1, s->color));
+		buttonHeroLeft = std::make_shared<CButton>(Point(183, 5), "ADOPLFA.DEF", CGI->generaltexth->zelp[148], std::bind(&IServerAPI::setPlayerOption, CSH, LobbyChangePlayerOption::HERO, -1, s->color));
+		buttonHeroRight = std::make_shared<CButton>(Point(244, 5), "ADOPRTA.DEF", CGI->generaltexth->zelp[149], std::bind(&IServerAPI::setPlayerOption, CSH, LobbyChangePlayerOption::HERO, +1, s->color));
+		buttonBonusLeft = std::make_shared<CButton>(Point(259, 5), "ADOPLFA.DEF", CGI->generaltexth->zelp[164], std::bind(&IServerAPI::setPlayerOption, CSH, LobbyChangePlayerOption::BONUS, -1, s->color));
+		buttonBonusRight = std::make_shared<CButton>(Point(320, 5), "ADOPRTA.DEF", CGI->generaltexth->zelp[165], std::bind(&IServerAPI::setPlayerOption, CSH, LobbyChangePlayerOption::BONUS, +1, s->color));
 	}
 
 	hideUnavailableButtons();
 
-	if(SEL->screenType != ESelectionScreen::scenarioInfo && SEL->getPlayerInfo(s.color.getNum()).canHumanPlay)
+	if(SEL->screenType != ESelectionScreen::scenarioInfo && SEL->getPlayerInfo(s->color.getNum()).canHumanPlay)
 	{
 		flag = std::make_shared<CButton>(
 			Point(-43, 2),
-			flags[s.color.getNum()],
+			flags[s->color.getNum()],
 			CGI->generaltexth->zelp[180],
-			std::bind(&OptionsTab::onSetPlayerClicked, &parentTab, s)
+			std::bind(&OptionsTab::onSetPlayerClicked, &parentTab, *s)
 		);
 		flag->hoverable = true;
 		flag->block(CSH->isGuest());
@@ -508,9 +510,9 @@ OptionsTab::PlayerOptionsEntry::PlayerOptionsEntry(const PlayerSettings & S, con
 	else
 		flag = nullptr;
 
-	town = std::make_shared<SelectedBox>(Point(119, 2), s, TOWN);
-	hero = std::make_shared<SelectedBox>(Point(195, 2), s, HERO);
-	bonus = std::make_shared<SelectedBox>(Point(271, 2), s, BONUS);
+	town = std::make_shared<SelectedBox>(Point(119, 2), *s, TOWN);
+	hero = std::make_shared<SelectedBox>(Point(195, 2), *s, HERO);
+	bonus = std::make_shared<SelectedBox>(Point(271, 2), *s, BONUS);
 }
 
 void OptionsTab::onSetPlayerClicked(const PlayerSettings & ps) const
@@ -524,9 +526,9 @@ void OptionsTab::PlayerOptionsEntry::hideUnavailableButtons()
 	if(!buttonTownLeft)
 		return;
 
-	const bool foreignPlayer = CSH->isGuest() && !CSH->isMyColor(s.color);
+	const bool foreignPlayer = CSH->isGuest() && !CSH->isMyColor(s->color);
 
-	if((pi.allowedFactions.size() < 2 && !pi.isFactionRandom) || foreignPlayer)
+	if((pi->allowedFactions.size() < 2 && !pi->isFactionRandom) || foreignPlayer)
 	{
 		buttonTownLeft->disable();
 		buttonTownRight->disable();
@@ -537,7 +539,7 @@ void OptionsTab::PlayerOptionsEntry::hideUnavailableButtons()
 		buttonTownRight->enable();
 	}
 
-	if((pi.defaultHero() != -1 || s.castle < 0) //fixed hero
+	if((pi->defaultHero() != -1 || s->castle < 0) //fixed hero
 		|| foreignPlayer) //or not our player
 	{
 		buttonHeroLeft->disable();

+ 11 - 4
client/lobby/OptionsTab.h

@@ -9,8 +9,12 @@
  */
 #pragma once
 
-#include "../../lib/StartInfo.h"
-#include "../../lib/mapping/CMap.h"
+#include "../windows/CWindowObject.h"
+
+VCMI_LIB_NAMESPACE_BEGIN
+struct PlayerSettings;
+struct PlayerInfo;
+VCMI_LIB_NAMESPACE_END
 
 class CSlider;
 class CLabel;
@@ -18,6 +22,9 @@ class CMultiLineLabel;
 class CFilledTexture;
 class CAnimImage;
 class CComponentBox;
+class CTextBox;
+class CButton;
+
 /// The options tab which is shown at the map selection phase.
 class OptionsTab : public CIntObject
 {
@@ -99,8 +106,8 @@ public:
 
 	struct PlayerOptionsEntry : public CIntObject
 	{
-		PlayerInfo pi;
-		PlayerSettings s;
+		std::unique_ptr<PlayerInfo> pi;
+		std::unique_ptr<PlayerSettings> s;
 		std::shared_ptr<CLabel> labelPlayerName;
 		std::shared_ptr<CMultiLineLabel> labelWhoCanPlay;
 		std::shared_ptr<CPicture> background;

+ 3 - 2
client/lobby/RandomMapTab.cpp

@@ -27,7 +27,8 @@
 
 #include "../../lib/CGeneralTextHandler.h"
 #include "../../lib/mapping/CMapInfo.h"
-#include "../../lib/mapping/CMap.h"
+#include "../../lib/mapping/CMapHeader.h"
+#include "../../lib/mapping/MapFormat.h"
 #include "../../lib/rmg/CMapGenOptions.h"
 #include "../../lib/CModHandler.h"
 #include "../../lib/rmg/CRmgTemplateStorage.h"
@@ -137,7 +138,7 @@ void RandomMapTab::updateMapInfoByHost()
 	mapInfo = std::make_shared<CMapInfo>();
 	mapInfo->isRandomMap = true;
 	mapInfo->mapHeader = std::make_unique<CMapHeader>();
-	mapInfo->mapHeader->version = EMapFormat::SOD;
+	mapInfo->mapHeader->version = EMapFormat::VCMI;
 	mapInfo->mapHeader->name = CGI->generaltexth->allTexts[740];
 	mapInfo->mapHeader->description = CGI->generaltexth->allTexts[741];
 	mapInfo->mapHeader->difficulty = 1; // Normal

+ 24 - 5
client/lobby/SelectionTab.cpp

@@ -36,7 +36,8 @@
 #include "../../lib/GameSettings.h"
 #include "../../lib/filesystem/Filesystem.h"
 #include "../../lib/mapping/CMapInfo.h"
-#include "../../lib/mapping/CMap.h"
+#include "../../lib/mapping/CMapHeader.h"
+#include "../../lib/mapping/MapFormat.h"
 #include "../../lib/mapping/CCampaignHandler.h"
 #include "../../lib/serializer/Connection.h"
 
@@ -528,6 +529,26 @@ void SelectionTab::restoreLastSelection()
 	}
 }
 
+bool SelectionTab::isMapSupported(const CMapInfo & info)
+{
+	switch (info.mapHeader->version)
+	{
+		case EMapFormat::ROE:
+			return CGI->settings()->getValue(EGameSettings::MAP_FORMAT_RESTORATION_OF_ERATHIA)["supported"].Bool();
+		case EMapFormat::AB:
+			return CGI->settings()->getValue(EGameSettings::MAP_FORMAT_ARMAGEDDONS_BLADE)["supported"].Bool();
+		case EMapFormat::SOD:
+			return CGI->settings()->getValue(EGameSettings::MAP_FORMAT_SHADOW_OF_DEATH)["supported"].Bool();
+		case EMapFormat::WOG:
+			return CGI->settings()->getValue(EGameSettings::MAP_FORMAT_IN_THE_WAKE_OF_GODS)["supported"].Bool();
+		case EMapFormat::HOTA:
+			return CGI->settings()->getValue(EGameSettings::MAP_FORMAT_HORN_OF_THE_ABYSS)["supported"].Bool();
+		case EMapFormat::VCMI:
+			return CGI->settings()->getValue(EGameSettings::MAP_FORMAT_JSON_VCMI)["supported"].Bool();
+	}
+	return false;
+}
+
 void SelectionTab::parseMaps(const std::unordered_set<ResourceID> & files)
 {
 	logGlobal->debug("Parsing %d maps", files.size());
@@ -539,9 +560,7 @@ void SelectionTab::parseMaps(const std::unordered_set<ResourceID> & files)
 			auto mapInfo = std::make_shared<CMapInfo>();
 			mapInfo->mapInit(file.getName());
 
-			EMapFormat maxSupported = static_cast<EMapFormat>(CGI->settings()->getInteger(EGameSettings::TEXTS_MAP_VERSION));
-
-			if(mapInfo->mapHeader->version == EMapFormat::VCMI || mapInfo->mapHeader->version <= maxSupported)
+			if (isMapSupported(*mapInfo))
 				allItems.push_back(mapInfo);
 		}
 		catch(std::exception & e)
@@ -676,7 +695,7 @@ void SelectionTab::ListItem::updateItem(std::shared_ptr<CMapInfo> info, bool sel
 		labelMapSizeLetter->setText(info->getMapSizeName());
 		labelMapSizeLetter->setColor(color);
 		iconFormat->enable();
-		iconFormat->setFrame(info->getMapSizeFormatIconId().first, info->getMapSizeFormatIconId().second);
+		iconFormat->setFrame(info->getMapSizeFormatIconId());
 		iconVictoryCondition->enable();
 		iconVictoryCondition->setFrame(info->mapHeader->victoryIconIndex, 0);
 		iconLossCondition->enable();

+ 1 - 0
client/lobby/SelectionTab.h

@@ -93,6 +93,7 @@ private:
 	ESelectionScreen tabType;
 	Rect inputNameRect;
 
+	bool isMapSupported(const CMapInfo & info);
 	void parseMaps(const std::unordered_set<ResourceID> & files);
 	void parseSaves(const std::unordered_set<ResourceID> & files);
 	void parseCampaigns(const std::unordered_set<ResourceID> & files);

+ 0 - 1
client/mainmenu/CMainMenu.cpp

@@ -46,7 +46,6 @@
 #include "../../lib/filesystem/Filesystem.h"
 #include "../../lib/filesystem/CCompressedStream.h"
 #include "../../lib/VCMIDirs.h"
-#include "../../lib/mapping/CMap.h"
 #include "../../lib/CStopWatch.h"
 #include "../../lib/NetPacksLobby.h"
 #include "../../lib/CThreadHelper.h"

+ 1 - 1
client/mapView/MapRenderer.cpp

@@ -27,7 +27,7 @@
 #include "../../lib/TerrainHandler.h"
 #include "../../lib/mapObjects/CGHeroInstance.h"
 #include "../../lib/mapObjects/MiscObjects.h"
-#include "../../lib/mapping/CMap.h"
+#include "../../lib/mapping/CMapDefines.h"
 
 struct NeighborTilesInfo
 {

+ 0 - 1
client/mapView/MapView.cpp

@@ -30,7 +30,6 @@
 
 #include "../../lib/CConfigHandler.h"
 #include "../../lib/mapObjects/CGHeroInstance.h"
-#include "../../lib/mapping/CMap.h"
 
 BasicMapView::~BasicMapView() = default;
 

+ 1 - 1
client/windows/GUIClasses.cpp

@@ -46,6 +46,7 @@
 #include "../../CCallback.h"
 
 #include "../lib/mapObjects/CGHeroInstance.h"
+#include "../lib/mapObjects/CGTownInstance.h"
 #include "../lib/CArtHandler.h"
 #include "../lib/CBuildingHandler.h"
 #include "../lib/CConfigHandler.h"
@@ -63,7 +64,6 @@
 #include "../lib/CTownHandler.h"
 #include "../lib/GameConstants.h"
 #include "../lib/bonuses/Bonus.h"
-#include "../lib/mapping/CMap.h"
 #include "../lib/NetPacksBase.h"
 #include "../lib/StartInfo.h"
 #include "../lib/TextOperations.h"

+ 7 - 0
cmake_modules/VCMI_lib.cmake

@@ -85,11 +85,13 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE)
 		${MAIN_LIB_DIR}/mapping/CCampaignHandler.cpp
 		${MAIN_LIB_DIR}/mapping/CDrawRoadsOperation.cpp
 		${MAIN_LIB_DIR}/mapping/CMap.cpp
+		${MAIN_LIB_DIR}/mapping/CMapHeader.cpp
 		${MAIN_LIB_DIR}/mapping/CMapEditManager.cpp
 		${MAIN_LIB_DIR}/mapping/CMapInfo.cpp
 		${MAIN_LIB_DIR}/mapping/CMapOperation.cpp
 		${MAIN_LIB_DIR}/mapping/CMapService.cpp
 		${MAIN_LIB_DIR}/mapping/MapEditUtils.cpp
+		${MAIN_LIB_DIR}/mapping/MapIdentifiersH3M.cpp
 		${MAIN_LIB_DIR}/mapping/MapFeaturesH3M.cpp
 		${MAIN_LIB_DIR}/mapping/MapFormatH3M.cpp
 		${MAIN_LIB_DIR}/mapping/MapReaderH3M.cpp
@@ -205,6 +207,7 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE)
 		${MAIN_LIB_DIR}/CGeneralTextHandler.cpp
 		${MAIN_LIB_DIR}/CHeroHandler.cpp
 		${MAIN_LIB_DIR}/CModHandler.cpp
+		${MAIN_LIB_DIR}/CModVersion.cpp
 		${MAIN_LIB_DIR}/CPathfinder.cpp
 		${MAIN_LIB_DIR}/CPlayerState.cpp
 		${MAIN_LIB_DIR}/CRandomGenerator.cpp
@@ -381,13 +384,16 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE)
 		${MAIN_LIB_DIR}/mapping/CDrawRoadsOperation.h
 		${MAIN_LIB_DIR}/mapping/CMapDefines.h
 		${MAIN_LIB_DIR}/mapping/CMapEditManager.h
+		${MAIN_LIB_DIR}/mapping/CMapHeader.h
 		${MAIN_LIB_DIR}/mapping/CMap.h
 		${MAIN_LIB_DIR}/mapping/CMapInfo.h
 		${MAIN_LIB_DIR}/mapping/CMapOperation.h
 		${MAIN_LIB_DIR}/mapping/CMapService.h
 		${MAIN_LIB_DIR}/mapping/MapEditUtils.h
+		${MAIN_LIB_DIR}/mapping/MapIdentifiersH3M.h
 		${MAIN_LIB_DIR}/mapping/MapFeaturesH3M.h
 		${MAIN_LIB_DIR}/mapping/MapFormatH3M.h
+		${MAIN_LIB_DIR}/mapping/MapFormat.h
 		${MAIN_LIB_DIR}/mapping/MapReaderH3M.h
 		${MAIN_LIB_DIR}/mapping/MapFormatJson.h
 		${MAIN_LIB_DIR}/mapping/ObstacleProxy.h
@@ -497,6 +503,7 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE)
 		${MAIN_LIB_DIR}/CGeneralTextHandler.h
 		${MAIN_LIB_DIR}/CHeroHandler.h
 		${MAIN_LIB_DIR}/CModHandler.h
+		${MAIN_LIB_DIR}/CModVersion.h
 		${MAIN_LIB_DIR}/CondSh.h
 		${MAIN_LIB_DIR}/ConstTransitivePtr.h
 		${MAIN_LIB_DIR}/Color.h

+ 0 - 61
config/buildings5.json

@@ -1,61 +0,0 @@
-{
-	// Conversion table of buildings between vcmi and H3
-	"table": [
-		{ "town": -1, "h3": 0, "vcmi": 11 },
-		{ "town": -1, "h3": 1, "vcmi": 12 },
-		{ "town": -1, "h3": 2, "vcmi": 13 },
-		{ "town": -1, "h3": 3, "vcmi": 7 },
-		{ "town": -1, "h3": 4, "vcmi": 8 },
-		{ "town": -1, "h3": 5, "vcmi": 9 },
-		{ "town": -1, "h3": 6, "vcmi": 5 },
-		{ "town": -1, "h3": 7, "vcmi": 16 },
-		{ "town": -1, "h3": 8, "vcmi": 14 },
-		{ "town": -1, "h3": 9, "vcmi": 15 },
-		{ "town": -1, "h3": 10, "vcmi": 17 },
-		{ "town": -1, "h3": 11, "vcmi": 0 },
-		{ "town": -1, "h3": 12, "vcmi": 1 },
-		{ "town": -1, "h3": 13, "vcmi": 2 },
-		{ "town": -1, "h3": 14, "vcmi": 3 },
-		{ "town": -1, "h3": 15, "vcmi": 4 },
-		{ "town": -1, "h3": 16, "vcmi": 6 },
-		{ "town": -1, "h3": 17, "vcmi": 26 },
-		{ "town": -1, "h3": 18, "vcmi": 17 },
-		{ "town": -1, "h3": 19, "vcmi": 22 },
-		{ "town": -1, "h3": 20, "vcmi": 22 },
-		{ "town": -1, "h3": 21, "vcmi": 23 },
-		{ "town": -1, "h3": 22, "vcmi": 30 },
-		{ "town": -1, "h3": 23, "vcmi": 37 },
-		{ "town": -1, "h3": 24, "vcmi": -1 },
-		{ "town": -1, "h3": 25, "vcmi": 31 },
-		{ "town": -1, "h3": 26, "vcmi": 38 },
-		{ "town": -1, "h3": 27, "vcmi": -2 },
-		{ "town": -1, "h3": 28, "vcmi": 32 },
-		{ "town": -1, "h3": 29, "vcmi": 39 },
-		{ "town": -1, "h3": 30, "vcmi": -3 },
-		{ "town": -1, "h3": 31, "vcmi": 33 },
-		{ "town": -1, "h3": 32, "vcmi": 40 },
-		{ "town": -1, "h3": 33, "vcmi": -4 },
-		{ "town": -1, "h3": 34, "vcmi": 34 },
-		{ "town": -1, "h3": 35, "vcmi": 41 },
-		{ "town": -1, "h3": 36, "vcmi": -5 },
-		{ "town": -1, "h3": 37, "vcmi": 35 },
-		{ "town": -1, "h3": 38, "vcmi": 42 },
-		{ "town": -1, "h3": 39, "vcmi": 36 },
-		{ "town": -1, "h3": 40, "vcmi": 43 },
-		{ "town": 0, "h3": 20, "vcmi": 21 },
-		{ "town": 1, "h3": 19, "vcmi": 21 },
-		{ "town": 2, "h3": 18, "vcmi": 22 },
-		{ "town": 2, "h3": 19, "vcmi": 23 },
-		{ "town": 2, "h3": 20, "vcmi": 21 },
-		{ "town": 3, "h3": 20, "vcmi": 23 },
-		{ "town": 3, "h3": 18, "vcmi": 21 },
-		{ "town": 4, "h3": 19, "vcmi": 21 },
-		{ "town": 5, "h3": 20, "vcmi": 23 },
-		{ "town": 5, "h3": 18, "vcmi": 21 },
-		{ "town": 6, "h3": 19, "vcmi": 21 },
-		{ "town": 7, "h3": 20, "vcmi": 17 },
-		{ "town": 7, "h3": 18, "vcmi": 22 },
-		{ "town": 7, "h3": 19, "vcmi": 21 },
-		{ "town": 8, "h3": 18, "vcmi": 21 }
-	]
-}

+ 123 - 2
config/gameConfig.json

@@ -84,7 +84,7 @@
 	],
 	"skills" :
 	[
-        "config/skills.json"
+		"config/skills.json"
 	],
 	"terrains":
 	[
@@ -122,7 +122,128 @@
 			"terrain"    : 10,
 			"river"      : 5,
 			"road"       : 4,
-			"mapVersion" : 28 // max supported version, SoD
+		},
+		
+		"mapFormat" : {
+			"restorationOfErathia" : { 
+				"supported" : true,
+				"iconIndex" : 0,
+
+				"buildingsCommon": {
+					"townHall"       : 0,
+					"cityHall"       : 1,
+					"capitol"        : 2,
+
+					"fort"           : 3,
+					"citadel"        : 4,
+					"castle"         : 5,
+
+					"tavern"         : 6,
+					"blacksmith"     : 7,
+					"marketplace"    : 8,
+					"resourceSilo"   : 9,
+
+					"mageGuild1"     : 11,
+					"mageGuild2"     : 12,
+					"mageGuild3"     : 13,
+					"mageGuild4"     : 14,
+					"mageGuild5"     : 15,
+
+					"shipyard"       : 16,
+					"grail"          : 17,
+
+					"dwellingLvl1"   : 22,
+					"dwellingUpLvl1" : 23,
+					"horde1"         : 24,
+					"dwellingLvl2"   : 25,
+					"dwellingUpLvl2" : 26,
+					"horde2"         : 27,
+					"dwellingLvl3"   : 28,
+					"dwellingUpLvl3" : 29,
+					"horde3"         : 30,
+					"dwellingLvl4"   : 31,
+					"dwellingUpLvl4" : 32,
+					"horde4"         : 33,
+					"dwellingLvl5"   : 34,
+					"dwellingUpLvl5" : 35,
+					"horde5"         : 36,
+
+					"dwellingLvl6"   : 37,
+					"dwellingUpLvl6" : 38,
+					"dwellingLvl7"   : 39,
+					"dwellingUpLvl7" : 40
+				},
+
+				"buildings" : {
+					"castle" : {
+						"special1" : 18, // lighthouse
+						"special2" : 20, // stables
+						"special3" : 19  // brotherhoodOfSword
+					},
+					"rampart" : {
+						"special1" : 18, // mysticPond
+						"special2" : 19, // fountainOfFortune
+						"special3" : 20  // treasury
+					},
+					"tower" : {
+						"special1" : 10, // artifactMerchants
+						"special2" : 20, // lookoutTower
+						"special3" : 18, // library
+						"special4" : 19  // wallOfKnowledge
+					},
+					"inferno" : {
+						"special2" : 18, // brimstoneStormclouds
+						"special3" : 19, // castleGate
+						"special4" : 20  // orderOfFire
+					},
+					"necropolis" : {
+						"special1" : 18, // coverOfDarkness
+						"special2" : 19, // necromancyAmplifier
+						"special3" : 20  // skeletonTransformer
+					},
+					"dungeon" : {
+						"special1" : 10, // artifactMerchants
+						"special2" : 18, // manaVortex
+						"special3" : 19, // portalOfSummoning
+						"special4" : 20  // battleScholarAcademy
+					},
+					"stronghold" : {
+						"special1" : 18, // escapeTunnel
+						"special2" : 19, // freelancersGuild
+						"special3" : 20, // ballistaYard
+						"special4" : 21  // hallOfValhalla
+					},
+					"fortress" : {
+						"special1" : 20, // cageOfWarlords
+						"special2" : 19, // bloodObelisk
+						"special3" : 18  // glyphsOfFear
+					}
+				}
+			},
+			"armageddonsBlade" : {
+				"supported" : true,
+				"iconIndex" : 1,
+				"buildings" : {
+					"conflux" : {
+						"special1" : 10, // artifactMerchants
+						"special2" : 18  // magicUniversity
+					}
+				}
+			},
+			"shadowOfDeath" : { 
+				"supported" : true,
+				"iconIndex" : 2
+			},
+			"jsonVCMI" : { 
+				"supported" : true,
+				"iconIndex" : 3
+			},
+			"hornOfTheAbyss" : { 
+				"supported" : false
+			},
+			"inTheWakeOfGods" : { 
+				"supported" : false
+			}
 		},
 
 		"heroes" :

+ 0 - 379
config/objects/hotaObjects.json

@@ -1,379 +0,0 @@
-// REFERENCE ONLY - THIS CONFIG FILE IS NOT USED BY VCMI
-// CONTAINS LIST OF HOTA OBJECTS AND THEIR H3M IDENTIFIERS
-
-{
-	"boat" : {
-		"lastReservedIndex" : 5,
-		"types" : {
-			//NOTE: H3 range: 0-2
-			"hotaBoat4" : {
-				"index" : 3
-			},
-			"hotaBoat5" : {
-				"index" : 4
-			},
-			"hotaBoat6" : {
-				"index" : 5
-			}
-		}
-	},
-
-	"hillFort" : {
-		"lastReservedIndex" : 1,
-		"types" : {
-			"hotaHillFort" : {
-				"index" : 1
-			}
-		}
-	},
-
-	"schoolOfMagic" : {
-		"lastReservedIndex" : 1,
-		"types" : {
-			"hotaSchoolOfMagic" : {
-				"index" : 1
-			}
-		}
-	},
-
-	"creatureBank" : {
-		"lastReservedIndex" : 26,
-		"types" : {
-			//NOTE: H3 range: 0-6
-			"hotaBeholderSanctuary" : {
-				"index" : 21
-			},
-			"hotaTempleOfTheSea" : {
-				"index" : 22
-			},
-			"hotaPirateCave" : {
-				"index" : 23
-			},
-			"hotaMansion" : {
-				"index" : 24
-			},
-			"hotaSpit" : {
-				"index" : 25
-			},
-			"hotaRedTower" : {
-				"index" : 26
-			}
-		}
-	},
-
-	"hotaIce" : {
-		"index" : 40,
-		"handler": "static",
-		"lastReservedIndex" : 7,
-		"types" : {
-			"hotaIce1" : {
-				"index" : 0
-			},
-			"hotaIce2" : {
-				"index" : 1
-			},
-			"hotaIce3" : {
-				"index" : 2
-			},
-			"hotaIce4" : {
-				"index" : 3
-			},
-			"hotaIce5" : {
-				"index" : 4
-			},
-			"hotaIce6" : {
-				"index" : 5
-			},
-			"hotaIce7" : {
-				"index" : 6
-			}
-			"hotaIce8" : {
-				"index" : 7
-			}
-		}
-	},
-	
-	"hotaStatic" : {
-		"index" :139,
-		"handler": "static",
-		"lastReservedIndex" : 26,
-		"types" : {
-			"hotaCrates0" : {
-				"index" : 0
-			},
-			"hotaCrates1" : {
-				"index" : 1
-			},
-			"hotaBag" : {
-				"index" : 2
-			},
-			"hotaCrates3" : {
-				"index" : 3
-			},
-			"hotaJaws" : {
-				"index" : 4
-			},
-			"hotaRopesPile" : {
-				"index" : 5
-			},
-			"hotaFrog" : {
-				"index" : 6
-			},
-			"hotaFrogs" : {
-				"index" : 7
-			},
-			"hotaHen" : {
-				"index" : 8
-			},
-			"hotaRooster" : {
-				"index" : 9
-			},
-			"hotaPortu" : {
-				"index" : 10
-			},
-			"hotaDestroyedMercenaryCamp" : {
-				"index" : 11
-			},
-			"hotaDestroyedFountain" : {
-				"index" : 12
-			},
-			"hotaPig" : {
-				"index" : 13
-			},
-			"hotaHornAltar" : {
-				"index" : 14
-			},
-			"hotaBoatWreckage" : {
-				"index" : 15
-			},
-			"hotaPalisade" : {
-				"index" : 16
-			},
-			"hotaWaterfall" : {
-				"index" : 17
-			},
-			"hotaFlames" : {
-				"index" : 18
-			},
-			"hotaDestroyedUndegroundGate" : {
-				"index" : 19
-			},
-			"hotaPredatoryPlant" : {
-				"index" : 20
-			},
-			"hotaBridge" : {
-				"index" : 21
-			},
-			"hotaBones" : {
-				"index" : 22
-			},
-			"hotaPond" : {
-				"index" : 24
-			},
-			"hotaPillar" : {
-				"index" : 25
-			},
-			"hotaPond2" : {
-				"index" : 26
-			}
-		}
-	},
-
-	"hotaNature" : {
-		"index" :140,
-		"handler": "static",
-		"lastReservedIndex" : 8,
-		"types" : {
-			"hotaWaterball" : {
-				"index" : 0
-			},
-			"hotaRock" : {
-				"index" : 1
-			},
-			"hotaTreesTropical" : {
-				"index" : 2
-			},
-			"hotaIce" : {
-				"index" : 3
-			},
-			"hotaMissing" : {
-				"index" : 4
-			},
-			"hotaSnowHill" : {
-				"index" : 5
-			},
-			"hotaMountains" : {
-				"index" : 6
-			},
-			"hotaTrees" : {
-				"index" : 7
-			},
-			"hotaLakeWater" : {
-				"index" : 8
-			}
-		}
-	},
-
-	"hotaTerrains" : {
-		"index" :141,
-		"handler": "static",
-		"lastReservedIndex" : 2,
-		"types" : {
-			"hotaIce" : {
-				"index" : 0
-			},
-			"hotaDunes" : {
-				"index" : 1
-			},
-			"hotaFieldsOfGlory" : {
-				"index" : 2
-			}
-		}
-	},
-
-	"hotaWarehouses" : {
-		"index" :142,
-		"handler": "static",
-		"lastReservedIndex" : 6,
-		"types" : {
-			"hotaWarehouseWood" : {
-				"index" : 0
-			},
-			"hotaWarehouseMercury" : {
-				"index" : 1
-			},
-			"hotaWarehouseOre" : {
-				"index" : 2
-			},
-			"hotaWarehouseSulfur" : {
-				"index" : 3
-			},
-			"hotaWarehouseCrystal" : {
-				"index" : 4
-			},
-			"hotaWarehouseGems" : {
-				"index" : 5
-			},
-			"hotaWarehouseGold" : {
-				"index" : 6
-			}
-		}
-	},
-
-	"hotaInteractive" : {
-		"index" :144,
-		"handler": "static",
-		"lastReservedIndex" : 11,
-		"types" : {
-			"hotaTempleOfLoyalty" : {
-				"index" : 0
-			},
-			"hotaSkeletonTransformer" : {
-				"index" : 1
-			},
-			"hotaMagicArena" : {
-				"index" : 2
-			},
-			"hotaWateringPlace" : {
-				"index" : 3
-			},
-			"hotaMineralSpring" : {
-				"index" : 4
-			},
-			"hotaHermitShack" : {
-				"index" : 5
-			},
-			"hotaGazebo" : {
-				"index" : 6
-			},
-			"hotaJunkman" : {
-				"index" : 7
-			},
-			"hotaDerrick" : {
-				"index" : 8
-			},
-			"hotaWarlockLab" : {
-				"index" : 9
-			},
-			"hotaProspector" : {
-				"index" : 10
-			},
-			"hotaTrailblazer" : {
-				"index" : 11
-			}
-		}
-	},
-
-	"hotaWaterObjects" : {
-		"index" :145,
-		"handler": "static",
-		"lastReservedIndex" : 3,
-		"types" : {
-			"hotaGenieBottle" : {
-				"index" : 0
-			},
-			"hotaBarrelWater" : {
-				"index" : 1
-			},
-			"hotaCrateWater" : {
-				"index" : 2
-			},
-			"hotaManaBottle" : {
-				"index" : 3
-			}
-		}
-	},
-
-	"hotaInteractive2" : {
-		"index" :146,
-		"handler": "static",
-		"lastReservedIndex" : 3,
-		"types" : {
-			"hotaWarAcademy" : {
-				"index" : 0
-			},
-			"hotaObservatory" : {
-				"index" : 1
-			},
-			"hotaAltarOfMana" : {
-				"index" : 2
-			}
-			"hotaTownGates" : {
-				"index" : 3
-			}
-		}
-	},
-	
-	"hotaStatic2" : {
-		"index" :154,
-		"handler": "static",
-		"lastReservedIndex" : 1,
-		"types" : {
-			"hotaOilLake" : {
-				"index" : 0
-			}
-		}
-	},
-
-	"hotaLyuc" : {
-		"index" :160,
-		"handler": "static",
-		"lastReservedIndex" : 1,
-		"types" : {
-			"hotaLyuc" : {
-				"index" : 0
-			}
-		}
-	},
-
-	"hotaLyuc2" : {
-		"index" :204,
-		"handler": "static",
-		"lastReservedIndex" : 1,
-		"types" : {
-			"hotaLyuc2" : {
-				"index" : 0
-			}
-		}
-	}
-}

+ 7 - 13
config/objects/moddables.json

@@ -109,39 +109,33 @@
 		"lastReservedIndex" : 2,
 		"base" : {
 			"aiValue" : 0,
+			"layer" : "sail",
+			"onboardAssaultAllowed" : true,
+			"onboardVisitAllowed" : true,
 			"base" : {
 				"visitableFrom" : [ "+++", "+-+", "+++" ],
 				"mask" : [ "VVV", "VAV" ]
 			}
 		},
 		"types" : {
-			"evil" : 
+			"evil" : // Necropolis
 			{ 
-				"index" : 0,	
-				"layer" : "sail",
+				"index" : 0,
 				"actualAnimation" : "AB01_.def",
 				"overlayAnimation" : "ABM01_.def",
-				"onboardAssaultAllowed" : true,
-				"onboardVisitAllowed" : true,
 				"flagAnimations" : ["ABF01L", "ABF01G", "ABF01R", "ABF01D", "ABF01B", "ABF01P", "ABF01W", "ABF01K"]
 			},
-			"good" : 
+			"good" : // Castle
 			{ 
 				"index" : 1, 
-				"layer" : "sail",
 				"actualAnimation" : "AB02_.def",
 				"overlayAnimation" : "ABM02_.def",
-				"onboardAssaultAllowed" : true,
-				"onboardVisitAllowed" : true,
 				"flagAnimations" : ["ABF02L", "ABF02G", "ABF02R", "ABF02D", "ABF02B", "ABF02P", "ABF02W", "ABF02K"]
 			},
-			"neutral" : { 
+			"neutral" : {  // Fortress
 				"index" : 2, 
-				"layer" : "sail",
 				"actualAnimation" : "AB03_.def",
 				"overlayAnimation" : "ABM03_.def",
-				"onboardAssaultAllowed" : true,
-				"onboardVisitAllowed" : true,
 				"flagAnimations" : ["ABF03L", "ABF03G", "ABF03R", "ABF03D", "ABF03B", "ABF03P", "ABF03W", "ABF03K"]
 			},
 		}

+ 20 - 20
config/terrainViewPatterns.json

@@ -34,7 +34,7 @@
 				"N", "N", "T",
 				"N", "T", "T"
 			],
-			"mapping" : { "normal" : "73,74", "dirt" : "45" }
+			"mapping" : { "normal" : "73,74", "dirt" : "45", "hota" : "118,119" }
 		},
 		{
 			"id" : "x2",
@@ -44,7 +44,7 @@
 				"D", "N", "N",
 				"N", "N", "S"
 			],
-			"mapping" : { "normal" : "75" }
+			"mapping" : { "normal" : "75", "hota" : "120" }
 		},
 		{
 			"id" : "x3",
@@ -54,7 +54,7 @@
 				"S", "N", "N",
 				"N", "N", "D"
 			],
-			"mapping" : { "normal" : "76" }
+			"mapping" : { "normal" : "76", "hota" : "121" }
 		},
 		{
 			"id" : "x4",
@@ -64,7 +64,7 @@
 				"N", "N", "D",
 				"S", "D", "D"
 			],
-			"mapping" : { "normal" : "77" }
+			"mapping" : { "normal" : "77", "hota" : "122" }
 		},
 		{
 			"id" : "x5",
@@ -74,7 +74,7 @@
 				"N", "N", "D",
 				"D", "D", "S"
 			],
-			"mapping" : { "normal" : "78" }
+			"mapping" : { "normal" : "78", "hota" : "123" }
 		},
 		// No transition
 		{
@@ -85,7 +85,7 @@
 				"N", "N", "N",
 				"N", "N", "N"
 			],
-			"mapping" : { "normal" : "49-72", "dirt" : "21-44", "sand" : "0-23", "water" : "20-32", "rock": "0-7" }
+			"mapping" : { "normal" : "49-72", "dirt" : "21-44", "sand" : "0-23", "water" : "20-32", "rock": "0-7", "hota" : "77-117" }
 		},
 		// Mixed transitions
 		{
@@ -96,7 +96,7 @@
 				"N", "N", "N",
 				"N", "N", "T"
 			],
-			"mapping" : { "normal" : "40, 42", "dirt" : "20" }
+			"mapping" : { "normal" : "40, 42", "dirt" : "20", "hota" : "68, 70" }
 		},
 		{
 			"id" : "m2",
@@ -106,7 +106,7 @@
 				"N", "N", "N",
 				"N", "N", "S"
 			],
-			"mapping" : { "normal" : "41" }
+			"mapping" : { "normal" : "41", "hota" : "69" }
 		},
 		{
 			"id" : "m3",
@@ -116,7 +116,7 @@
 				"N", "N", "D",
 				"S", "D,N", "D,N"
 			],
-			"mapping" : { "normal" : "43" }
+			"mapping" : { "normal" : "43", "hota" : "71" }
 		},
 		{
 			"id" : "m4",
@@ -126,7 +126,7 @@
 				"N", "N", "D",
 				"D,N", "D", "D,N"
 			],
-			"mapping" : { "normal" : "44" }
+			"mapping" : { "normal" : "44", "hota" : "72" }
 		},
 		{
 			"id" : "m5",
@@ -136,7 +136,7 @@
 				"N", "N", "D",
 				"N", "N", "S"
 			],
-			"mapping" : { "normal" : "45" }
+			"mapping" : { "normal" : "45", "hota" : "73" }
 		},
 		{
 			"id" : "m6",
@@ -146,7 +146,7 @@
 				"N", "N", "N",
 				"D,N", "D", "S"
 			],
-			"mapping" : { "normal" : "46" }
+			"mapping" : { "normal" : "46", "hota" : "74" }
 		},
 		{
 			"id" : "m7",
@@ -157,7 +157,7 @@
 				"D-1,N", "D-1,N", "?"
 			],
 			"minPoints" : 1,
-			"mapping" : { "normal" : "47" }
+			"mapping" : { "normal" : "47", "hota" : "75" }
 		},
 		{
 			"id" : "m8",
@@ -168,7 +168,7 @@
 				"?", "S", "?"
 			],
 			"minPoints" : 1,
-			"mapping" : { "normal" : "48" }
+			"mapping" : { "normal" : "48", "hota" : "76" }
 		},
 		// Standard transitions
 		{
@@ -179,7 +179,7 @@
 				"T", "N", "N",
 				"?", "N", "N"
 			],
-			"mapping" : { "normal" : "4-7, 24-27", "dirt" : "4-7", "water" : "4-7", "rock": "2D:16-19" }
+			"mapping" : { "normal" : "4-7, 24-27", "dirt" : "4-7", "water" : "4-7", "rock": "2D:16-19", "hota" : "6-13, 40-47" }
 		},
 		{
 			"id" : "s3",
@@ -189,7 +189,7 @@
 				"N", "N", "N",
 				"N", "N", "N"
 			],
-			"mapping" : { "normal" : "8-11, 28-31", "dirt" : "8-11", "water" : "8-11", "rock": "2D:20-23" }
+			"mapping" : { "normal" : "8-11, 28-31", "dirt" : "8-11", "water" : "8-11", "rock": "2D:20-23", "hota" : "14-21,48-55" }
 		},
 		{
 			"id" : "s4",
@@ -200,7 +200,7 @@
 				"N", "s2-1,m7-1,m8-1", "T"
 			],
 			"minPoints" : 2,
-			"mapping" : { "normal" : "12-15, 32-35", "dirt" : "12-15", "water" : "12-15", "rock": "4D:24-31" }
+			"mapping" : { "normal" : "12-15, 32-35", "dirt" : "12-15", "water" : "12-15", "rock": "4D:24-31", "hota" : "22-27,56-61" }
 		},
 		{
 			"id" : "s5",
@@ -211,7 +211,7 @@
 				"?,x1-1,s1-1", "s6-1,m1-1,m2-1,N", "N"
 			],
 			"minPoints" : 1,
-			"mapping" : { "normal" : "16-17, 36-37", "dirt" : "16-17", "water" : "16-17", "rock": "4D:32-39" }
+			"mapping" : { "normal" : "16-17, 36-37", "dirt" : "16-17", "water" : "16-17", "rock": "4D:32-39", "hota" : "28-30,62-64" }
 		},
 		{
 			"id" : "s6",
@@ -222,7 +222,7 @@
 				"N", "s5-1,N", "T"
 			],
 			"minPoints" : 1,
-			"mapping" : { "normal" : "18-19, 38-39", "dirt" : "18-19", "water" : "18-19", "rock": "4D:40-47" }
+			"mapping" : { "normal" : "18-19, 38-39", "dirt" : "18-19", "water" : "18-19", "rock": "4D:40-47", "hota" : "31-33,65-67" }
 		},
 		{
 			"id" : "s1",
@@ -232,7 +232,7 @@
 				"?", "N", "N",
 				"T", "N", "N"
 			],
-			"mapping" : { "normal" : "0-3, 20-23", "dirt" : "0-3", "water" : "0-3", "rock": "4D:8-15" }
+			"mapping" : { "normal" : "0-3, 20-23", "dirt" : "0-3", "water" : "0-3", "rock": "4D:8-15", "hota" : "0-5,34-39" }
 		}
 	],
 	"terrainType" :

+ 13 - 8
lib/CGameState.cpp

@@ -1752,6 +1752,10 @@ void CGameState::initTowns()
 			vti->setNameTranslated(vti->getTown()->getRandomNameTranslated(nameID));
 		}
 
+		static const BuildingID basicDwellings[] = { BuildingID::DWELL_FIRST, BuildingID::DWELL_LVL_2, BuildingID::DWELL_LVL_3, BuildingID::DWELL_LVL_4, BuildingID::DWELL_LVL_5, BuildingID::DWELL_LVL_6, BuildingID::DWELL_LVL_7 };
+		static const BuildingID upgradedDwellings[] = { BuildingID::DWELL_UP_FIRST, BuildingID::DWELL_LVL_2_UP, BuildingID::DWELL_LVL_3_UP, BuildingID::DWELL_LVL_4_UP, BuildingID::DWELL_LVL_5_UP, BuildingID::DWELL_LVL_6_UP, BuildingID::DWELL_LVL_7_UP };
+		static const BuildingID hordes[] = { BuildingID::HORDE_PLACEHOLDER1, BuildingID::HORDE_PLACEHOLDER2, BuildingID::HORDE_PLACEHOLDER3, BuildingID::HORDE_PLACEHOLDER4, BuildingID::HORDE_PLACEHOLDER5, BuildingID::HORDE_PLACEHOLDER6, BuildingID::HORDE_PLACEHOLDER7 };
+
 		//init buildings
 		if(vstd::contains(vti->builtBuildings, BuildingID::DEFAULT)) //give standard set of buildings
 		{
@@ -1762,8 +1766,6 @@ void CGameState::initTowns()
 
 			auto definesBuildingsChances = VLC->settings()->getVector(EGameSettings::TOWNS_STARTING_DWELLING_CHANCES);
 
-			BuildingID basicDwellings[] = { BuildingID::DWELL_FIRST, BuildingID::DWELL_LVL_2, BuildingID::DWELL_LVL_3, BuildingID::DWELL_LVL_4, BuildingID::DWELL_LVL_5, BuildingID::DWELL_LVL_6, BuildingID::DWELL_LVL_7 };
-
 			for(int i = 0; i < definesBuildingsChances.size(); i++)
 			{
 				if((getRandomGenerator().nextInt(1,100) <= definesBuildingsChances[i]))
@@ -1773,23 +1775,26 @@ void CGameState::initTowns()
 			}
 		}
 
+		// village hall must always exist
+		vti->builtBuildings.insert(BuildingID::VILLAGE_HALL);
+
 		//init hordes
 		for (int i = 0; i < GameConstants::CREATURES_PER_TOWN; i++)
 		{
-			if (vstd::contains(vti->builtBuildings, (BuildingID::HORDE_PLACEHOLDER1 - i))) //if we have horde for this level
+			if (vstd::contains(vti->builtBuildings, hordes[i])) //if we have horde for this level
 			{
-				vti->builtBuildings.erase(BuildingID(BuildingID::HORDE_PLACEHOLDER1 - i));//remove old ID
+				vti->builtBuildings.erase(hordes[i]);//remove old ID
 				if (vti->getTown()->hordeLvl.at(0) == i)//if town first horde is this one
 				{
 					vti->builtBuildings.insert(BuildingID::HORDE_1);//add it
 					//if we have upgraded dwelling as well
-					if (vstd::contains(vti->builtBuildings, (BuildingID::DWELL_UP_FIRST + i)))
+					if (vstd::contains(vti->builtBuildings, upgradedDwellings[i]))
 						vti->builtBuildings.insert(BuildingID::HORDE_1_UPGR);//add it as well
 				}
 				if (vti->getTown()->hordeLvl.at(1) == i)//if town second horde is this one
 				{
 					vti->builtBuildings.insert(BuildingID::HORDE_2);
-					if (vstd::contains(vti->builtBuildings, (BuildingID::DWELL_UP_FIRST + i)))
+					if (vstd::contains(vti->builtBuildings, upgradedDwellings[i]))
 						vti->builtBuildings.insert(BuildingID::HORDE_2_UPGR);
 				}
 			}
@@ -1815,9 +1820,9 @@ void CGameState::initTowns()
 		for(CCastleEvent &ev : vti->events)
 		{
 			for (int i = 0; i<GameConstants::CREATURES_PER_TOWN; i++)
-				if (vstd::contains(ev.buildings,(-31-i))) //if we have horde for this level
+				if (vstd::contains(ev.buildings,hordes[i])) //if we have horde for this level
 				{
-					ev.buildings.erase(BuildingID(-31-i));
+					ev.buildings.erase(hordes[i]);
 					if (vti->getTown()->hordeLvl.at(0) == i)
 						ev.buildings.insert(BuildingID::HORDE_1);
 					if (vti->getTown()->hordeLvl.at(1) == i)

+ 5 - 52
lib/CModHandler.cpp

@@ -582,53 +582,6 @@ JsonNode addMeta(JsonNode config, const std::string & meta)
 	return config;
 }
 
-CModInfo::Version CModInfo::Version::GameVersion()
-{
-	return Version(VCMI_VERSION_MAJOR, VCMI_VERSION_MINOR, VCMI_VERSION_PATCH);
-}
-
-CModInfo::Version CModInfo::Version::fromString(std::string from)
-{
-	int major = 0;
-	int minor = 0;
-	int patch = 0;
-	try
-	{
-		auto pointPos = from.find('.');
-		major = std::stoi(from.substr(0, pointPos));
-		if(pointPos != std::string::npos)
-		{
-			from = from.substr(pointPos + 1);
-			pointPos = from.find('.');
-			minor = std::stoi(from.substr(0, pointPos));
-			if(pointPos != std::string::npos)
-				patch = std::stoi(from.substr(pointPos + 1));
-		}
-	}
-	catch(const std::invalid_argument &)
-	{
-		return Version();
-	}
-	return Version(major, minor, patch);
-}
-
-std::string CModInfo::Version::toString() const
-{
-	return std::to_string(major) + '.' + std::to_string(minor) + '.' + std::to_string(patch);
-}
-
-bool CModInfo::Version::compatible(const Version & other, bool checkMinor, bool checkPatch) const
-{
-	return  (major == other.major &&
-			(!checkMinor || minor >= other.minor) &&
-			(!checkPatch || minor > other.minor || (minor == other.minor && patch >= other.patch)));
-}
-
-bool CModInfo::Version::isNull() const
-{
-	return major == 0 && minor == 0 && patch == 0;
-}
-
 CModInfo::CModInfo():
 	checksum(0),
 	explicitlyEnabled(false),
@@ -650,11 +603,11 @@ CModInfo::CModInfo(const std::string & identifier, const JsonNode & local, const
 	validation(PENDING),
 	config(addMeta(config, identifier))
 {
-	version = Version::fromString(config["version"].String());
+	version = CModVersion::fromString(config["version"].String());
 	if(!config["compatibility"].isNull())
 	{
-		vcmiCompatibleMin = Version::fromString(config["compatibility"]["min"].String());
-		vcmiCompatibleMax = Version::fromString(config["compatibility"]["max"].String());
+		vcmiCompatibleMin = CModVersion::fromString(config["compatibility"]["min"].String());
+		vcmiCompatibleMax = CModVersion::fromString(config["compatibility"]["max"].String());
 	}
 
 	if (!config["language"].isNull())
@@ -715,8 +668,8 @@ void CModInfo::loadLocalData(const JsonNode & data)
 	}
 
 	//check compatibility
-	implicitlyEnabled &= (vcmiCompatibleMin.isNull() || Version::GameVersion().compatible(vcmiCompatibleMin));
-	implicitlyEnabled &= (vcmiCompatibleMax.isNull() || vcmiCompatibleMax.compatible(Version::GameVersion()));
+	implicitlyEnabled &= (vcmiCompatibleMin.isNull() || CModVersion::GameVersion().compatible(vcmiCompatibleMin));
+	implicitlyEnabled &= (vcmiCompatibleMax.isNull() || vcmiCompatibleMax.compatible(CModVersion::GameVersion()));
 
 	if(!implicitlyEnabled)
 		logGlobal->warn("Mod %s is incompatible with current version of VCMI and cannot be enabled", name);

+ 4 - 27
lib/CModHandler.h

@@ -10,6 +10,7 @@
 #pragma once
 
 #include "JsonNode.h"
+#include "CModVersion.h"
 
 #ifdef __UCLIBC__
 #undef major
@@ -185,30 +186,6 @@ public:
 		FAILED,
 		PASSED
 	};
-	
-	struct DLL_LINKAGE Version
-	{
-		int major = 0;
-		int minor = 0;
-		int patch = 0;
-		
-		Version() = default;
-		Version(int mj, int mi, int p): major(mj), minor(mi), patch(p) {}
-		
-		static Version GameVersion();
-		static Version fromString(std::string from);
-		std::string toString() const;
-		
-		bool compatible(const Version & other, bool checkMinor = false, bool checkPatch = false) const;
-		bool isNull() const;
-		
-		template <typename Handler> void serialize(Handler &h, const int version)
-		{
-			h & major;
-			h & minor;
-			h & patch;
-		}
-	};
 
 	/// identifier, identical to name of folder with mod
 	std::string identifier;
@@ -218,14 +195,14 @@ public:
 	std::string description;
 	
 	/// version of the mod
-	Version version;
+	CModVersion version;
 
 	/// Base language of mod, all mod strings are assumed to be in this language
 	std::string baseLanguage;
 	
 	/// vcmi versions compatible with the mod
 
-	Version vcmiCompatibleMin, vcmiCompatibleMax;
+	CModVersion vcmiCompatibleMin, vcmiCompatibleMax;
 
 	/// list of mods that should be loaded before this one
 	std::set <TModID> dependencies;
@@ -381,7 +358,7 @@ public:
 			for(const auto & m : newActiveMods)
 
 			{
-				CModInfo::Version mver;
+				CModVersion mver;
 				h & mver;
 				
 				if(allMods.count(m) && (allMods[m].version.isNull() || mver.isNull() || allMods[m].version.compatible(mver)))

+ 63 - 0
lib/CModVersion.cpp

@@ -0,0 +1,63 @@
+/*
+ * CModVersion.h, part of VCMI engine
+ *
+ * Authors: listed in file AUTHORS in main folder
+ *
+ * License: GNU General Public License v2.0 or later
+ * Full text of license available in license.txt file, in main folder
+ *
+ */
+
+#include "StdInc.h"
+#include "CModVersion.h"
+
+VCMI_LIB_NAMESPACE_BEGIN
+
+CModVersion CModVersion::GameVersion()
+{
+	return CModVersion(VCMI_VERSION_MAJOR, VCMI_VERSION_MINOR, VCMI_VERSION_PATCH);
+}
+
+CModVersion CModVersion::fromString(std::string from)
+{
+	int major = 0;
+	int minor = 0;
+	int patch = 0;
+	try
+	{
+		auto pointPos = from.find('.');
+		major = std::stoi(from.substr(0, pointPos));
+		if(pointPos != std::string::npos)
+		{
+			from = from.substr(pointPos + 1);
+			pointPos = from.find('.');
+			minor = std::stoi(from.substr(0, pointPos));
+			if(pointPos != std::string::npos)
+				patch = std::stoi(from.substr(pointPos + 1));
+		}
+	}
+	catch(const std::invalid_argument &)
+	{
+		return CModVersion();
+	}
+	return CModVersion(major, minor, patch);
+}
+
+std::string CModVersion::toString() const
+{
+	return std::to_string(major) + '.' + std::to_string(minor) + '.' + std::to_string(patch);
+}
+
+bool CModVersion::compatible(const CModVersion & other, bool checkMinor, bool checkPatch) const
+{
+	return  (major == other.major &&
+			(!checkMinor || minor >= other.minor) &&
+			(!checkPatch || minor > other.minor || (minor == other.minor && patch >= other.patch)));
+}
+
+bool CModVersion::isNull() const
+{
+	return major == 0 && minor == 0 && patch == 0;
+}
+
+VCMI_LIB_NAMESPACE_END

+ 39 - 0
lib/CModVersion.h

@@ -0,0 +1,39 @@
+/*
+ * CModVersion.h, part of VCMI engine
+ *
+ * Authors: listed in file AUTHORS in main folder
+ *
+ * License: GNU General Public License v2.0 or later
+ * Full text of license available in license.txt file, in main folder
+ *
+ */
+
+#pragma once
+
+VCMI_LIB_NAMESPACE_BEGIN
+
+struct DLL_LINKAGE CModVersion
+{
+	int major = 0;
+	int minor = 0;
+	int patch = 0;
+
+	CModVersion() = default;
+	CModVersion(int mj, int mi, int p): major(mj), minor(mi), patch(p) {}
+
+	static CModVersion GameVersion();
+	static CModVersion fromString(std::string from);
+	std::string toString() const;
+
+	bool compatible(const CModVersion & other, bool checkMinor = false, bool checkPatch = false) const;
+	bool isNull() const;
+
+	template <typename Handler> void serialize(Handler &h, const int version)
+	{
+		h & major;
+		h & minor;
+		h & patch;
+	}
+};
+
+VCMI_LIB_NAMESPACE_END

+ 0 - 1
lib/GameConstants.h

@@ -477,7 +477,6 @@ public:
 		HORDE_PLACEHOLDER3 = -32,
 		HORDE_PLACEHOLDER2 = -31,
 		HORDE_PLACEHOLDER1 = -30,
-		HORDE_BUILDING_CONVERTER = -29, //-1 => -30
 		NONE = -1,
 		FIRST_REGULAR_ID = 0,
 		MAGES_GUILD_1 = 0,  MAGES_GUILD_2, MAGES_GUILD_3,     MAGES_GUILD_4,   MAGES_GUILD_5,

+ 7 - 2
lib/GameSettings.cpp

@@ -58,7 +58,7 @@ void GameSettings::load(const JsonNode & input)
 		{EGameSettings::COMBAT_DEFENSE_POINT_DAMAGE_FACTOR_CAP, "combat",    "defensePointDamageFactorCap"},
 		{EGameSettings::COMBAT_GOOD_LUCK_DICE,                  "combat",    "goodLuckDice"               },
 		{EGameSettings::COMBAT_GOOD_MORALE_DICE,                "combat",    "goodMoraleDice"             },
-		{EGameSettings::COMBAT_ONE_HEX_TRIGGERS_OBSTACLES,      "combat",    "oneHexTriggersObstacles"   },
+		{EGameSettings::COMBAT_ONE_HEX_TRIGGERS_OBSTACLES,      "combat",    "oneHexTriggersObstacles"    },
 		{EGameSettings::CREATURES_ALLOW_ALL_FOR_DOUBLE_MONTH,   "creatures", "allowAllForDoubleMonth"     },
 		{EGameSettings::CREATURES_ALLOW_RANDOM_SPECIAL_WEEKS,   "creatures", "allowRandomSpecialWeeks"    },
 		{EGameSettings::CREATURES_DAILY_STACK_EXPERIENCE,       "creatures", "dailyStackExperience"       },
@@ -71,6 +71,12 @@ void GameSettings::load(const JsonNode & input)
 		{EGameSettings::HEROES_RETREAT_ON_WIN_WITHOUT_TROOPS,   "heroes",    "retreatOnWinWithoutTroops"  },
 		{EGameSettings::HEROES_STARTING_STACKS_CHANCES,         "heroes",    "startingStackChances"       },
 		{EGameSettings::HEROES_BACKPACK_CAP,                    "heroes",    "backpackSize"               },
+		{EGameSettings::MAP_FORMAT_RESTORATION_OF_ERATHIA,      "mapFormat", "restorationOfErathia"       },
+		{EGameSettings::MAP_FORMAT_ARMAGEDDONS_BLADE,           "mapFormat", "armageddonsBlade"           },
+		{EGameSettings::MAP_FORMAT_SHADOW_OF_DEATH,             "mapFormat", "shadowOfDeath"              },
+		{EGameSettings::MAP_FORMAT_HORN_OF_THE_ABYSS,           "mapFormat", "hornOfTheAbyss"             },
+		{EGameSettings::MAP_FORMAT_IN_THE_WAKE_OF_GODS,         "mapFormat", "inTheWakeOfGods"            },
+		{EGameSettings::MAP_FORMAT_JSON_VCMI,                   "mapFormat", "jsonVCMI"                   },
 		{EGameSettings::MARKETS_BLACK_MARKET_RESTOCK_PERIOD,    "markets",   "blackMarketRestockPeriod"   },
 		{EGameSettings::MODULE_COMMANDERS,                      "modules",   "commanders"                 },
 		{EGameSettings::MODULE_STACK_ARTIFACT,                  "modules",   "stackArtifact"              },
@@ -80,7 +86,6 @@ void GameSettings::load(const JsonNode & input)
 		{EGameSettings::TEXTS_FACTION,                          "textData",  "faction"                    },
 		{EGameSettings::TEXTS_HERO,                             "textData",  "hero"                       },
 		{EGameSettings::TEXTS_HERO_CLASS,                       "textData",  "heroClass"                  },
-		{EGameSettings::TEXTS_MAP_VERSION,                      "textData",  "mapVersion"                 },
 		{EGameSettings::TEXTS_OBJECT,                           "textData",  "object"                     },
 		{EGameSettings::TEXTS_RIVER,                            "textData",  "river"                      },
 		{EGameSettings::TEXTS_ROAD,                             "textData",  "road"                       },

+ 6 - 1
lib/GameSettings.h

@@ -46,12 +46,17 @@ enum class EGameSettings
 	TEXTS_FACTION,
 	TEXTS_HERO,
 	TEXTS_HERO_CLASS,
-	TEXTS_MAP_VERSION,
 	TEXTS_OBJECT,
 	TEXTS_RIVER,
 	TEXTS_ROAD,
 	TEXTS_SPELL,
 	TEXTS_TERRAIN,
+	MAP_FORMAT_RESTORATION_OF_ERATHIA,
+	MAP_FORMAT_ARMAGEDDONS_BLADE,
+	MAP_FORMAT_SHADOW_OF_DEATH,
+	MAP_FORMAT_HORN_OF_THE_ABYSS,
+	MAP_FORMAT_JSON_VCMI,
+	MAP_FORMAT_IN_THE_WAKE_OF_GODS,
 	TOWNS_BUILDINGS_PER_TURN_CAP,
 	TOWNS_STARTING_DWELLING_CHANCES,
 	COMBAT_ONE_HEX_TRIGGERS_OBSTACLES,

+ 0 - 1
lib/PathfinderUtil.h

@@ -11,7 +11,6 @@
 
 #include "TerrainHandler.h"
 #include "mapObjects/CObjectHandler.h"
-#include "mapping/CMapDefines.h"
 #include "CGameState.h"
 
 VCMI_LIB_NAMESPACE_BEGIN

+ 3 - 1
lib/StartInfo.cpp

@@ -11,10 +11,12 @@
 #include "StartInfo.h"
 
 #include "CGeneralTextHandler.h"
+#include "CModHandler.h"
+#include "VCMI_Lib.h"
 #include "rmg/CMapGenOptions.h"
 #include "mapping/CMapInfo.h"
 #include "mapping/CCampaignHandler.h"
-#include "mapping/CMap.h"
+#include "mapping/CMapHeader.h"
 #include "mapping/CMapService.h"
 
 VCMI_LIB_NAMESPACE_BEGIN

+ 8 - 8
lib/StringConstants.h

@@ -56,14 +56,14 @@ namespace EBuildingType
 {
 	const std::string names [44] =
 	{
-		"mageGuild1",       "mageGuild2",       "mageGuild3",       "mageGuild4",       "mageGuild5",
-		"tavern",           "shipyard",         "fort",             "citadel",          "castle",
-		"villageHall",      "townHall",         "cityHall",         "capitol",          "marketplace",
-		"resourceSilo",     "blacksmith",       "special1",         "horde1",           "horde1Upgr",
-		"ship",             "special2",         "special3",         "special4",         "horde2",
-		"horde2Upgr",       "grail",            "extraTownHall",    "extraCityHall",    "extraCapitol",
-		"dwellingLvl1",     "dwellingLvl2",     "dwellingLvl3",     "dwellingLvl4",     "dwellingLvl5",
-		"dwellingLvl6",     "dwellingLvl7",     "dwellingUpLvl1",   "dwellingUpLvl2",   "dwellingUpLvl3",
+		"mageGuild1",       "mageGuild2",       "mageGuild3",       "mageGuild4",       "mageGuild5",       //  5
+		"tavern",           "shipyard",         "fort",             "citadel",          "castle",           // 10
+		"villageHall",      "townHall",         "cityHall",         "capitol",          "marketplace",      // 15
+		"resourceSilo",     "blacksmith",       "special1",         "horde1",           "horde1Upgr",       // 20
+		"ship",             "special2",         "special3",         "special4",         "horde2",           // 25
+		"horde2Upgr",       "grail",            "extraTownHall",    "extraCityHall",    "extraCapitol",     // 30
+		"dwellingLvl1",     "dwellingLvl2",     "dwellingLvl3",     "dwellingLvl4",     "dwellingLvl5",     // 35
+		"dwellingLvl6",     "dwellingLvl7",     "dwellingUpLvl1",   "dwellingUpLvl2",   "dwellingUpLvl3",   // 40
 		"dwellingUpLvl4",   "dwellingUpLvl5",   "dwellingUpLvl6",   "dwellingUpLvl7"
 	};
 }

+ 1 - 0
lib/mapObjects/CRewardableConstructor.cpp

@@ -57,6 +57,7 @@ void CRewardableConstructor::configureObject(CGObjectInstance * object, CRandomG
 					rewardInfo.reward.extraComponents.emplace_back(Component::EComponentType::LUCK, 0, bonus.val, 0);
 			}
 		}
+		assert(!rewardableObject->configuration.info.empty());
 	}
 }
 

+ 3 - 2
lib/mapObjects/CommonConstructors.cpp

@@ -14,7 +14,7 @@
 #include "CGHeroInstance.h"
 #include "CBank.h"
 #include "../TerrainHandler.h"
-#include "../mapping/CMap.h"
+#include "../mapping/CMapDefines.h"
 #include "../CHeroHandler.h"
 #include "../CGeneralTextHandler.h"
 #include "../CCreatureHandler.h"
@@ -338,7 +338,8 @@ CGObjectInstance * MarketInstanceConstructor::create(std::shared_ptr<const Objec
 	if(!title.empty())
 		market->title = VLC->generaltexth->translate(title);
 	
-	market->speech = VLC->generaltexth->translate(speech);
+	if (!speech.empty())
+		market->speech = VLC->generaltexth->translate(speech);
 	
 	return market;
 }

+ 2 - 2
lib/mapObjects/MiscObjects.cpp

@@ -1403,7 +1403,7 @@ void CGWitchHut::initObj(CRandomGenerator & rand)
 
 		for(int i = 0; i < defaultAllowed.size(); i++)
 			if (defaultAllowed[i] && cb->isAllowed(2, i))
-				allowedAbilities.insert(i);
+				allowedAbilities.insert(SecondarySkill(i));
 	}
 	ability = *RandomGeneratorUtil::nextItem(allowedAbilities, rand);
 }
@@ -1479,7 +1479,7 @@ void CGWitchHut::serializeJsonOptions(JsonSerializeFormat & handler)
 		allowedAbilities.clear();
 		for(si32 i = 0; i < skillCount; ++i)
 			if(temp[i])
-				allowedAbilities.insert(i);
+				allowedAbilities.insert(SecondarySkill(i));
 	}
 }
 

+ 2 - 2
lib/mapObjects/MiscObjects.h

@@ -131,8 +131,8 @@ protected:
 class DLL_LINKAGE CGWitchHut : public CTeamVisited
 {
 public:
-	std::set<si32> allowedAbilities;
-	ui32 ability;
+	std::set<SecondarySkill> allowedAbilities;
+	SecondarySkill ability;
 
 	std::string getHoverText(PlayerColor player) const override;
 	std::string getHoverText(const CGHeroInstance * hero) const override;

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.