Browse Source

wrap all library code into namespace if VCMI_LIB_NAMESPACE is defined

preparation for having client and server in a single process
Andrey Filipenkov 3 years ago
parent
commit
ff635edc0b
100 changed files with 546 additions and 115 deletions
  1. 5 0
      AI/BattleAI/BattleAI.h
  2. 4 0
      AI/BattleAI/EnemyInfo.h
  3. 4 0
      AI/BattleAI/PossibleSpellcast.h
  4. 6 1
      AI/BattleAI/StackWithBonuses.h
  5. 2 0
      AI/BattleAI/StdInc.h
  6. 4 0
      AI/Nullkiller/AIGateway.h
  7. 4 0
      AI/Nullkiller/Engine/FuzzyEngines.h
  8. 5 0
      AI/Nullkiller/Engine/FuzzyHelper.h
  9. 6 1
      AI/Nullkiller/Engine/PriorityEvaluator.h
  10. 2 0
      AI/Nullkiller/Pathfinding/Actors.cpp
  11. 1 0
      AI/Nullkiller/StdInc.h
  12. 3 1
      AI/StupidAI/StdInc.h
  13. 4 0
      AI/VCAI/FuzzyEngines.h
  14. 4 0
      AI/VCAI/FuzzyHelper.h
  15. 2 0
      AI/VCAI/StdInc.h
  16. 4 0
      AI/VCAI/VCAI.cpp
  17. 4 0
      AI/VCAI/VCAI.h
  18. 8 4
      CCallback.h
  19. 17 0
      Global.h
  20. 4 0
      Version.cpp.in
  21. 4 0
      Version.h
  22. 10 6
      client/CGameInfo.h
  23. 18 13
      client/CPlayerInterface.h
  24. 9 2
      client/CServerHandler.h
  25. 11 5
      client/Client.h
  26. 8 3
      client/Graphics.h
  27. 6 1
      client/SDLRWwrapper.h
  28. 2 0
      client/StdInc.h
  29. 6 1
      client/battle/CBattleAnimations.h
  30. 16 11
      client/battle/CBattleInterface.h
  31. 13 7
      client/battle/CBattleInterfaceClasses.h
  32. 6 1
      client/gui/CAnimation.h
  33. 6 1
      client/gui/CGuiHandler.h
  34. 4 0
      client/gui/Fonts.h
  35. 7 2
      client/lobby/CBonusSelection.h
  36. 6 1
      client/lobby/CSavingScreen.h
  37. 8 3
      client/lobby/CSelectionBase.h
  38. 5 0
      client/lobby/RandomMapTab.h
  39. 6 1
      client/mainmenu/CCampaignScreen.h
  40. 5 0
      client/mainmenu/CMainMenu.h
  41. 6 1
      client/mapHandler.h
  42. 11 6
      client/widgets/AdventureMapClasses.h
  43. 9 5
      client/widgets/Buttons.h
  44. 6 2
      client/widgets/CArtifactHolder.h
  45. 5 0
      client/widgets/CComponent.h
  46. 8 3
      client/widgets/CGarrisonInt.h
  47. 8 3
      client/widgets/MiscWidgets.h
  48. 8 3
      client/windows/CAdvmapInterface.h
  49. 11 6
      client/windows/CCastleInterface.h
  50. 6 1
      client/windows/CCreatureWindow.h
  51. 6 1
      client/windows/CHeroWindow.h
  52. 5 0
      client/windows/CQuestLog.cpp
  53. 7 2
      client/windows/CQuestLog.h
  54. 7 2
      client/windows/CSpellWindow.h
  55. 5 0
      client/windows/CTradeWindow.h
  56. 6 1
      client/windows/GUIClasses.h
  57. 6 1
      client/windows/InfoWindows.h
  58. 4 0
      include/vcmi/Artifact.h
  59. 4 0
      include/vcmi/ArtifactService.h
  60. 4 0
      include/vcmi/Creature.h
  61. 4 0
      include/vcmi/CreatureService.h
  62. 4 0
      include/vcmi/Entity.h
  63. 4 0
      include/vcmi/EntityService.h
  64. 6 2
      include/vcmi/Environment.h
  65. 4 0
      include/vcmi/Faction.h
  66. 4 0
      include/vcmi/FactionService.h
  67. 4 0
      include/vcmi/HeroClass.h
  68. 4 0
      include/vcmi/HeroClassService.h
  69. 4 0
      include/vcmi/HeroType.h
  70. 4 0
      include/vcmi/HeroTypeService.h
  71. 4 0
      include/vcmi/Metatype.h
  72. 3 4
      include/vcmi/Player.h
  73. 4 0
      include/vcmi/ServerCallback.h
  74. 4 0
      include/vcmi/Services.h
  75. 4 0
      include/vcmi/Skill.h
  76. 4 0
      include/vcmi/SkillService.h
  77. 4 0
      include/vcmi/events/ApplyDamage.h
  78. 4 0
      include/vcmi/events/Event.h
  79. 4 0
      include/vcmi/events/EventBus.h
  80. 4 0
      include/vcmi/events/GameResumed.h
  81. 4 0
      include/vcmi/events/ObjectVisitEnded.h
  82. 4 0
      include/vcmi/events/ObjectVisitStarted.h
  83. 4 0
      include/vcmi/events/PlayerGotTurn.h
  84. 4 0
      include/vcmi/events/SubscriptionRegistry.h
  85. 4 0
      include/vcmi/events/TurnStarted.h
  86. 6 2
      include/vcmi/scripting/Service.h
  87. 4 0
      include/vcmi/spells/Caster.h
  88. 5 1
      include/vcmi/spells/Magic.h
  89. 4 0
      include/vcmi/spells/Service.h
  90. 4 0
      include/vcmi/spells/Spell.h
  91. 4 0
      include/vstd/CLoggerBase.h
  92. 3 2
      include/vstd/ContainerUtils.h
  93. 4 0
      include/vstd/RNG.h
  94. 4 0
      include/vstd/StringUtils.h
  95. 4 0
      launcher/updatedialog_moc.h
  96. 5 1
      lib/BattleFieldHandler.cpp
  97. 4 0
      lib/BattleFieldHandler.h
  98. 4 0
      lib/CArtHandler.cpp
  99. 4 0
      lib/CArtHandler.h
  100. 5 1
      lib/CBonusTypeHandler.cpp

+ 5 - 0
AI/BattleAI/BattleAI.h

@@ -13,7 +13,12 @@
 #include "PossibleSpellcast.h"
 #include "PotentialTargets.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CSpell;
+
+VCMI_LIB_NAMESPACE_END
+
 class EnemyInfo;
 
 /*

+ 4 - 0
AI/BattleAI/EnemyInfo.h

@@ -9,11 +9,15 @@
  */
 #pragma once
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 namespace battle
 {
 	class Unit;
 }
 
+VCMI_LIB_NAMESPACE_END
+
 class EnemyInfo
 {
 public:

+ 4 - 0
AI/BattleAI/PossibleSpellcast.h

@@ -14,8 +14,12 @@
 
 #include "../../lib/battle/Destination.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CSpell;
 
+VCMI_LIB_NAMESPACE_END
+
 class PossibleSpellcast
 {
 public:

+ 6 - 1
AI/BattleAI/StackWithBonuses.h

@@ -18,9 +18,14 @@
 #include "../../lib/battle/BattleProxy.h"
 #include "../../lib/battle/CUnitState.h"
 
-class HypotheticBattle;
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CStack;
 
+VCMI_LIB_NAMESPACE_END
+
+class HypotheticBattle;
+
 ///Fake random generator, used by AI to evaluate random server behavior
 class RNGStub : public vstd::RNG
 {

+ 2 - 0
AI/BattleAI/StdInc.h

@@ -13,3 +13,5 @@
 // This header should be treated as a pre compiled header file(PCH) in the compiler building settings.
 
 // Here you can add specific libraries and macros which are specific to this project.
+
+VCMI_LIB_USING_NAMESPACE

+ 4 - 0
AI/Nullkiller/AIGateway.h

@@ -25,8 +25,12 @@
 #include "Pathfinding/AIPathfinder.h"
 #include "Engine/Nullkiller.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 struct QuestInfo;
 
+VCMI_LIB_NAMESPACE_END
+
 class AIStatus
 {
 	boost::mutex mx;

+ 4 - 0
AI/Nullkiller/Engine/FuzzyEngines.h

@@ -11,8 +11,12 @@
 #include <fl/Headers.h>
 #include "../Goals/AbstractGoal.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CArmedInstance;
 
+VCMI_LIB_NAMESPACE_END
+
 class engineBase //subclasses create fuzzylite variables with "new" that are not freed - this is desired as fl::Engine wants to destroy these...
 {
 protected:

+ 5 - 0
AI/Nullkiller/Engine/FuzzyHelper.h

@@ -10,7 +10,12 @@
 #pragma once
 #include "FuzzyEngines.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CBank;
+
+VCMI_LIB_NAMESPACE_END
+
 class Nullkiller;
 
 class DLL_EXPORT FuzzyHelper

+ 6 - 1
AI/Nullkiller/Engine/PriorityEvaluator.h

@@ -12,9 +12,14 @@
 #include "../Goals/CGoal.h"
 #include "../Pathfinding/AIPathfinder.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
+class CGWitchHut;
+
+VCMI_LIB_NAMESPACE_END
+
 class BuildingInfo;
 class Nullkiller;
-class CGWitchHut;
 
 class RewardEvaluator
 {

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

@@ -164,6 +164,7 @@ ExchangeResult ChainActor::tryExchangeNoLock(const ChainActor * specialActor, co
 	return baseActor->tryExchangeNoLock(specialActor, other);
 }
 
+VCMI_LIB_NAMESPACE_BEGIN
 namespace vstd
 {
 	template <class M, class Key, class F>
@@ -180,6 +181,7 @@ namespace vstd
 		return v;
 	}
 }
+VCMI_LIB_NAMESPACE_END
 
 ExchangeResult HeroActor::tryExchangeNoLock(const ChainActor * specialActor, const ChainActor * other) const
 {

+ 1 - 0
AI/Nullkiller/StdInc.h

@@ -1,3 +1,4 @@
 #pragma  once
 #include "../../Global.h"
+VCMI_LIB_USING_NAMESPACE
 #include "../../CCallback.h"

+ 3 - 1
AI/StupidAI/StdInc.h

@@ -4,4 +4,6 @@
 
 // This header should be treated as a pre compiled header file(PCH) in the compiler building settings.
 
-// Here you can add specific libraries and macros which are specific to this project.
+// Here you can add specific libraries and macros which are specific to this project.
+
+VCMI_LIB_USING_NAMESPACE

+ 4 - 0
AI/VCAI/FuzzyEngines.h

@@ -11,8 +11,12 @@
 #include <fl/Headers.h>
 #include "Goals/AbstractGoal.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CArmedInstance;
 
+VCMI_LIB_NAMESPACE_END
+
 class engineBase //subclasses create fuzzylite variables with "new" that are not freed - this is desired as fl::Engine wants to destroy these...
 {
 protected:

+ 4 - 0
AI/VCAI/FuzzyHelper.h

@@ -10,8 +10,12 @@
 #pragma once
 #include "FuzzyEngines.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CBank;
 
+VCMI_LIB_NAMESPACE_END
+
 class DLL_EXPORT FuzzyHelper
 {
 public:

+ 2 - 0
AI/VCAI/StdInc.h

@@ -1,2 +1,4 @@
 #pragma  once
 #include "../../Global.h"
+
+VCMI_LIB_USING_NAMESPACE

+ 4 - 0
AI/VCAI/VCAI.cpp

@@ -29,8 +29,12 @@
 
 extern FuzzyHelper * fh;
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CGVisitableOPW;
 
+VCMI_LIB_NAMESPACE_END
+
 const double SAFE_ATTACK_CONSTANT = 1.5;
 
 //one thread may be turn of AI and another will be handling a side effect for AI2

+ 4 - 0
AI/VCAI/VCAI.h

@@ -26,8 +26,12 @@
 #include "../../lib/CondSh.h"
 #include "Pathfinding/AIPathfinder.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 struct QuestInfo;
 
+VCMI_LIB_NAMESPACE_END
+
 class AIhelper;
 
 class AIStatus

+ 8 - 4
CCallback.h

@@ -13,6 +13,8 @@
 #include "lib/battle/CPlayerBattleCallback.h"
 #include "lib/int3.h" // for int3
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CGHeroInstance;
 class CGameState;
 struct CPath;
@@ -20,18 +22,22 @@ class CGObjectInstance;
 class CArmedInstance;
 class BattleAction;
 class CGTownInstance;
-struct lua_State;
-class CClient;
 class IShipyard;
 struct CGPathNode;
 struct CGPath;
 struct CPathsInfo;
 class PathfinderConfig;
 struct CPack;
+struct CPackForServer;
 class IBattleEventsReceiver;
 class IGameEventsReceiver;
 struct ArtifactLocation;
 
+VCMI_LIB_NAMESPACE_END
+
+class CClient;
+struct lua_State;
+
 class IBattleCallback
 {
 public:
@@ -88,8 +94,6 @@ public:
 	virtual int bulkMergeStacks(ObjectInstanceID armyId, SlotID srcSlot) = 0;
 };
 
-struct CPackForServer;
-
 class CBattleCallback : public IBattleCallback, public CPlayerBattleCallback
 {
 protected:

+ 17 - 0
Global.h

@@ -264,11 +264,26 @@ template<typename T, size_t N> char (&_ArrayCountObj(const T (&)[N]))[N];
 // should be used for variables that becomes unused in release builds (e.g. only used for assert checks)
 #define UNUSED(VAR) ((void)VAR)
 
+// single-process build makes 2 copies of the main lib by wrapping it in a namespace
+#ifdef VCMI_LIB_NAMESPACE
+#define VCMI_LIB_NAMESPACE_BEGIN namespace VCMI_LIB_NAMESPACE {
+#define VCMI_LIB_NAMESPACE_END }
+#define VCMI_LIB_USING_NAMESPACE using namespace VCMI_LIB_NAMESPACE;
+#define VCMI_LIB_WRAP_NAMESPACE(x) VCMI_LIB_NAMESPACE::x
+#else
+#define VCMI_LIB_NAMESPACE_BEGIN
+#define VCMI_LIB_NAMESPACE_END
+#define VCMI_LIB_USING_NAMESPACE
+#define VCMI_LIB_WRAP_NAMESPACE(x) x
+#endif
+
 /* ---------------------------------------------------------------------------- */
 /* VCMI standard library */
 /* ---------------------------------------------------------------------------- */
 #include <vstd/CLoggerBase.h>
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 void inline handleException()
 {
 	try
@@ -739,3 +754,5 @@ namespace std
 	}
 }
 #endif // NO_STD_TOSTRING
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
Version.cpp.in

@@ -9,7 +9,11 @@
  */
 #include "Version.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 namespace GameConstants
 {
 const char GIT_SHA1[] = "@GIT_SHA1@";
 }
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
Version.h

@@ -1,6 +1,10 @@
 #pragma once
 
+VCMI_LIB_NAMESPACE_BEGIN
+	
 namespace GameConstants
 {
 extern const char GIT_SHA1[];
 }
+
+VCMI_LIB_NAMESPACE_END

+ 10 - 6
client/CGameInfo.h

@@ -13,29 +13,33 @@
 
 #include "../lib/ConstTransitivePtr.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CModHandler;
-class CMapHandler;
 class CHeroHandler;
 class CCreatureHandler;
 class CSpellHandler;
 class CSkillHandler;
 class CBuildingHandler;
 class CObjectHandler;
-class CSoundHandler;
-class CMusicHandler;
 class CObjectClassesHandler;
 class CTownHandler;
 class CGeneralTextHandler;
 class CConsoleHandler;
-class CCursorHandler;
 class CGameState;
-class IMainVideoPlayer;
-class CServerHandler;
 class BattleFieldHandler;
 class ObstacleHandler;
 
 class CMap;
 
+VCMI_LIB_NAMESPACE_END
+
+class CMapHandler;
+class CSoundHandler;
+class CMusicHandler;
+class CCursorHandler;
+class IMainVideoPlayer;
+class CServerHandler;
 
 //a class for non-mechanical client GUI classes
 class CClientState

+ 18 - 13
client/CPlayerInterface.h

@@ -19,30 +19,33 @@
 #define sprintf_s snprintf
 #endif
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class Artifact;
 
-class CButton;
-class CToggleGroup;
 struct TryMoveHero;
 class CGHeroInstance;
-class CAdvMapInt;
-class CCastleInterface;
-class CBattleInterface;
 class CStack;
-class CComponent;
 class CCreature;
-struct SDL_Surface;
 struct CGPath;
-class CCreatureAnimation;
-class CSelectableComponent;
 class CCreatureSet;
 class CGObjectInstance;
-class CSlider;
 struct UpgradeInfo;
 template <typename T> struct CondSh;
+struct CPathsInfo;
+
+VCMI_LIB_NAMESPACE_END
+
+class CButton;
+class CToggleGroup;
+class CAdvMapInt;
+class CCastleInterface;
+class CBattleInterface;
+class CComponent;
+class CCreatureAnimation;
+class CSelectableComponent;
+class CSlider;
 class CInGameConsole;
-class CInGameConsole;
-union SDL_Event;
 class CInfoWindow;
 class IShowActivatable;
 class ClickableL;
@@ -52,7 +55,9 @@ class KeyInterested;
 class MotionInterested;
 class TimeInterested;
 class IShowable;
-struct CPathsInfo;
+
+struct SDL_Surface;
+union SDL_Event;
 
 namespace boost
 {

+ 9 - 2
client/CServerHandler.h

@@ -14,7 +14,8 @@
 #include "../lib/StartInfo.h"
 #include "../lib/CondSh.h"
 
-struct SharedMemory;
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CConnection;
 class PlayerColor;
 struct StartInfo;
@@ -23,9 +24,15 @@ class CMapInfo;
 struct ClientPlayer;
 struct CPack;
 struct CPackForLobby;
-class CClient;
 
 template<typename T> class CApplier;
+
+VCMI_LIB_NAMESPACE_END
+
+struct SharedMemory;
+
+class CClient;
+
 class CBaseForLobbyApply;
 
 // TODO: Add mutex so we can't set CONNECTION_CANCELLED if client already connected, but thread not setup yet

+ 11 - 5
client/Client.h

@@ -19,25 +19,22 @@
 #include "../lib/CondSh.h"
 #include "../lib/CPathfinder.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 struct CPack;
 struct CPackForServer;
 class CCampaignState;
-class CBattleCallback;
 class IGameEventsReceiver;
 class IBattleEventsReceiver;
 class CBattleGameInterface;
 class CGameState;
 class CGameInterface;
-class CCallback;
 class BattleAction;
-class CClient;
 struct CPathsInfo;
 class BinaryDeserializer;
 class BinarySerializer;
-namespace boost { class thread; }
 
 template<typename T> class CApplier;
-class CBaseForCLApply;
 
 #if SCRIPTING_ENABLED
 namespace scripting
@@ -51,6 +48,15 @@ namespace events
 	class EventBus;
 }
 
+VCMI_LIB_NAMESPACE_END
+
+class CBattleCallback;
+class CCallback;
+class CClient;
+class CBaseForCLApply;
+
+namespace boost { class thread; }
+
 template<typename T>
 class ThreadSafeVector
 {

+ 8 - 3
client/Graphics.h

@@ -13,18 +13,23 @@
 #include "../lib/GameConstants.h"
 #include "gui/Geometries.h"
 
-struct SDL_Surface;
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CGHeroInstance;
 class CGTownInstance;
 class CHeroClass;
-struct SDL_Color;
 struct InfoAboutHero;
 struct InfoAboutTown;
 class CGObjectInstance;
 class ObjectTemplate;
-class CAnimation;
 class EntityService;
 
+VCMI_LIB_NAMESPACE_END
+
+struct SDL_Surface;
+struct SDL_Color;
+class CAnimation;
+
 enum EFonts
 {
 	FONT_BIG, FONT_CALLI, FONT_CREDITS, FONT_HIGH_SCORE, FONT_MEDIUM, FONT_SMALL, FONT_TIMES, FONT_TINY, FONT_VERD

+ 6 - 1
client/SDLRWwrapper.h

@@ -9,7 +9,12 @@
  */
 #pragma once
 
-struct SDL_RWops;
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CInputStream;
 
+VCMI_LIB_NAMESPACE_END
+
+struct SDL_RWops;
+
 SDL_RWops* MakeSDLRWops(std::unique_ptr<CInputStream> in);

+ 2 - 0
client/StdInc.h

@@ -7,3 +7,5 @@
 // This header should be treated as a pre compiled header file(PCH) in the compiler building settings.
 
 // Here you can add specific libraries and macros which are specific to this project.
+
+VCMI_LIB_USING_NAMESPACE

+ 6 - 1
client/battle/CBattleAnimations.h

@@ -12,8 +12,13 @@
 #include "../../lib/battle/BattleHex.h"
 #include "../widgets/Images.h"
 
-class CBattleInterface;
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CStack;
+
+VCMI_LIB_NAMESPACE_END
+
+class CBattleInterface;
 class CCreatureAnimation;
 struct CatapultProjectileInfo;
 struct StackAttackedInfo;

+ 16 - 11
client/battle/CBattleInterface.h

@@ -19,14 +19,11 @@
 #include "../../lib/spells/CSpellHandler.h" //CSpell::TAnimation
 #include "../../lib/battle/CBattleInfoCallback.h"
 
-class CLabel;
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CCreatureSet;
 class CGHeroInstance;
 class CStack;
-class CCallback;
-class CButton;
-class CToggleButton;
-class CToggleGroup;
 struct BattleResult;
 struct BattleSpellCast;
 struct CObstacleInstance;
@@ -35,8 +32,21 @@ struct SetStackEffect;
 class BattleAction;
 class CGTownInstance;
 struct CatapultAttack;
-struct CatapultProjectileInfo;
 struct BattleTriggerEffect;
+struct BattleHex;
+struct InfoAboutHero;
+class CBattleGameInterface;
+struct CustomEffectInfo;
+class CSpell;
+
+VCMI_LIB_NAMESPACE_END
+
+class CLabel;
+class CCallback;
+class CButton;
+class CToggleButton;
+class CToggleGroup;
+struct CatapultProjectileInfo;
 class CBattleAnimation;
 class CBattleHero;
 class CBattleConsole;
@@ -46,13 +56,8 @@ class CPlayerInterface;
 class CCreatureAnimation;
 struct ProjectileInfo;
 class CClickableHex;
-struct BattleHex;
-struct InfoAboutHero;
-class CBattleGameInterface;
-struct CustomEffectInfo;
 class CAnimation;
 class IImage;
-class CSpell;
 
 /// Small struct which contains information about the id of the attacked stack, the damage dealt,...
 struct StackAttackedInfo

+ 13 - 7
client/battle/CBattleInterfaceClasses.h

@@ -13,8 +13,20 @@
 #include "../../lib/battle/BattleHex.h"
 #include "../windows/CWindowObject.h"
 
-struct SDL_Surface;
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CGHeroInstance;
+struct BattleResult;
+class CStack;
+
+namespace battle
+{
+class Unit;
+}
+
+VCMI_LIB_NAMESPACE_END
+
+struct SDL_Surface;
 class CBattleInterface;
 class CPicture;
 class CFilledTexture;
@@ -23,12 +35,6 @@ class CToggleButton;
 class CToggleGroup;
 class CLabel;
 class CTextBox;
-struct BattleResult;
-class CStack;
-namespace battle
-{
-	class Unit;
-}
 class CAnimImage;
 class CPlayerInterface;
 

+ 6 - 1
client/gui/CAnimation.h

@@ -21,8 +21,13 @@
 #undef OUT
 #endif
 
-struct SDL_Surface;
+VCMI_LIB_NAMESPACE_BEGIN
+
 class JsonNode;
+
+VCMI_LIB_NAMESPACE_END
+
+struct SDL_Surface;
 class CDefFile;
 class ColorShifter;
 

+ 6 - 1
client/gui/CGuiHandler.h

@@ -13,6 +13,12 @@
 #include "Geometries.h"
 #include "SDL_Extensions.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
+template <typename T> struct CondSh;
+
+VCMI_LIB_NAMESPACE_END
+
 class CFramerateManager;
 class CGStatusBar;
 class CIntObject;
@@ -20,7 +26,6 @@ class IUpdateable;
 class IShowActivatable;
 class IShowable;
 enum class EIntObjMouseBtnType;
-template <typename T> struct CondSh;
 
 // TODO: event handling need refactoring
 enum EUserEvent

+ 4 - 0
client/gui/Fonts.h

@@ -9,8 +9,12 @@
  */
 #pragma once
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class JsonNode;
 
+VCMI_LIB_NAMESPACE_END
+
 struct Point;
 struct SDL_Surface;
 struct SDL_Color;

+ 7 - 2
client/lobby/CBonusSelection.h

@@ -10,8 +10,13 @@
 #pragma once
 #include "../windows/CWindowObject.h"
 
-struct SDL_Surface;
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CCampaignState;
+
+VCMI_LIB_NAMESPACE_END
+
+struct SDL_Surface;
 class CButton;
 class CTextBox;
 class CToggleGroup;
@@ -90,4 +95,4 @@ public:
 	std::shared_ptr<CButton> buttonDifficultyLeft;
 	std::shared_ptr<CButton> buttonDifficultyRight;
 	std::shared_ptr<CAnimImage> iconsMapSizes;
-};
+};

+ 6 - 1
client/lobby/CSavingScreen.h

@@ -11,10 +11,15 @@
 
 #include "CSelectionBase.h"
 
-class CSelectionBase;
+VCMI_LIB_NAMESPACE_BEGIN
+
 struct StartInfo;
 class CMapInfo;
 
+VCMI_LIB_NAMESPACE_END
+
+class CSelectionBase;
+
 class CSavingScreen : public CSelectionBase
 {
 public:

+ 8 - 3
client/lobby/CSelectionBase.h

@@ -11,6 +11,14 @@
 
 #include "../mainmenu/CMainMenu.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
+class CMapInfo;
+struct StartInfo;
+struct PlayerInfo;
+
+VCMI_LIB_NAMESPACE_END
+
 class CButton;
 class CTextBox;
 class CTextInput;
@@ -21,9 +29,6 @@ class OptionsTab;
 class SelectionTab;
 class InfoCard;
 class CChatBox;
-class CMapInfo;
-struct StartInfo;
-struct PlayerInfo;
 class CLabel;
 class CFlagBox;
 class CLabelGroup;

+ 5 - 0
client/lobby/RandomMapTab.h

@@ -14,7 +14,12 @@
 #include "../../lib/FunctionList.h"
 #include "../../lib/GameConstants.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CMapGenOptions;
+
+VCMI_LIB_NAMESPACE_END
+
 class CToggleButton;
 class CLabel;
 class CLabelGroup;

+ 6 - 1
client/mainmenu/CCampaignScreen.h

@@ -11,11 +11,16 @@
 
 #include "../windows/CWindowObject.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
+class JsonNode;
+
+VCMI_LIB_NAMESPACE_END
+
 class CLabel;
 class CPicture;
 class CButton;
 struct SDL_Surface;
-class JsonNode;
 
 class CCampaignScreen : public CWindowObject
 {

+ 5 - 0
client/mainmenu/CMainMenu.h

@@ -12,7 +12,12 @@
 #include "../windows/CWindowObject.h"
 #include "../../lib/JsonNode.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CCampaignState;
+
+VCMI_LIB_NAMESPACE_END
+
 class CTextInput;
 class CGStatusBar;
 class CTextBox;

+ 6 - 1
client/mapHandler.h

@@ -23,17 +23,22 @@
 #undef OUT
 #endif
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CGObjectInstance;
 class CGHeroInstance;
 class CGBoat;
 class CMap;
 struct TerrainTile;
+class PlayerColor;
+
+VCMI_LIB_NAMESPACE_END
+
 struct SDL_Surface;
 struct SDL_Rect;
 class CAnimation;
 class IImage;
 class CFadeAnimation;
-class PlayerColor;
 
 enum class EWorldViewIcon
 {

+ 11 - 6
client/widgets/AdventureMapClasses.h

@@ -13,21 +13,26 @@
 #include "../../lib/FunctionList.h"
 #include "Terrain.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CArmedInstance;
-class CAnimation;
-class CAnimImage;
-class CShowableAnim;
-class CFilledTexture;
 class CGGarrison;
 class CGObjectInstance;
 class CGHeroInstance;
 class CGTownInstance;
-class CButton;
 struct Component;
-class CComponent;
 struct InfoAboutArmy;
 struct InfoAboutHero;
 struct InfoAboutTown;
+
+VCMI_LIB_NAMESPACE_END
+
+class CAnimation;
+class CAnimImage;
+class CShowableAnim;
+class CFilledTexture;
+class CButton;
+class CComponent;
 class CHeroTooltip;
 class CTownTooltip;
 class CTextBox;

+ 9 - 5
client/widgets/Buttons.h

@@ -14,17 +14,21 @@
 
 #include "../../lib/FunctionList.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
+namespace config
+{
+struct ButtonInfo;
+}
+
+VCMI_LIB_NAMESPACE_END
+
 struct SDL_Surface;
 struct Rect;
 class CAnimImage;
 class CLabel;
 class CAnimation;
 
-namespace config
-{
-	struct ButtonInfo;
-}
-
 /// Typical Heroes 3 button which can be inactive or active and can
 /// hold further information if you right-click it
 class CButton : public CKeyShortcut

+ 6 - 2
client/widgets/CArtifactHolder.h

@@ -11,12 +11,16 @@
 
 #include "MiscWidgets.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
+struct ArtifactLocation;
+
+VCMI_LIB_NAMESPACE_END
+
 class CArtifactsOfHero;
 class CAnimImage;
 class CButton;
 
-struct ArtifactLocation;
-
 class CArtifactHolder
 {
 public:

+ 5 - 0
client/widgets/CComponent.h

@@ -11,7 +11,12 @@
 
 #include "../gui/CIntObject.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 struct Component;
+
+VCMI_LIB_NAMESPACE_END
+
 class CAnimImage;
 class CLabel;
 

+ 8 - 3
client/widgets/CGarrisonInt.h

@@ -11,13 +11,18 @@
 
 #include "../windows/CWindowObject.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
+class CArmedInstance;
+class CCreatureSet;
+class CStackInstance;
+
+VCMI_LIB_NAMESPACE_END
+
 class CGarrisonInt;
 class CButton;
-class CArmedInstance;
 class CAnimImage;
-class CCreatureSet;
 class CGarrisonSlot;
-class CStackInstance;
 class CLabel;
 
 /// A single garrison slot which holds one creature of a specific amount

+ 8 - 3
client/widgets/MiscWidgets.h

@@ -11,13 +11,18 @@
 
 #include "../gui/CIntObject.h"
 
-class CLabel;
-class CCreatureAnim;
-class CComponent;
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CGGarrison;
 struct InfoAboutArmy;
 class CArmedInstance;
 class IBonusBearer;
+
+VCMI_LIB_NAMESPACE_END
+
+class CLabel;
+class CCreatureAnim;
+class CComponent;
 class CAnimImage;
 
 /// Shows a text by moving the mouse cursor over the object

+ 8 - 3
client/windows/CAdvmapInterface.h

@@ -17,14 +17,19 @@
 
 #include "../../lib/spells/ViewSpellInt.h"
 
-class CCallback;
+VCMI_LIB_NAMESPACE_BEGIN
+
 struct CGPath;
-class CAdvMapInt;
 class CGHeroInstance;
 class CGTownInstance;
-class CHeroWindow;
 class CSpell;
 class IShipyard;
+
+VCMI_LIB_NAMESPACE_END
+
+class CCallback;
+class CAdvMapInt;
+class CHeroWindow;
 enum class EMapAnimRedrawStatus;
 class CFadeAnimation;
 

+ 11 - 6
client/windows/CCastleInterface.h

@@ -12,23 +12,28 @@
 #include "../widgets/CGarrisonInt.h"
 #include "../widgets/Images.h"
 
-class CButton;
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CBuilding;
+class CGTownInstance;
+class CSpell;
+struct CStructure;
+class CGHeroInstance;
+class CCreature;
+
+VCMI_LIB_NAMESPACE_END
+
+class CButton;
 class CCastleBuildings;
 class CCreaturePic;
 class CGStatusBar;
-class CGTownInstance;
 class CLabel;
 class CMinorResDataBar;
 class CPicture;
 class CResDataBar;
-class CSpell;
 class CTextBox;
 class CTownList;
-struct CStructure;
-class CGHeroInstance;
 class CGarrisonInt;
-class CCreature;
 class CComponent;
 class CComponentBox;
 

+ 6 - 1
client/windows/CCreatureWindow.h

@@ -13,11 +13,16 @@
 #include "../widgets/MiscWidgets.h"
 #include "CWindowObject.h"
 
-class UnitView;
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CCommanderInstance;
 class CStackInstance;
 class CStack;
 struct UpgradeInfo;
+
+VCMI_LIB_NAMESPACE_END
+
+class UnitView;
 class CTabbedInt;
 class CButton;
 class CMultiLineLabel;

+ 6 - 1
client/windows/CHeroWindow.h

@@ -13,9 +13,14 @@
 #include "../widgets/CArtifactHolder.h"
 #include "../widgets/CGarrisonInt.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
+class CGHeroInstance;
+
+VCMI_LIB_NAMESPACE_END
+
 class CButton;
 struct SDL_Surface;
-class CGHeroInstance;
 class CHeroWindow;
 class LClickableAreaHero;
 class LRClickableAreaWText;

+ 5 - 0
client/windows/CQuestLog.cpp

@@ -29,7 +29,12 @@
 #include "../../lib/NetPacksBase.h"
 #include "../../lib/mapObjects/CQuest.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 struct QuestInfo;
+
+VCMI_LIB_NAMESPACE_END
+
 class CAdvmapInterface;
 
 void CQuestLabel::clickLeft(tribool down, bool previousState)

+ 7 - 2
client/windows/CQuestLog.h

@@ -15,11 +15,17 @@
 #include "../widgets/Images.h"
 #include "CWindowObject.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CCreature;
 class CStackInstance;
+class CGHeroInstance;
+struct QuestInfo;
+
+VCMI_LIB_NAMESPACE_END
+
 class CButton;
 class CToggleButton;
-class CGHeroInstance;
 class CComponentBox;
 class LRClickableAreaWText;
 class CButton;
@@ -28,7 +34,6 @@ class CCreaturePic;
 class LRClickableAreaWTextComp;
 class CSlider;
 class CLabel;
-struct QuestInfo;
 
 const int QUEST_COUNT = 6;
 const int DESCRIPTION_HEIGHT_MAX = 355;

+ 7 - 2
client/windows/CSpellWindow.h

@@ -11,17 +11,22 @@
 
 #include "CWindowObject.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
+class CGHeroInstance;
+class CSpell;
+
+VCMI_LIB_NAMESPACE_END
+
 struct SDL_Surface;
 struct SDL_Rect;
 class IImage;
 class CAnimImage;
 class CPicture;
 class CLabel;
-class CGHeroInstance;
 class CGStatusBar;
 class CPlayerInterface;
 class CSpellWindow;
-class CSpell;
 
 /// The spell window
 class CSpellWindow : public CWindowObject

+ 5 - 0
client/windows/CTradeWindow.h

@@ -13,7 +13,12 @@
 #include "CWindowObject.h"
 #include "../../lib/FunctionList.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class IMarket;
+
+VCMI_LIB_NAMESPACE_END
+
 class CSlider;
 class CTextBox;
 class CGStatusBar;

+ 6 - 1
client/windows/GUIClasses.h

@@ -17,9 +17,14 @@
 #include "../widgets/CGarrisonInt.h"
 #include "../widgets/Images.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CGDwelling;
-class CreatureCostBox;
 class IMarket;
+
+VCMI_LIB_NAMESPACE_END
+
+class CreatureCostBox;
 class CCreaturePic;
 class MoraleLuckBox;
 class CHeroArea;

+ 6 - 1
client/windows/InfoWindows.h

@@ -12,6 +12,12 @@
 #include "CWindowObject.h"
 #include "../../lib/FunctionList.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
+class CGGarrison;
+
+VCMI_LIB_NAMESPACE_END
+
 struct SDL_Surface;
 struct Rect;
 class CAnimImage;
@@ -19,7 +25,6 @@ class CLabel;
 class CAnimation;
 class CComponent;
 class CSelectableComponent;
-class CGGarrison;
 class CTextBox;
 class CButton;
 class CSlider;

+ 4 - 0
include/vcmi/Artifact.h

@@ -12,6 +12,8 @@
 
 #include "Entity.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class ArtifactID;
 class CreatureID;
 
@@ -25,3 +27,5 @@ public:
 	virtual uint32_t getPrice() const = 0;
 	virtual CreatureID getWarMachine() const = 0;
 };
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/ArtifactService.h

@@ -12,6 +12,8 @@
 
 #include "EntityService.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class ArtifactID;
 class Artifact;
 
@@ -19,3 +21,5 @@ class DLL_LINKAGE ArtifactService : public EntityServiceT<ArtifactID, Artifact>
 {
 public:
 };
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/Creature.h

@@ -12,6 +12,8 @@
 
 #include "Entity.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CreatureID;
 
 class DLL_LINKAGE Creature : public EntityWithBonuses<CreatureID>
@@ -43,3 +45,5 @@ public:
 
 	virtual bool isDoubleWide() const = 0;
 };
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/CreatureService.h

@@ -12,6 +12,8 @@
 
 #include "EntityService.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CreatureID;
 class Creature;
 
@@ -19,3 +21,5 @@ class DLL_LINKAGE CreatureService : public EntityServiceT<CreatureID, Creature>
 {
 public:
 };
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/Entity.h

@@ -10,6 +10,8 @@
 
 #pragma once
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class IBonusBearer;
 
 class DLL_LINKAGE Entity
@@ -40,3 +42,5 @@ class DLL_LINKAGE EntityWithBonuses : public EntityT<IdType>
 public:
 	virtual const IBonusBearer * accessBonuses() const = 0;
 };
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/EntityService.h

@@ -10,6 +10,8 @@
 
 #pragma once
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class Entity;
 
 class DLL_LINKAGE EntityService
@@ -30,3 +32,5 @@ public:
 
 	virtual void forEach(const std::function<void(const EntityType * entity, bool & stop)> & cb) const = 0;
 };
+
+VCMI_LIB_NAMESPACE_END

+ 6 - 2
include/vcmi/Environment.h

@@ -10,6 +10,8 @@
 
 #pragma once
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class Services;
 
 class IGameInfoCallback;
@@ -23,8 +25,8 @@ namespace events
 class DLL_LINKAGE Environment
 {
 public:
-	using BattleCb = ::IBattleInfoCallback;
-	using GameCb = ::IGameInfoCallback;
+	using BattleCb = IBattleInfoCallback;
+	using GameCb = IGameInfoCallback;
 
 	virtual ~Environment() = default;
 
@@ -34,3 +36,5 @@ public:
 	virtual vstd::CLoggerBase * logger() const = 0;
 	virtual events::EventBus * eventBus() const = 0;
 };
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/Faction.h

@@ -12,6 +12,8 @@
 
 #include "Entity.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class FactionID;
 
 class DLL_LINKAGE Faction : public EntityT<FactionID>
@@ -19,3 +21,5 @@ class DLL_LINKAGE Faction : public EntityT<FactionID>
 public:
 	virtual bool hasTown() const = 0;
 };
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/FactionService.h

@@ -12,6 +12,8 @@
 
 #include "EntityService.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class FactionID;
 class Faction;
 
@@ -19,3 +21,5 @@ class DLL_LINKAGE FactionService : public EntityServiceT<FactionID, Faction>
 {
 public:
 };
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/HeroClass.h

@@ -12,6 +12,8 @@
 
 #include "Entity.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class HeroClassID;
 
 class DLL_LINKAGE HeroClass : public EntityT<HeroClassID>
@@ -20,3 +22,5 @@ public:
 
 };
 
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/HeroClassService.h

@@ -12,6 +12,8 @@
 
 #include "EntityService.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class HeroClassID;
 class HeroClass;
 
@@ -19,3 +21,5 @@ class DLL_LINKAGE HeroClassService : public EntityServiceT<HeroClassID, HeroClas
 {
 public:
 };
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/HeroType.h

@@ -12,6 +12,8 @@
 
 #include "Entity.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class HeroTypeID;
 
 class DLL_LINKAGE HeroType : public EntityT<HeroTypeID>
@@ -20,3 +22,5 @@ public:
 
 };
 
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/HeroTypeService.h

@@ -12,6 +12,8 @@
 
 #include "EntityService.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class HeroTypeID;
 class HeroType;
 
@@ -19,3 +21,5 @@ class DLL_LINKAGE HeroTypeService : public EntityServiceT<HeroTypeID, HeroType>
 {
 public:
 };
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/Metatype.h

@@ -10,6 +10,8 @@
 
 #pragma once
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 enum class Metatype : uint32_t
 {
 	UNKNOWN = 0,
@@ -28,3 +30,5 @@ enum class Metatype : uint32_t
 	SPELL
 };
 
+
+VCMI_LIB_NAMESPACE_END

+ 3 - 4
include/vcmi/Player.h

@@ -10,6 +10,8 @@
 
 #pragma once
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class PlayerColor;
 class TeamID;
 class IBonusBearer;
@@ -24,7 +26,4 @@ public:
 	virtual int getResourceAmount(int type) const = 0;
 };
 
-
-
-
-
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/ServerCallback.h

@@ -10,6 +10,8 @@
 
 #pragma once
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 namespace vstd
 {
 	class RNG;
@@ -44,3 +46,5 @@ public:
 	virtual void apply(BattleObstaclesChanged * pack) = 0;
 	virtual void apply(CatapultAttack * pack) = 0;
 };
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/Services.h

@@ -12,6 +12,8 @@
 
 #include "Metatype.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class ArtifactService;
 class CreatureService;
 class FactionService;
@@ -63,3 +65,5 @@ public:
 	virtual spells::effects::Registry * spellEffects() = 0;
 	//TODO: put map object types registry access here
 };
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/Skill.h

@@ -12,6 +12,8 @@
 
 #include "Entity.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class SecondarySkill;
 
 class DLL_LINKAGE Skill : public EntityT<SecondarySkill>
@@ -20,3 +22,5 @@ public:
 
 };
 
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/SkillService.h

@@ -12,6 +12,8 @@
 
 #include "EntityService.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class SecondarySkill;
 class Skill;
 
@@ -19,3 +21,5 @@ class DLL_LINKAGE SkillService : public EntityServiceT<SecondarySkill, Skill>
 {
 public:
 };
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/events/ApplyDamage.h

@@ -13,6 +13,8 @@
 #include "Event.h"
 #include "SubscriptionRegistry.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 struct BattleStackAttacked;
 
 namespace battle
@@ -43,3 +45,5 @@ public:
 };
 
 }
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/events/Event.h

@@ -10,6 +10,8 @@
 
 #pragma once
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 namespace events
 {
 
@@ -27,3 +29,5 @@ public:
 
 }
 
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/events/EventBus.h

@@ -12,6 +12,8 @@
 
 #include "SubscriptionRegistry.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class Environment;
 
 namespace events
@@ -42,3 +44,5 @@ public:
 	}
 };
 }
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/events/GameResumed.h

@@ -13,6 +13,8 @@
 #include "Event.h"
 #include "SubscriptionRegistry.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 namespace events
 {
 
@@ -33,3 +35,5 @@ public:
 };
 
 }
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/events/ObjectVisitEnded.h

@@ -13,6 +13,8 @@
 #include "Event.h"
 #include "SubscriptionRegistry.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class PlayerColor;
 class ObjectInstanceID;
 
@@ -38,3 +40,5 @@ public:
 };
 
 }
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/events/ObjectVisitStarted.h

@@ -13,6 +13,8 @@
 #include "Event.h"
 #include "SubscriptionRegistry.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class PlayerColor;
 class ObjectInstanceID;
 
@@ -41,3 +43,5 @@ public:
 };
 
 }
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/events/PlayerGotTurn.h

@@ -13,6 +13,8 @@
 #include "Event.h"
 #include "SubscriptionRegistry.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class PlayerColor;
 
 namespace events
@@ -39,3 +41,5 @@ public:
 };
 
 }
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/events/SubscriptionRegistry.h

@@ -10,6 +10,8 @@
 
 #pragma once
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class Environment;
 
 namespace events
@@ -164,3 +166,5 @@ private:
 	}
 };
 }
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/events/TurnStarted.h

@@ -13,6 +13,8 @@
 #include "Event.h"
 #include "SubscriptionRegistry.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 namespace events
 {
 
@@ -31,3 +33,5 @@ public:
 };
 
 }
+
+VCMI_LIB_NAMESPACE_END

+ 6 - 2
include/vcmi/scripting/Service.h

@@ -13,6 +13,8 @@
 #if SCRIPTING_ENABLED
 #include <vcmi/Environment.h>
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class Services;
 class JsonNode;
 class ServerCallback;
@@ -20,8 +22,8 @@ class ServerCallback;
 namespace scripting
 {
 
-using BattleCb = ::Environment::BattleCb;
-using GameCb = ::Environment::GameCb;
+using BattleCb = Environment::BattleCb;
+using GameCb = Environment::GameCb;
 
 class DLL_LINKAGE Context
 {
@@ -79,4 +81,6 @@ public:
 
 
 }
+
+VCMI_LIB_NAMESPACE_END
 #endif

+ 4 - 0
include/vcmi/spells/Caster.h

@@ -10,6 +10,8 @@
 
 #pragma once
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class PlayerColor;
 struct MetaString;
 class ServerCallback;
@@ -66,3 +68,5 @@ public:
 };
 
 }
+
+VCMI_LIB_NAMESPACE_END

+ 5 - 1
include/vcmi/spells/Magic.h

@@ -10,6 +10,8 @@
 
 #pragma once
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 struct MetaString;
 
 namespace battle
@@ -24,7 +26,7 @@ class Caster;
 class Spell;
 class Mechanics;
 class BattleCast;
-using Destination = ::battle::Destination;
+using Destination = battle::Destination;
 
 using Target = std::vector<Destination>;
 
@@ -67,3 +69,5 @@ public:
 };
 
 }
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/spells/Service.h

@@ -12,6 +12,8 @@
 
 #include "../EntityService.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class SpellID;
 
 namespace spells
@@ -24,3 +26,5 @@ public:
 };
 
 }
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vcmi/spells/Spell.h

@@ -12,6 +12,8 @@
 
 #include "../Entity.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class SpellID;
 
 namespace spells
@@ -54,3 +56,5 @@ public:
 };
 
 }
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vstd/CLoggerBase.h

@@ -10,6 +10,8 @@
 
 #pragma once
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 namespace ELogLevel
 {
 	enum ELogLevel
@@ -191,3 +193,5 @@ extern DLL_LINKAGE vstd::CLoggerBase * logNetwork;
 extern DLL_LINKAGE vstd::CLoggerBase * logAi;
 extern DLL_LINKAGE vstd::CLoggerBase * logAnim;
 extern DLL_LINKAGE vstd::CLoggerBase * logMod;
+
+VCMI_LIB_NAMESPACE_END

+ 3 - 2
include/vstd/ContainerUtils.h

@@ -10,6 +10,8 @@
 
 #pragma once
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 namespace vstd
 {
 	template<typename K, typename V>
@@ -24,5 +26,4 @@ namespace vstd
 	}
 }
 
-
-
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vstd/RNG.h

@@ -10,6 +10,8 @@
 
 #pragma once
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 namespace vstd
 {
 
@@ -56,3 +58,5 @@ namespace RandomGeneratorUtil
 		}
 	}
 }
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
include/vstd/StringUtils.h

@@ -1,5 +1,7 @@
 #pragma once
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 namespace vstd
 {
 
@@ -7,3 +9,5 @@ namespace vstd
 	DLL_LINKAGE std::pair<std::string, std::string> splitStringToPair(std::string input, char separator);
 
 }
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
launcher/updatedialog_moc.h

@@ -11,8 +11,12 @@
 #include <QDialog>
 #include <QNetworkAccessManager>
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class JsonNode;
 
+VCMI_LIB_NAMESPACE_END
+
 namespace Ui {
 class UpdateDialog;
 }

+ 5 - 1
lib/BattleFieldHandler.cpp

@@ -12,6 +12,8 @@
 #include <vcmi/Entity.h>
 #include "BattleFieldHandler.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 BattleFieldInfo * BattleFieldHandler::loadFromJson(const std::string & scope, const JsonNode & json, const std::string & identifier, size_t index)
 {
 	BattleFieldInfo * info = new BattleFieldInfo(BattleField(index), identifier);
@@ -105,4 +107,6 @@ void BattleFieldInfo::registerIcons(const IconRegistar & cb) const
 BattleField BattleFieldInfo::getId() const
 {
 	return battlefield;
-}
+}
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
lib/BattleFieldHandler.h

@@ -17,6 +17,8 @@
 #include "Terrain.h"
 #include "battle/BattleHex.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class BattleFieldInfo : public EntityT<BattleField>
 {
 public:
@@ -84,3 +86,5 @@ public:
 		h & objects;
 	}
 };
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
lib/CArtHandler.cpp

@@ -48,6 +48,8 @@
 	ART_POS(SHOULDERS)  \
 	ART_POS(HEAD)
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 int32_t CArtifact::getIndex() const
 {
 	return id.toEnum();
@@ -1434,3 +1436,5 @@ void CArtifactSet::serializeJsonSlot(JsonSerializeFormat & handler, const Artifa
 		}
 	}
 }
+
+VCMI_LIB_NAMESPACE_END

+ 4 - 0
lib/CArtHandler.h

@@ -16,6 +16,8 @@
 #include "GameConstants.h"
 #include "IHandlerBase.h"
 
+VCMI_LIB_NAMESPACE_BEGIN
+
 class CArtHandler;
 class CArtifact;
 class CGHeroInstance;
@@ -358,3 +360,5 @@ private:
 
 	void serializeJsonSlot(JsonSerializeFormat & handler, const ArtifactPosition & slot, CMap * map);//normal slots
 };
+
+VCMI_LIB_NAMESPACE_END

+ 5 - 1
lib/CBonusTypeHandler.cpp

@@ -20,7 +20,9 @@
 #include "CCreatureHandler.h"
 #include "spells/CSpellHandler.h"
 
-template class std::vector<CBonusType>;
+template class std::vector<VCMI_LIB_WRAP_NAMESPACE(CBonusType)>;
+
+VCMI_LIB_NAMESPACE_BEGIN
 
 ///MacroString
 
@@ -326,3 +328,5 @@ void CBonusTypeHandler::loadItem(const JsonNode & source, CBonusType & dest)
 	}
 	dest.buildMacros();
 }
+
+VCMI_LIB_NAMESPACE_END

Some files were not shown because too many files changed in this diff