From ff635edc0b6f48e1a829b8326487d0a32f999197 Mon Sep 17 00:00:00 2001 From: Andrey Filipenkov Date: Tue, 26 Jul 2022 16:07:42 +0300 Subject: [PATCH] wrap all library code into namespace if VCMI_LIB_NAMESPACE is defined preparation for having client and server in a single process --- AI/BattleAI/BattleAI.h | 5 ++ AI/BattleAI/EnemyInfo.h | 4 ++ AI/BattleAI/PossibleSpellcast.h | 4 ++ AI/BattleAI/StackWithBonuses.h | 7 ++- AI/BattleAI/StdInc.h | 2 + AI/Nullkiller/AIGateway.h | 4 ++ AI/Nullkiller/Engine/FuzzyEngines.h | 4 ++ AI/Nullkiller/Engine/FuzzyHelper.h | 5 ++ AI/Nullkiller/Engine/PriorityEvaluator.h | 7 ++- AI/Nullkiller/Pathfinding/Actors.cpp | 2 + AI/Nullkiller/StdInc.h | 1 + AI/StupidAI/StdInc.h | 4 +- AI/VCAI/FuzzyEngines.h | 4 ++ AI/VCAI/FuzzyHelper.h | 4 ++ AI/VCAI/StdInc.h | 2 + AI/VCAI/VCAI.cpp | 4 ++ AI/VCAI/VCAI.h | 4 ++ CCallback.h | 12 ++-- Global.h | 17 ++++++ Version.cpp.in | 4 ++ Version.h | 4 ++ client/CGameInfo.h | 16 ++++-- client/CPlayerInterface.h | 31 ++++++----- client/CServerHandler.h | 11 +++- client/Client.h | 16 ++++-- client/Graphics.h | 11 +++- client/SDLRWwrapper.h | 7 ++- client/StdInc.h | 2 + client/battle/CBattleAnimations.h | 7 ++- client/battle/CBattleInterface.h | 27 +++++---- client/battle/CBattleInterfaceClasses.h | 20 ++++--- client/gui/CAnimation.h | 7 ++- client/gui/CGuiHandler.h | 7 ++- client/gui/Fonts.h | 4 ++ client/lobby/CBonusSelection.h | 9 ++- client/lobby/CSavingScreen.h | 7 ++- client/lobby/CSelectionBase.h | 11 +++- client/lobby/RandomMapTab.h | 5 ++ client/mainmenu/CCampaignScreen.h | 7 ++- client/mainmenu/CMainMenu.h | 5 ++ client/mapHandler.h | 7 ++- client/widgets/AdventureMapClasses.h | 17 ++++-- client/widgets/Buttons.h | 14 +++-- client/widgets/CArtifactHolder.h | 8 ++- client/widgets/CComponent.h | 5 ++ client/widgets/CGarrisonInt.h | 11 +++- client/widgets/MiscWidgets.h | 11 +++- client/windows/CAdvmapInterface.h | 11 +++- client/windows/CCastleInterface.h | 17 ++++-- client/windows/CCreatureWindow.h | 7 ++- client/windows/CHeroWindow.h | 7 ++- client/windows/CQuestLog.cpp | 5 ++ client/windows/CQuestLog.h | 9 ++- client/windows/CSpellWindow.h | 9 ++- client/windows/CTradeWindow.h | 5 ++ client/windows/GUIClasses.h | 7 ++- client/windows/InfoWindows.h | 7 ++- include/vcmi/Artifact.h | 4 ++ include/vcmi/ArtifactService.h | 4 ++ include/vcmi/Creature.h | 4 ++ include/vcmi/CreatureService.h | 4 ++ include/vcmi/Entity.h | 4 ++ include/vcmi/EntityService.h | 4 ++ include/vcmi/Environment.h | 8 ++- include/vcmi/Faction.h | 4 ++ include/vcmi/FactionService.h | 4 ++ include/vcmi/HeroClass.h | 4 ++ include/vcmi/HeroClassService.h | 4 ++ include/vcmi/HeroType.h | 4 ++ include/vcmi/HeroTypeService.h | 4 ++ include/vcmi/Metatype.h | 4 ++ include/vcmi/Player.h | 7 +-- include/vcmi/ServerCallback.h | 4 ++ include/vcmi/Services.h | 4 ++ include/vcmi/Skill.h | 4 ++ include/vcmi/SkillService.h | 4 ++ include/vcmi/events/ApplyDamage.h | 4 ++ include/vcmi/events/Event.h | 4 ++ include/vcmi/events/EventBus.h | 4 ++ include/vcmi/events/GameResumed.h | 4 ++ include/vcmi/events/ObjectVisitEnded.h | 4 ++ include/vcmi/events/ObjectVisitStarted.h | 4 ++ include/vcmi/events/PlayerGotTurn.h | 4 ++ include/vcmi/events/SubscriptionRegistry.h | 4 ++ include/vcmi/events/TurnStarted.h | 4 ++ include/vcmi/scripting/Service.h | 8 ++- include/vcmi/spells/Caster.h | 4 ++ include/vcmi/spells/Magic.h | 6 +- include/vcmi/spells/Service.h | 4 ++ include/vcmi/spells/Spell.h | 4 ++ include/vstd/CLoggerBase.h | 4 ++ include/vstd/ContainerUtils.h | 5 +- include/vstd/RNG.h | 4 ++ include/vstd/StringUtils.h | 4 ++ launcher/updatedialog_moc.h | 4 ++ lib/BattleFieldHandler.cpp | 6 +- lib/BattleFieldHandler.h | 4 ++ lib/CArtHandler.cpp | 4 ++ lib/CArtHandler.h | 4 ++ lib/CBonusTypeHandler.cpp | 6 +- lib/CBonusTypeHandler.h | 6 +- lib/CBuildingHandler.cpp | 4 ++ lib/CBuildingHandler.h | 4 ++ lib/CConfigHandler.cpp | 4 ++ lib/CConfigHandler.h | 4 ++ lib/CConsoleHandler.cpp | 4 ++ lib/CConsoleHandler.h | 4 ++ lib/CCreatureHandler.cpp | 4 ++ lib/CCreatureHandler.h | 4 ++ lib/CCreatureSet.cpp | 4 ++ lib/CCreatureSet.h | 4 ++ lib/CGameInfoCallback.cpp | 4 ++ lib/CGameInfoCallback.h | 5 ++ lib/CGameInterface.cpp | 4 ++ lib/CGameInterface.h | 9 ++- lib/CGameState.cpp | 4 ++ lib/CGameState.h | 18 +++--- lib/CGameStateFwd.h | 4 ++ lib/CGeneralTextHandler.cpp | 4 ++ lib/CGeneralTextHandler.h | 4 ++ lib/CHeroHandler.cpp | 4 ++ lib/CHeroHandler.h | 5 +- lib/CModHandler.cpp | 4 ++ lib/CModHandler.h | 4 ++ lib/CPathfinder.cpp | 4 ++ lib/CPathfinder.h | 4 ++ lib/CPlayerState.cpp | 4 ++ lib/CPlayerState.h | 4 ++ lib/CRandomGenerator.cpp | 4 ++ lib/CRandomGenerator.h | 4 ++ lib/CScriptingModule.cpp | 4 ++ lib/CScriptingModule.h | 4 ++ lib/CSkillHandler.cpp | 4 ++ lib/CSkillHandler.h | 4 ++ lib/CSoundBase.h | 4 ++ lib/CStack.cpp | 4 ++ lib/CStack.h | 4 ++ lib/CStopWatch.h | 4 ++ lib/CThreadHelper.cpp | 4 ++ lib/CThreadHelper.h | 4 ++ lib/CTownHandler.cpp | 4 ++ lib/CTownHandler.h | 4 ++ lib/CondSh.h | 4 ++ lib/ConstTransitivePtr.h | 6 +- lib/FunctionList.h | 4 ++ lib/GameConstants.cpp | 4 ++ lib/GameConstants.h | 4 ++ lib/HeroBonus.cpp | 4 ++ lib/HeroBonus.h | 4 ++ lib/IBonusTypeHandler.h | 4 ++ lib/IGameCallback.cpp | 4 ++ lib/IGameCallback.h | 4 ++ lib/IGameEventsReceiver.h | 8 ++- lib/IHandlerBase.cpp | 4 ++ lib/IHandlerBase.h | 4 ++ lib/Interprocess.h | 4 ++ lib/JsonDetail.cpp | 4 ++ lib/JsonDetail.h | 4 ++ lib/JsonNode.cpp | 65 ++++++++++++---------- lib/JsonNode.h | 4 ++ lib/LogicalExpression.cpp | 4 ++ lib/LogicalExpression.h | 4 ++ lib/NetPacks.h | 7 ++- lib/NetPacksBase.h | 19 ++++--- lib/NetPacksLib.cpp | 4 ++ lib/NetPacksLobby.h | 9 ++- lib/ObstacleHandler.cpp | 4 ++ lib/ObstacleHandler.h | 4 ++ lib/PathfinderUtil.h | 4 ++ lib/ResourceSet.cpp | 10 +++- lib/ResourceSet.h | 4 ++ lib/ScopeGuard.h | 4 ++ lib/ScriptHandler.cpp | 6 +- lib/ScriptHandler.h | 8 ++- lib/StartInfo.cpp | 4 ++ lib/StartInfo.h | 7 +++ lib/StringConstants.h | 4 ++ lib/Terrain.cpp | 4 ++ lib/Terrain.h | 3 + lib/UnlockGuard.h | 4 ++ lib/VCMIDirs.cpp | 4 ++ lib/VCMIDirs.h | 4 ++ lib/VCMI_Lib.cpp | 4 ++ lib/VCMI_Lib.h | 4 ++ lib/abilities/Ability.h | 5 ++ lib/battle/AccessibilityInfo.cpp | 4 ++ lib/battle/AccessibilityInfo.h | 4 ++ lib/battle/BattleAction.cpp | 4 ++ lib/battle/BattleAction.h | 4 ++ lib/battle/BattleAttackInfo.cpp | 4 ++ lib/battle/BattleAttackInfo.h | 8 ++- lib/battle/BattleHex.cpp | 4 ++ lib/battle/BattleHex.h | 4 ++ lib/battle/BattleInfo.cpp | 4 ++ lib/battle/BattleInfo.h | 4 ++ lib/battle/BattleProxy.cpp | 4 ++ lib/battle/BattleProxy.h | 4 ++ lib/battle/CBattleInfoCallback.cpp | 4 ++ lib/battle/CBattleInfoCallback.h | 4 ++ lib/battle/CBattleInfoEssentials.cpp | 4 ++ lib/battle/CBattleInfoEssentials.h | 4 ++ lib/battle/CCallbackBase.cpp | 4 ++ lib/battle/CCallbackBase.h | 4 ++ lib/battle/CObstacleInstance.cpp | 4 ++ lib/battle/CObstacleInstance.h | 4 ++ lib/battle/CPlayerBattleCallback.cpp | 4 ++ lib/battle/CPlayerBattleCallback.h | 4 ++ lib/battle/CUnitState.cpp | 4 ++ lib/battle/CUnitState.h | 4 ++ lib/battle/Destination.cpp | 4 ++ lib/battle/Destination.h | 4 ++ lib/battle/IBattleInfoCallback.h | 4 ++ lib/battle/IBattleState.h | 4 ++ lib/battle/IUnitInfo.h | 4 ++ lib/battle/ReachabilityInfo.cpp | 4 ++ lib/battle/ReachabilityInfo.h | 4 ++ lib/battle/SideInBattle.cpp | 4 ++ lib/battle/SideInBattle.h | 4 ++ lib/battle/SiegeInfo.cpp | 4 ++ lib/battle/SiegeInfo.h | 4 ++ lib/battle/Unit.cpp | 4 ++ lib/battle/Unit.h | 4 ++ lib/events/ApplyDamage.cpp | 4 ++ lib/events/ApplyDamage.h | 4 ++ lib/events/GameResumed.cpp | 4 ++ lib/events/GameResumed.h | 4 ++ lib/events/ObjectVisitEnded.cpp | 4 ++ lib/events/ObjectVisitEnded.h | 4 ++ lib/events/ObjectVisitStarted.cpp | 4 ++ lib/events/ObjectVisitStarted.h | 4 ++ lib/events/PlayerGotTurn.cpp | 4 ++ lib/events/PlayerGotTurn.h | 4 ++ lib/events/TurnStarted.cpp | 4 ++ lib/events/TurnStarted.h | 4 ++ lib/filesystem/AdapterLoaders.cpp | 4 ++ lib/filesystem/AdapterLoaders.h | 4 ++ lib/filesystem/CArchiveLoader.cpp | 4 ++ lib/filesystem/CArchiveLoader.h | 4 ++ lib/filesystem/CBinaryReader.cpp | 4 ++ lib/filesystem/CBinaryReader.h | 4 ++ lib/filesystem/CCompressedStream.cpp | 4 ++ lib/filesystem/CCompressedStream.h | 4 ++ lib/filesystem/CFileInputStream.cpp | 4 ++ lib/filesystem/CFileInputStream.h | 4 ++ lib/filesystem/CFilesystemLoader.cpp | 4 ++ lib/filesystem/CFilesystemLoader.h | 4 ++ lib/filesystem/CInputOutputStream.h | 4 ++ lib/filesystem/CInputStream.h | 4 ++ lib/filesystem/CMemoryBuffer.cpp | 4 ++ lib/filesystem/CMemoryBuffer.h | 4 ++ lib/filesystem/CMemoryStream.cpp | 4 ++ lib/filesystem/CMemoryStream.h | 4 ++ lib/filesystem/COutputStream.h | 4 ++ lib/filesystem/CStream.h | 4 ++ lib/filesystem/CZipLoader.cpp | 4 ++ lib/filesystem/CZipLoader.h | 4 ++ lib/filesystem/CZipSaver.cpp | 4 ++ lib/filesystem/CZipSaver.h | 4 ++ lib/filesystem/FileInfo.cpp | 4 ++ lib/filesystem/FileInfo.h | 4 ++ lib/filesystem/FileStream.cpp | 8 ++- lib/filesystem/FileStream.h | 10 +++- lib/filesystem/Filesystem.cpp | 4 ++ lib/filesystem/Filesystem.h | 4 ++ lib/filesystem/ISimpleResourceLoader.h | 4 ++ lib/filesystem/MinizipExtensions.cpp | 4 ++ lib/filesystem/MinizipExtensions.h | 5 ++ lib/filesystem/ResourceID.cpp | 4 ++ lib/filesystem/ResourceID.h | 28 +++++----- lib/int3.h | 4 ++ lib/logging/CBasicLogConfigurator.cpp | 4 ++ lib/logging/CBasicLogConfigurator.h | 4 ++ lib/logging/CLogger.cpp | 4 ++ lib/logging/CLogger.h | 4 ++ lib/mapObjects/CArmedInstance.cpp | 4 ++ lib/mapObjects/CArmedInstance.h | 6 +- lib/mapObjects/CBank.cpp | 6 +- lib/mapObjects/CBank.h | 6 +- lib/mapObjects/CGHeroInstance.cpp | 4 ++ lib/mapObjects/CGHeroInstance.h | 4 ++ lib/mapObjects/CGMarket.cpp | 4 ++ lib/mapObjects/CGMarket.h | 6 +- lib/mapObjects/CGPandoraBox.cpp | 6 +- lib/mapObjects/CGPandoraBox.h | 6 +- lib/mapObjects/CGTownInstance.cpp | 4 ++ lib/mapObjects/CGTownInstance.h | 4 ++ lib/mapObjects/CObjectClassesHandler.cpp | 4 ++ lib/mapObjects/CObjectClassesHandler.h | 4 ++ lib/mapObjects/CObjectHandler.cpp | 4 ++ lib/mapObjects/CObjectHandler.h | 4 ++ lib/mapObjects/CQuest.cpp | 4 ++ lib/mapObjects/CQuest.h | 4 ++ lib/mapObjects/CRewardableConstructor.cpp | 4 ++ lib/mapObjects/CRewardableConstructor.h | 4 ++ lib/mapObjects/CRewardableObject.cpp | 4 ++ lib/mapObjects/CRewardableObject.h | 4 ++ lib/mapObjects/CommonConstructors.cpp | 4 ++ lib/mapObjects/CommonConstructors.h | 4 ++ lib/mapObjects/JsonRandom.cpp | 4 ++ lib/mapObjects/JsonRandom.h | 4 ++ lib/mapObjects/MiscObjects.cpp | 6 +- lib/mapObjects/MiscObjects.h | 4 ++ lib/mapObjects/ObjectTemplate.cpp | 3 + lib/mapObjects/ObjectTemplate.h | 4 ++ lib/mapping/CCampaignHandler.cpp | 4 ++ lib/mapping/CCampaignHandler.h | 4 ++ lib/mapping/CDrawRoadsOperation.cpp | 4 ++ lib/mapping/CDrawRoadsOperation.h | 4 ++ lib/mapping/CMap.cpp | 4 ++ lib/mapping/CMap.h | 4 ++ lib/mapping/CMapDefines.h | 4 ++ lib/mapping/CMapEditManager.cpp | 4 ++ lib/mapping/CMapEditManager.h | 4 ++ lib/mapping/CMapInfo.cpp | 4 ++ lib/mapping/CMapInfo.h | 4 ++ lib/mapping/CMapOperation.cpp | 6 +- lib/mapping/CMapOperation.h | 6 +- lib/mapping/CMapService.cpp | 4 ++ lib/mapping/CMapService.h | 4 ++ lib/mapping/MapEditUtils.cpp | 4 ++ lib/mapping/MapEditUtils.h | 4 ++ lib/mapping/MapFormatH3M.cpp | 4 ++ lib/mapping/MapFormatH3M.h | 4 ++ lib/mapping/MapFormatJson.cpp | 4 ++ lib/mapping/MapFormatJson.h | 4 ++ lib/registerTypes/RegisterTypes.cpp | 4 ++ lib/registerTypes/RegisterTypes.h | 4 ++ lib/registerTypes/TypesClientPacks1.cpp | 4 ++ lib/registerTypes/TypesClientPacks2.cpp | 4 ++ lib/registerTypes/TypesLobbyPacks.cpp | 4 ++ lib/registerTypes/TypesMapObjects1.cpp | 4 ++ lib/registerTypes/TypesMapObjects2.cpp | 4 ++ lib/registerTypes/TypesMapObjects3.cpp | 4 ++ lib/registerTypes/TypesServerPacks.cpp | 4 ++ lib/rmg/CMapGenOptions.cpp | 4 ++ lib/rmg/CMapGenOptions.h | 4 ++ lib/rmg/CMapGenerator.cpp | 4 ++ lib/rmg/CMapGenerator.h | 4 ++ lib/rmg/CRmgTemplate.cpp | 4 ++ lib/rmg/CRmgTemplate.h | 4 ++ lib/rmg/CRmgTemplateStorage.cpp | 4 ++ lib/rmg/CRmgTemplateStorage.h | 4 ++ lib/rmg/CZonePlacer.cpp | 4 ++ lib/rmg/CZonePlacer.h | 4 ++ lib/rmg/ConnectionsPlacer.cpp | 4 ++ lib/rmg/ConnectionsPlacer.h | 4 ++ lib/rmg/Functions.cpp | 4 ++ lib/rmg/Functions.h | 4 ++ lib/rmg/ObjectManager.cpp | 4 ++ lib/rmg/ObjectManager.h | 4 ++ lib/rmg/ObstaclePlacer.cpp | 4 ++ lib/rmg/ObstaclePlacer.h | 5 ++ lib/rmg/RiverPlacer.cpp | 4 ++ lib/rmg/RiverPlacer.h | 4 ++ lib/rmg/RmgArea.cpp | 4 ++ lib/rmg/RmgArea.h | 4 ++ lib/rmg/RmgMap.cpp | 4 ++ lib/rmg/RmgMap.h | 4 ++ lib/rmg/RmgObject.cpp | 4 ++ lib/rmg/RmgObject.h | 4 ++ lib/rmg/RmgPath.cpp | 4 ++ lib/rmg/RmgPath.h | 4 ++ lib/rmg/RoadPlacer.cpp | 4 ++ lib/rmg/RoadPlacer.h | 4 ++ lib/rmg/RockPlacer.cpp | 4 ++ lib/rmg/RockPlacer.h | 4 ++ lib/rmg/TerrainPainter.cpp | 4 ++ lib/rmg/TerrainPainter.h | 4 ++ lib/rmg/TileInfo.cpp | 4 ++ lib/rmg/TileInfo.h | 4 ++ lib/rmg/TownPlacer.cpp | 4 ++ lib/rmg/TownPlacer.h | 4 ++ lib/rmg/TreasurePlacer.cpp | 4 ++ lib/rmg/TreasurePlacer.h | 4 ++ lib/rmg/WaterAdopter.cpp | 4 ++ lib/rmg/WaterAdopter.h | 4 ++ lib/rmg/WaterProxy.cpp | 4 ++ lib/rmg/WaterProxy.h | 4 ++ lib/rmg/WaterRoutes.cpp | 4 ++ lib/rmg/WaterRoutes.h | 4 ++ lib/rmg/Zone.cpp | 4 ++ lib/rmg/Zone.h | 4 ++ lib/rmg/float3.h | 4 ++ lib/serializer/BinaryDeserializer.cpp | 4 ++ lib/serializer/BinaryDeserializer.h | 4 ++ lib/serializer/BinarySerializer.cpp | 4 ++ lib/serializer/BinarySerializer.h | 4 ++ lib/serializer/CLoadIntegrityValidator.cpp | 4 ++ lib/serializer/CLoadIntegrityValidator.h | 4 ++ lib/serializer/CMemorySerializer.cpp | 4 ++ lib/serializer/CMemorySerializer.h | 4 ++ lib/serializer/CSerializer.cpp | 4 ++ lib/serializer/CSerializer.h | 4 ++ lib/serializer/CTypeList.cpp | 4 ++ lib/serializer/CTypeList.h | 4 ++ lib/serializer/Cast.h | 4 ++ lib/serializer/Connection.cpp | 4 ++ lib/serializer/Connection.h | 8 ++- lib/serializer/JsonDeserializer.cpp | 4 ++ lib/serializer/JsonDeserializer.h | 4 ++ lib/serializer/JsonSerializeFormat.cpp | 4 ++ lib/serializer/JsonSerializeFormat.h | 4 ++ lib/serializer/JsonSerializer.cpp | 4 ++ lib/serializer/JsonSerializer.h | 4 ++ lib/serializer/JsonTreeSerializer.h | 4 ++ lib/serializer/JsonUpdater.cpp | 4 ++ lib/serializer/JsonUpdater.h | 4 ++ lib/spells/AbilityCaster.cpp | 4 ++ lib/spells/AbilityCaster.h | 4 ++ lib/spells/AdventureSpellMechanics.cpp | 4 ++ lib/spells/AdventureSpellMechanics.h | 4 ++ lib/spells/BattleSpellMechanics.cpp | 4 ++ lib/spells/BattleSpellMechanics.h | 4 ++ lib/spells/BonusCaster.cpp | 4 ++ lib/spells/BonusCaster.h | 4 ++ lib/spells/CSpellHandler.cpp | 6 +- lib/spells/CSpellHandler.h | 4 ++ lib/spells/ISpellMechanics.cpp | 4 ++ lib/spells/ISpellMechanics.h | 4 ++ lib/spells/Problem.cpp | 4 ++ lib/spells/Problem.h | 4 ++ lib/spells/ProxyCaster.cpp | 4 ++ lib/spells/ProxyCaster.h | 4 ++ lib/spells/TargetCondition.cpp | 4 ++ lib/spells/TargetCondition.h | 4 ++ lib/spells/ViewSpellInt.cpp | 4 ++ lib/spells/ViewSpellInt.h | 4 ++ lib/spells/effects/Catapult.cpp | 4 ++ lib/spells/effects/Catapult.h | 4 ++ lib/spells/effects/Clone.cpp | 4 ++ lib/spells/effects/Clone.h | 4 ++ lib/spells/effects/Damage.cpp | 4 ++ lib/spells/effects/Damage.h | 4 ++ lib/spells/effects/Dispel.cpp | 4 ++ lib/spells/effects/Dispel.h | 4 ++ lib/spells/effects/Effect.cpp | 4 ++ lib/spells/effects/Effect.h | 8 ++- lib/spells/effects/Effects.cpp | 4 ++ lib/spells/effects/Effects.h | 4 ++ lib/spells/effects/EffectsFwd.h | 4 ++ lib/spells/effects/Heal.cpp | 4 ++ lib/spells/effects/Heal.h | 4 ++ lib/spells/effects/LocationEffect.cpp | 4 ++ lib/spells/effects/LocationEffect.h | 4 ++ lib/spells/effects/Obstacle.cpp | 4 ++ lib/spells/effects/Obstacle.h | 4 ++ lib/spells/effects/Registry.cpp | 4 ++ lib/spells/effects/Registry.h | 4 ++ lib/spells/effects/RemoveObstacle.cpp | 4 ++ lib/spells/effects/RemoveObstacle.h | 4 ++ lib/spells/effects/Sacrifice.cpp | 4 ++ lib/spells/effects/Sacrifice.h | 4 ++ lib/spells/effects/Summon.cpp | 4 ++ lib/spells/effects/Summon.h | 4 ++ lib/spells/effects/Teleport.cpp | 4 ++ lib/spells/effects/Teleport.h | 4 ++ lib/spells/effects/Timed.cpp | 4 ++ lib/spells/effects/Timed.h | 4 ++ lib/spells/effects/UnitEffect.cpp | 4 ++ lib/spells/effects/UnitEffect.h | 4 ++ lib/vcmi_endian.h | 4 ++ lib/vstd/StringUtils.cpp | 4 ++ server/CGameHandler.cpp | 2 + server/CGameHandler.h | 9 ++- server/CQuery.h | 5 ++ server/CVCMIServer.h | 7 ++- server/StdInc.h | 1 + 467 files changed, 2117 insertions(+), 211 deletions(-) diff --git a/AI/BattleAI/BattleAI.h b/AI/BattleAI/BattleAI.h index 47dc84c47..82cecacc8 100644 --- a/AI/BattleAI/BattleAI.h +++ b/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; /* diff --git a/AI/BattleAI/EnemyInfo.h b/AI/BattleAI/EnemyInfo.h index 874e9e2b6..e9cb803de 100644 --- a/AI/BattleAI/EnemyInfo.h +++ b/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: diff --git a/AI/BattleAI/PossibleSpellcast.h b/AI/BattleAI/PossibleSpellcast.h index 806832ad5..a4e0021c7 100644 --- a/AI/BattleAI/PossibleSpellcast.h +++ b/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: diff --git a/AI/BattleAI/StackWithBonuses.h b/AI/BattleAI/StackWithBonuses.h index eb8d57db5..75015503f 100644 --- a/AI/BattleAI/StackWithBonuses.h +++ b/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 { diff --git a/AI/BattleAI/StdInc.h b/AI/BattleAI/StdInc.h index 1e6eda607..ba1e8b9ee 100644 --- a/AI/BattleAI/StdInc.h +++ b/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 diff --git a/AI/Nullkiller/AIGateway.h b/AI/Nullkiller/AIGateway.h index f940853f1..29066be81 100644 --- a/AI/Nullkiller/AIGateway.h +++ b/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; diff --git a/AI/Nullkiller/Engine/FuzzyEngines.h b/AI/Nullkiller/Engine/FuzzyEngines.h index c0fbba89a..0e0c533da 100644 --- a/AI/Nullkiller/Engine/FuzzyEngines.h +++ b/AI/Nullkiller/Engine/FuzzyEngines.h @@ -11,8 +11,12 @@ #include #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: diff --git a/AI/Nullkiller/Engine/FuzzyHelper.h b/AI/Nullkiller/Engine/FuzzyHelper.h index f9bfcf23a..760b34279 100644 --- a/AI/Nullkiller/Engine/FuzzyHelper.h +++ b/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 diff --git a/AI/Nullkiller/Engine/PriorityEvaluator.h b/AI/Nullkiller/Engine/PriorityEvaluator.h index 6bcd09c32..6156c08c2 100644 --- a/AI/Nullkiller/Engine/PriorityEvaluator.h +++ b/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 { diff --git a/AI/Nullkiller/Pathfinding/Actors.cpp b/AI/Nullkiller/Pathfinding/Actors.cpp index e6806a0b2..d4905d462 100644 --- a/AI/Nullkiller/Pathfinding/Actors.cpp +++ b/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 @@ -180,6 +181,7 @@ namespace vstd return v; } } +VCMI_LIB_NAMESPACE_END ExchangeResult HeroActor::tryExchangeNoLock(const ChainActor * specialActor, const ChainActor * other) const { diff --git a/AI/Nullkiller/StdInc.h b/AI/Nullkiller/StdInc.h index 2e1a36a05..50855f6e5 100644 --- a/AI/Nullkiller/StdInc.h +++ b/AI/Nullkiller/StdInc.h @@ -1,3 +1,4 @@ #pragma once #include "../../Global.h" +VCMI_LIB_USING_NAMESPACE #include "../../CCallback.h" diff --git a/AI/StupidAI/StdInc.h b/AI/StupidAI/StdInc.h index 81a6cb308..02b2c08f3 100644 --- a/AI/StupidAI/StdInc.h +++ b/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. \ No newline at end of file +// Here you can add specific libraries and macros which are specific to this project. + +VCMI_LIB_USING_NAMESPACE diff --git a/AI/VCAI/FuzzyEngines.h b/AI/VCAI/FuzzyEngines.h index 95a58c482..f09920da7 100644 --- a/AI/VCAI/FuzzyEngines.h +++ b/AI/VCAI/FuzzyEngines.h @@ -11,8 +11,12 @@ #include #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: diff --git a/AI/VCAI/FuzzyHelper.h b/AI/VCAI/FuzzyHelper.h index 036374acb..6973df463 100644 --- a/AI/VCAI/FuzzyHelper.h +++ b/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: diff --git a/AI/VCAI/StdInc.h b/AI/VCAI/StdInc.h index 2bc4c254b..0c0f05a6b 100644 --- a/AI/VCAI/StdInc.h +++ b/AI/VCAI/StdInc.h @@ -1,2 +1,4 @@ #pragma once #include "../../Global.h" + +VCMI_LIB_USING_NAMESPACE diff --git a/AI/VCAI/VCAI.cpp b/AI/VCAI/VCAI.cpp index d24f171be..7f42b8d70 100644 --- a/AI/VCAI/VCAI.cpp +++ b/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 diff --git a/AI/VCAI/VCAI.h b/AI/VCAI/VCAI.h index f19fed2ba..acb6e5f5d 100644 --- a/AI/VCAI/VCAI.h +++ b/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 diff --git a/CCallback.h b/CCallback.h index 36d93898a..6986153f1 100644 --- a/CCallback.h +++ b/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: diff --git a/Global.h b/Global.h index 146897238..965c24d8f 100644 --- a/Global.h +++ b/Global.h @@ -264,11 +264,26 @@ template 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 +VCMI_LIB_NAMESPACE_BEGIN + void inline handleException() { try @@ -739,3 +754,5 @@ namespace std } } #endif // NO_STD_TOSTRING + +VCMI_LIB_NAMESPACE_END diff --git a/Version.cpp.in b/Version.cpp.in index 3198034f1..3efea1c74 100644 --- a/Version.cpp.in +++ b/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 diff --git a/Version.h b/Version.h index 93adced57..3d929696c 100644 --- a/Version.h +++ b/Version.h @@ -1,6 +1,10 @@ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + namespace GameConstants { extern const char GIT_SHA1[]; } + +VCMI_LIB_NAMESPACE_END diff --git a/client/CGameInfo.h b/client/CGameInfo.h index 442be449d..3e6a31dfa 100644 --- a/client/CGameInfo.h +++ b/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 diff --git a/client/CPlayerInterface.h b/client/CPlayerInterface.h index 9a5d5408b..f7907594c 100644 --- a/client/CPlayerInterface.h +++ b/client/CPlayerInterface.h @@ -19,30 +19,33 @@ #define sprintf_s snprintf #endif +VCMI_LIB_NAMESPACE_BEGIN + class Artifact; +struct TryMoveHero; +class CGHeroInstance; +class CStack; +class CCreature; +struct CGPath; +class CCreatureSet; +class CGObjectInstance; +struct UpgradeInfo; +template struct CondSh; +struct CPathsInfo; + +VCMI_LIB_NAMESPACE_END + 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 struct CondSh; 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 { diff --git a/client/CServerHandler.h b/client/CServerHandler.h index 03ac005ed..749e46cb7 100644 --- a/client/CServerHandler.h +++ b/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 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 diff --git a/client/Client.h b/client/Client.h index 38a2b4551..569277e93 100644 --- a/client/Client.h +++ b/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 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 class ThreadSafeVector { diff --git a/client/Graphics.h b/client/Graphics.h index c1461b064..faf0aaf95 100644 --- a/client/Graphics.h +++ b/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 diff --git a/client/SDLRWwrapper.h b/client/SDLRWwrapper.h index ab1152a32..ea2f099e9 100644 --- a/client/SDLRWwrapper.h +++ b/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 in); diff --git a/client/StdInc.h b/client/StdInc.h index b03f5812c..8e35b9a2d 100644 --- a/client/StdInc.h +++ b/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 diff --git a/client/battle/CBattleAnimations.h b/client/battle/CBattleAnimations.h index 93422e6d7..c71d78195 100644 --- a/client/battle/CBattleAnimations.h +++ b/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; diff --git a/client/battle/CBattleInterface.h b/client/battle/CBattleInterface.h index ed5eb1dc7..0fdd232fe 100644 --- a/client/battle/CBattleInterface.h +++ b/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 diff --git a/client/battle/CBattleInterfaceClasses.h b/client/battle/CBattleInterfaceClasses.h index 079014ba7..c0b657d27 100644 --- a/client/battle/CBattleInterfaceClasses.h +++ b/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; diff --git a/client/gui/CAnimation.h b/client/gui/CAnimation.h index 0b1fa9e10..cb885fa36 100644 --- a/client/gui/CAnimation.h +++ b/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; diff --git a/client/gui/CGuiHandler.h b/client/gui/CGuiHandler.h index 18be56380..7f6373dfb 100644 --- a/client/gui/CGuiHandler.h +++ b/client/gui/CGuiHandler.h @@ -13,6 +13,12 @@ #include "Geometries.h" #include "SDL_Extensions.h" +VCMI_LIB_NAMESPACE_BEGIN + +template 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 struct CondSh; // TODO: event handling need refactoring enum EUserEvent diff --git a/client/gui/Fonts.h b/client/gui/Fonts.h index f471e8967..a5aad2c46 100644 --- a/client/gui/Fonts.h +++ b/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; diff --git a/client/lobby/CBonusSelection.h b/client/lobby/CBonusSelection.h index 9c9c7d178..ecf322758 100644 --- a/client/lobby/CBonusSelection.h +++ b/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 buttonDifficultyLeft; std::shared_ptr buttonDifficultyRight; std::shared_ptr iconsMapSizes; -}; \ No newline at end of file +}; diff --git a/client/lobby/CSavingScreen.h b/client/lobby/CSavingScreen.h index 20c04141d..ac966a457 100644 --- a/client/lobby/CSavingScreen.h +++ b/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: diff --git a/client/lobby/CSelectionBase.h b/client/lobby/CSelectionBase.h index e157607fd..7d2671f6c 100644 --- a/client/lobby/CSelectionBase.h +++ b/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; diff --git a/client/lobby/RandomMapTab.h b/client/lobby/RandomMapTab.h index f9e9f42b0..f7e399a17 100644 --- a/client/lobby/RandomMapTab.h +++ b/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; diff --git a/client/mainmenu/CCampaignScreen.h b/client/mainmenu/CCampaignScreen.h index b0a1acb85..f40f78c8c 100644 --- a/client/mainmenu/CCampaignScreen.h +++ b/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 { diff --git a/client/mainmenu/CMainMenu.h b/client/mainmenu/CMainMenu.h index 6220230b3..4fdebb93d 100644 --- a/client/mainmenu/CMainMenu.h +++ b/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; diff --git a/client/mapHandler.h b/client/mapHandler.h index 4c440d8ce..6a0e5a7f9 100644 --- a/client/mapHandler.h +++ b/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 { diff --git a/client/widgets/AdventureMapClasses.h b/client/widgets/AdventureMapClasses.h index de9b98c8b..639732a9f 100644 --- a/client/widgets/AdventureMapClasses.h +++ b/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; diff --git a/client/widgets/Buttons.h b/client/widgets/Buttons.h index 9e8ac298b..d370b515e 100644 --- a/client/widgets/Buttons.h +++ b/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 diff --git a/client/widgets/CArtifactHolder.h b/client/widgets/CArtifactHolder.h index cdf92e69e..eff474737 100644 --- a/client/widgets/CArtifactHolder.h +++ b/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: diff --git a/client/widgets/CComponent.h b/client/widgets/CComponent.h index f46428b25..ba7ad3065 100644 --- a/client/widgets/CComponent.h +++ b/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; diff --git a/client/widgets/CGarrisonInt.h b/client/widgets/CGarrisonInt.h index c14502a97..3c7a7914e 100644 --- a/client/widgets/CGarrisonInt.h +++ b/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 diff --git a/client/widgets/MiscWidgets.h b/client/widgets/MiscWidgets.h index c5f1088d7..f97a41bbf 100644 --- a/client/widgets/MiscWidgets.h +++ b/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 diff --git a/client/windows/CAdvmapInterface.h b/client/windows/CAdvmapInterface.h index 6c851828d..eb38b3cd6 100644 --- a/client/windows/CAdvmapInterface.h +++ b/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; diff --git a/client/windows/CCastleInterface.h b/client/windows/CCastleInterface.h index 088bb63bf..915e7579d 100644 --- a/client/windows/CCastleInterface.h +++ b/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; diff --git a/client/windows/CCreatureWindow.h b/client/windows/CCreatureWindow.h index f19f32689..ef51b57b8 100644 --- a/client/windows/CCreatureWindow.h +++ b/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; diff --git a/client/windows/CHeroWindow.h b/client/windows/CHeroWindow.h index b973117e8..685741b23 100644 --- a/client/windows/CHeroWindow.h +++ b/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; diff --git a/client/windows/CQuestLog.cpp b/client/windows/CQuestLog.cpp index 85c1a2a5d..fd5763ec0 100644 --- a/client/windows/CQuestLog.cpp +++ b/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) diff --git a/client/windows/CQuestLog.h b/client/windows/CQuestLog.h index 47a2dfa59..228776617 100644 --- a/client/windows/CQuestLog.h +++ b/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; diff --git a/client/windows/CSpellWindow.h b/client/windows/CSpellWindow.h index e77a60267..b23891da1 100644 --- a/client/windows/CSpellWindow.h +++ b/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 diff --git a/client/windows/CTradeWindow.h b/client/windows/CTradeWindow.h index fd7049d69..a19a56a62 100644 --- a/client/windows/CTradeWindow.h +++ b/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; diff --git a/client/windows/GUIClasses.h b/client/windows/GUIClasses.h index dc6bc9980..98494cfb6 100644 --- a/client/windows/GUIClasses.h +++ b/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; diff --git a/client/windows/InfoWindows.h b/client/windows/InfoWindows.h index 95924308d..c05983bcc 100644 --- a/client/windows/InfoWindows.h +++ b/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; diff --git a/include/vcmi/Artifact.h b/include/vcmi/Artifact.h index 7ffd8431f..f9f7ad89e 100644 --- a/include/vcmi/Artifact.h +++ b/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 diff --git a/include/vcmi/ArtifactService.h b/include/vcmi/ArtifactService.h index 3dc8588b1..ecd8ebc99 100644 --- a/include/vcmi/ArtifactService.h +++ b/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 { public: }; + +VCMI_LIB_NAMESPACE_END diff --git a/include/vcmi/Creature.h b/include/vcmi/Creature.h index c3c5ba2a2..1ada50ce2 100644 --- a/include/vcmi/Creature.h +++ b/include/vcmi/Creature.h @@ -12,6 +12,8 @@ #include "Entity.h" +VCMI_LIB_NAMESPACE_BEGIN + class CreatureID; class DLL_LINKAGE Creature : public EntityWithBonuses @@ -43,3 +45,5 @@ public: virtual bool isDoubleWide() const = 0; }; + +VCMI_LIB_NAMESPACE_END diff --git a/include/vcmi/CreatureService.h b/include/vcmi/CreatureService.h index 2e3ad04e0..860a3a575 100644 --- a/include/vcmi/CreatureService.h +++ b/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 { public: }; + +VCMI_LIB_NAMESPACE_END diff --git a/include/vcmi/Entity.h b/include/vcmi/Entity.h index 877cb3372..77a70f5d1 100644 --- a/include/vcmi/Entity.h +++ b/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 public: virtual const IBonusBearer * accessBonuses() const = 0; }; + +VCMI_LIB_NAMESPACE_END diff --git a/include/vcmi/EntityService.h b/include/vcmi/EntityService.h index 1b818131e..96c90ca5d 100644 --- a/include/vcmi/EntityService.h +++ b/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 & cb) const = 0; }; + +VCMI_LIB_NAMESPACE_END diff --git a/include/vcmi/Environment.h b/include/vcmi/Environment.h index 0fa63aa89..8c456bca2 100644 --- a/include/vcmi/Environment.h +++ b/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 diff --git a/include/vcmi/Faction.h b/include/vcmi/Faction.h index 5fc52c2fb..de50f29b9 100644 --- a/include/vcmi/Faction.h +++ b/include/vcmi/Faction.h @@ -12,6 +12,8 @@ #include "Entity.h" +VCMI_LIB_NAMESPACE_BEGIN + class FactionID; class DLL_LINKAGE Faction : public EntityT @@ -19,3 +21,5 @@ class DLL_LINKAGE Faction : public EntityT public: virtual bool hasTown() const = 0; }; + +VCMI_LIB_NAMESPACE_END diff --git a/include/vcmi/FactionService.h b/include/vcmi/FactionService.h index 884d77868..94cf78122 100644 --- a/include/vcmi/FactionService.h +++ b/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 { public: }; + +VCMI_LIB_NAMESPACE_END diff --git a/include/vcmi/HeroClass.h b/include/vcmi/HeroClass.h index 713672003..5440910e0 100644 --- a/include/vcmi/HeroClass.h +++ b/include/vcmi/HeroClass.h @@ -12,6 +12,8 @@ #include "Entity.h" +VCMI_LIB_NAMESPACE_BEGIN + class HeroClassID; class DLL_LINKAGE HeroClass : public EntityT @@ -20,3 +22,5 @@ public: }; + +VCMI_LIB_NAMESPACE_END diff --git a/include/vcmi/HeroClassService.h b/include/vcmi/HeroClassService.h index 9fb85c00b..df872c08d 100644 --- a/include/vcmi/HeroClassService.h +++ b/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 @@ -20,3 +22,5 @@ public: }; + +VCMI_LIB_NAMESPACE_END diff --git a/include/vcmi/HeroTypeService.h b/include/vcmi/HeroTypeService.h index 81f4305bb..dca8a438f 100644 --- a/include/vcmi/HeroTypeService.h +++ b/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 { public: }; + +VCMI_LIB_NAMESPACE_END diff --git a/include/vcmi/Metatype.h b/include/vcmi/Metatype.h index e8101f4c8..0ed9b1464 100644 --- a/include/vcmi/Metatype.h +++ b/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 diff --git a/include/vcmi/Player.h b/include/vcmi/Player.h index ac79e94a1..d559d1e7b 100644 --- a/include/vcmi/Player.h +++ b/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 diff --git a/include/vcmi/ServerCallback.h b/include/vcmi/ServerCallback.h index af35b4ea5..d69257009 100644 --- a/include/vcmi/ServerCallback.h +++ b/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 diff --git a/include/vcmi/Services.h b/include/vcmi/Services.h index 1bc33a1dd..33535a1d4 100644 --- a/include/vcmi/Services.h +++ b/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 diff --git a/include/vcmi/Skill.h b/include/vcmi/Skill.h index 14b308486..363e67869 100644 --- a/include/vcmi/Skill.h +++ b/include/vcmi/Skill.h @@ -12,6 +12,8 @@ #include "Entity.h" +VCMI_LIB_NAMESPACE_BEGIN + class SecondarySkill; class DLL_LINKAGE Skill : public EntityT @@ -20,3 +22,5 @@ public: }; + +VCMI_LIB_NAMESPACE_END diff --git a/include/vcmi/SkillService.h b/include/vcmi/SkillService.h index 47a9bbce9..6e8618898 100644 --- a/include/vcmi/SkillService.h +++ b/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 { public: }; + +VCMI_LIB_NAMESPACE_END diff --git a/include/vcmi/events/ApplyDamage.h b/include/vcmi/events/ApplyDamage.h index c92e80aeb..5ea190e4f 100644 --- a/include/vcmi/events/ApplyDamage.h +++ b/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 diff --git a/include/vcmi/events/Event.h b/include/vcmi/events/Event.h index 3f92a30bc..a1b44ccc7 100644 --- a/include/vcmi/events/Event.h +++ b/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 diff --git a/include/vcmi/events/EventBus.h b/include/vcmi/events/EventBus.h index e77f53370..4e46be043 100644 --- a/include/vcmi/events/EventBus.h +++ b/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 diff --git a/include/vcmi/events/GameResumed.h b/include/vcmi/events/GameResumed.h index 33a8436f1..0bc7f99e7 100644 --- a/include/vcmi/events/GameResumed.h +++ b/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 diff --git a/include/vcmi/events/ObjectVisitEnded.h b/include/vcmi/events/ObjectVisitEnded.h index b8508e260..7789d5e3a 100644 --- a/include/vcmi/events/ObjectVisitEnded.h +++ b/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 diff --git a/include/vcmi/events/ObjectVisitStarted.h b/include/vcmi/events/ObjectVisitStarted.h index 8e8577ca0..747aaf02c 100644 --- a/include/vcmi/events/ObjectVisitStarted.h +++ b/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 diff --git a/include/vcmi/events/PlayerGotTurn.h b/include/vcmi/events/PlayerGotTurn.h index 4b6fa009b..a75380cca 100644 --- a/include/vcmi/events/PlayerGotTurn.h +++ b/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 diff --git a/include/vcmi/events/SubscriptionRegistry.h b/include/vcmi/events/SubscriptionRegistry.h index 01af2876f..0e273d79c 100644 --- a/include/vcmi/events/SubscriptionRegistry.h +++ b/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 diff --git a/include/vcmi/events/TurnStarted.h b/include/vcmi/events/TurnStarted.h index 1caccddf6..a5a600047 100644 --- a/include/vcmi/events/TurnStarted.h +++ b/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 diff --git a/include/vcmi/scripting/Service.h b/include/vcmi/scripting/Service.h index e94300598..c000ae052 100644 --- a/include/vcmi/scripting/Service.h +++ b/include/vcmi/scripting/Service.h @@ -13,6 +13,8 @@ #if SCRIPTING_ENABLED #include +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 diff --git a/include/vcmi/spells/Caster.h b/include/vcmi/spells/Caster.h index 5ed5ca475..123865a97 100644 --- a/include/vcmi/spells/Caster.h +++ b/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 diff --git a/include/vcmi/spells/Magic.h b/include/vcmi/spells/Magic.h index 65d7f5ef2..af69982f2 100644 --- a/include/vcmi/spells/Magic.h +++ b/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; @@ -67,3 +69,5 @@ public: }; } + +VCMI_LIB_NAMESPACE_END diff --git a/include/vcmi/spells/Service.h b/include/vcmi/spells/Service.h index badd9487a..98fb863a7 100644 --- a/include/vcmi/spells/Service.h +++ b/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 diff --git a/include/vcmi/spells/Spell.h b/include/vcmi/spells/Spell.h index e64fb11a4..302ae05f6 100644 --- a/include/vcmi/spells/Spell.h +++ b/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 diff --git a/include/vstd/CLoggerBase.h b/include/vstd/CLoggerBase.h index 0c5ad7f10..24df8a0a7 100644 --- a/include/vstd/CLoggerBase.h +++ b/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 diff --git a/include/vstd/ContainerUtils.h b/include/vstd/ContainerUtils.h index cb616a775..0e93a13e5 100644 --- a/include/vstd/ContainerUtils.h +++ b/include/vstd/ContainerUtils.h @@ -10,6 +10,8 @@ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + namespace vstd { template @@ -24,5 +26,4 @@ namespace vstd } } - - +VCMI_LIB_NAMESPACE_END diff --git a/include/vstd/RNG.h b/include/vstd/RNG.h index 5535b13e9..9a8653141 100644 --- a/include/vstd/RNG.h +++ b/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 diff --git a/include/vstd/StringUtils.h b/include/vstd/StringUtils.h index 9b90fdbe3..b6d3ac8e4 100644 --- a/include/vstd/StringUtils.h +++ b/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 splitStringToPair(std::string input, char separator); } + +VCMI_LIB_NAMESPACE_END diff --git a/launcher/updatedialog_moc.h b/launcher/updatedialog_moc.h index aab93ff89..93ec1f1ea 100644 --- a/launcher/updatedialog_moc.h +++ b/launcher/updatedialog_moc.h @@ -11,8 +11,12 @@ #include #include +VCMI_LIB_NAMESPACE_BEGIN + class JsonNode; +VCMI_LIB_NAMESPACE_END + namespace Ui { class UpdateDialog; } diff --git a/lib/BattleFieldHandler.cpp b/lib/BattleFieldHandler.cpp index 1155e1d3f..18fc7664c 100644 --- a/lib/BattleFieldHandler.cpp +++ b/lib/BattleFieldHandler.cpp @@ -12,6 +12,8 @@ #include #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; -} \ No newline at end of file +} + +VCMI_LIB_NAMESPACE_END diff --git a/lib/BattleFieldHandler.h b/lib/BattleFieldHandler.h index b9023f3d0..51822e0cc 100644 --- a/lib/BattleFieldHandler.h +++ b/lib/BattleFieldHandler.h @@ -17,6 +17,8 @@ #include "Terrain.h" #include "battle/BattleHex.h" +VCMI_LIB_NAMESPACE_BEGIN + class BattleFieldInfo : public EntityT { public: @@ -84,3 +86,5 @@ public: h & objects; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CArtHandler.cpp b/lib/CArtHandler.cpp index daeaa632c..4cf2d9d69 100644 --- a/lib/CArtHandler.cpp +++ b/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 diff --git a/lib/CArtHandler.h b/lib/CArtHandler.h index 2bf087101..9a0d55be0 100644 --- a/lib/CArtHandler.h +++ b/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 diff --git a/lib/CBonusTypeHandler.cpp b/lib/CBonusTypeHandler.cpp index bb31926e0..00342ec9f 100644 --- a/lib/CBonusTypeHandler.cpp +++ b/lib/CBonusTypeHandler.cpp @@ -20,7 +20,9 @@ #include "CCreatureHandler.h" #include "spells/CSpellHandler.h" -template class std::vector; +template class std::vector; + +VCMI_LIB_NAMESPACE_BEGIN ///MacroString @@ -326,3 +328,5 @@ void CBonusTypeHandler::loadItem(const JsonNode & source, CBonusType & dest) } dest.buildMacros(); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CBonusTypeHandler.h b/lib/CBonusTypeHandler.h index 0b64a0434..977efe051 100644 --- a/lib/CBonusTypeHandler.h +++ b/lib/CBonusTypeHandler.h @@ -14,6 +14,8 @@ #include "IHandlerBase.h" #include "HeroBonus.h" +VCMI_LIB_NAMESPACE_BEGIN + class JsonNode; @@ -94,6 +96,8 @@ private: std::vector bonusTypes; //index = BonusTypeID }; +VCMI_LIB_NAMESPACE_END + #ifndef INSTANTIATE_CBonusTypeHandler_HERE -extern template class std::vector; +extern template class std::vector; #endif diff --git a/lib/CBuildingHandler.cpp b/lib/CBuildingHandler.cpp index 5543d9805..ee48359da 100644 --- a/lib/CBuildingHandler.cpp +++ b/lib/CBuildingHandler.cpp @@ -10,6 +10,8 @@ #include "StdInc.h" #include "CBuildingHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + BuildingID CBuildingHandler::campToERMU( int camp, int townType, std::set builtBuildings ) { static const std::vector campToERMU = @@ -75,3 +77,5 @@ BuildingID CBuildingHandler::campToERMU( int camp, int townType, std::set builtBuildings); }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CConfigHandler.cpp b/lib/CConfigHandler.cpp index cc962b3cd..d2de0e086 100644 --- a/lib/CConfigHandler.cpp +++ b/lib/CConfigHandler.cpp @@ -15,6 +15,8 @@ #include "../lib/GameConstants.h" #include "../lib/VCMIDirs.h" +VCMI_LIB_NAMESPACE_BEGIN + using namespace config; SettingsStorage settings; @@ -302,3 +304,5 @@ void config::CConfigHandler::init() // That way method definitions can sit in the cpp file template struct SettingsStorage::NodeAccessor; template struct SettingsStorage::NodeAccessor; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CConfigHandler.h b/lib/CConfigHandler.h index dad7e66ba..7a579d39a 100644 --- a/lib/CConfigHandler.h +++ b/lib/CConfigHandler.h @@ -11,6 +11,8 @@ #include "../lib/JsonNode.h" +VCMI_LIB_NAMESPACE_BEGIN + class Settings; class SettingsListener; @@ -188,3 +190,5 @@ namespace config extern DLL_LINKAGE SettingsStorage settings; extern DLL_LINKAGE config::CConfigHandler conf; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CConsoleHandler.cpp b/lib/CConsoleHandler.cpp index b5489b984..52d85bc91 100644 --- a/lib/CConsoleHandler.cpp +++ b/lib/CConsoleHandler.cpp @@ -13,6 +13,8 @@ #include "CThreadHelper.h" +VCMI_LIB_NAMESPACE_BEGIN + boost::mutex CConsoleHandler::smx; DLL_LINKAGE CConsoleHandler * console = nullptr; @@ -285,3 +287,5 @@ void CConsoleHandler::start() { thread = new boost::thread(std::bind(&CConsoleHandler::run,console)); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CConsoleHandler.h b/lib/CConsoleHandler.h index c521acdd5..4ac139260 100644 --- a/lib/CConsoleHandler.h +++ b/lib/CConsoleHandler.h @@ -9,6 +9,8 @@ */ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + namespace EConsoleTextColor { /** The color enum is used for colored text console output. */ @@ -92,3 +94,5 @@ private: }; extern DLL_LINKAGE CConsoleHandler * console; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CCreatureHandler.cpp b/lib/CCreatureHandler.cpp index 709b40242..bc27abe42 100644 --- a/lib/CCreatureHandler.cpp +++ b/lib/CCreatureHandler.cpp @@ -22,6 +22,8 @@ #include "serializer/JsonUpdater.h" #include "mapObjects/CObjectClassesHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + int32_t CCreature::getIndex() const { return idNumber.toEnum(); @@ -1360,3 +1362,5 @@ void CCreatureHandler::deserializationFix() { buildBonusTreeForTiers(); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CCreatureHandler.h b/lib/CCreatureHandler.h index 66f652a59..4a3bbe6e4 100644 --- a/lib/CCreatureHandler.h +++ b/lib/CCreatureHandler.h @@ -21,6 +21,8 @@ #include "CRandomGenerator.h" #include "Terrain.h" +VCMI_LIB_NAMESPACE_BEGIN + class CLegacyConfigParser; class CCreatureHandler; class CCreature; @@ -303,3 +305,5 @@ public: BONUS_TREE_DESERIALIZATION_FIX } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CCreatureSet.cpp b/lib/CCreatureSet.cpp index 35e6a4a24..6753c7174 100644 --- a/lib/CCreatureSet.cpp +++ b/lib/CCreatureSet.cpp @@ -23,6 +23,8 @@ #include "serializer/JsonSerializeFormat.h" #include "NetPacksBase.h" +VCMI_LIB_NAMESPACE_BEGIN + bool CreatureSlotComparer::operator()(const TPairCreatureSlot & lhs, const TPairCreatureSlot & rhs) { @@ -1074,3 +1076,5 @@ bool CSimpleArmy::setCreature(SlotID slot, CreatureID cre, TQuantity count) army[slot] = std::make_pair(cre, count); return true; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CCreatureSet.h b/lib/CCreatureSet.h index f073f5671..484133c2b 100644 --- a/lib/CCreatureSet.h +++ b/lib/CCreatureSet.h @@ -13,6 +13,8 @@ #include "GameConstants.h" #include "CArtHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + class JsonNode; class CCreature; class CGHeroInstance; @@ -262,3 +264,5 @@ public: } void sweep(); }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CGameInfoCallback.cpp b/lib/CGameInfoCallback.cpp index 0d0a8d6b0..6ec0febe7 100644 --- a/lib/CGameInfoCallback.cpp +++ b/lib/CGameInfoCallback.cpp @@ -21,6 +21,8 @@ #include "mapping/CMap.h" #include "CPlayerState.h" +VCMI_LIB_NAMESPACE_BEGIN + //TODO make clean #define ERROR_VERBOSE_OR_NOT_RET_VAL_IF(cond, verbose, txt, retVal) do {if(cond){if(verbose)logGlobal->error("%s: %s",BOOST_CURRENT_FUNCTION, txt); return retVal;}} while(0) #define ERROR_RET_IF(cond, txt) do {if(cond){logGlobal->error("%s: %s", BOOST_CURRENT_FUNCTION, txt); return;}} while(0) @@ -999,3 +1001,5 @@ bool CGameInfoCallback::isTeleportEntrancePassable(const CGTeleport * obj, Playe { return obj && obj->isEntrance() && !isTeleportChannelImpassable(obj->channel, player); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CGameInfoCallback.h b/lib/CGameInfoCallback.h index 53aa5524f..70d3a45cf 100644 --- a/lib/CGameInfoCallback.h +++ b/lib/CGameInfoCallback.h @@ -12,6 +12,9 @@ #include "int3.h" #include "ResourceSet.h" // for Res::ERes #include "battle/CCallbackBase.h" + +VCMI_LIB_NAMESPACE_BEGIN + class Player; class Team; @@ -239,3 +242,5 @@ public: //virtual const PlayerSettings * getPlayerSettings(PlayerColor color) const; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CGameInterface.cpp b/lib/CGameInterface.cpp index 84b9e9745..5abf49072 100644 --- a/lib/CGameInterface.cpp +++ b/lib/CGameInterface.cpp @@ -29,6 +29,8 @@ #endif +VCMI_LIB_NAMESPACE_BEGIN + template std::shared_ptr createAny(const boost::filesystem::path & libpath, const std::string & methodName) { @@ -257,3 +259,5 @@ void CAdventureAI::loadGame(BinaryDeserializer & h, const int version) /*loading battleAI->init(env, cbc); } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CGameInterface.h b/lib/CGameInterface.h index c4ab18378..2228a86e3 100644 --- a/lib/CGameInterface.h +++ b/lib/CGameInterface.h @@ -17,12 +17,15 @@ #include "mapObjects/CObjectHandler.h" +class CBattleCallback; +class CCallback; + +VCMI_LIB_NAMESPACE_BEGIN + using boost::logic::tribool; class Environment; -class CCallback; -class CBattleCallback; class ICallback; class CGlobalAI; struct Component; @@ -159,3 +162,5 @@ public: virtual void saveGame(BinarySerializer & h, const int version) override; virtual void loadGame(BinaryDeserializer & h, const int version) override; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CGameState.cpp b/lib/CGameState.cpp index c81a760c6..e70643c5f 100644 --- a/lib/CGameState.cpp +++ b/lib/CGameState.cpp @@ -37,6 +37,8 @@ #include "serializer/CMemorySerializer.h" #include "VCMIDirs.h" +VCMI_LIB_NAMESPACE_BEGIN + boost::shared_mutex CGameState::mutex; template class CApplyOnGS; @@ -3106,3 +3108,5 @@ CRandomGenerator & CGameState::getRandomGenerator() { return rand; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CGameState.h b/lib/CGameState.h index 84e3077b3..862ac4c2c 100644 --- a/lib/CGameState.h +++ b/lib/CGameState.h @@ -22,8 +22,14 @@ #include "CGameStateFwd.h" #include "CPathfinder.h" +namespace boost +{ +class shared_mutex; +} + +VCMI_LIB_NAMESPACE_BEGIN + class CTown; -class CCallback; class IGameCallback; class CCreatureSet; class CQuest; @@ -36,7 +42,6 @@ class CGObjectInstance; class CCreature; class CMap; struct StartInfo; -class CMapHandler; struct SetObjectProperty; struct MetaString; struct CPack; @@ -47,7 +52,6 @@ class CCampaign; class CCampaignState; class IModableArt; class CGGarrison; -class CGameInfo; struct QuestInfo; class CQuest; class CCampaignScenario; @@ -55,12 +59,6 @@ struct EventCondition; class CScenarioTravel; class IMapService; -namespace boost -{ - class shared_mutex; -} - - template class CApplier; class CBaseForGSApply; @@ -305,3 +303,5 @@ private: friend class CMapHandler; friend class CGameHandler; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CGameStateFwd.h b/lib/CGameStateFwd.h index 63904fcb1..1f1b5c660 100644 --- a/lib/CGameStateFwd.h +++ b/lib/CGameStateFwd.h @@ -12,6 +12,8 @@ #include "CCreatureSet.h" #include "int3.h" +VCMI_LIB_NAMESPACE_BEGIN + class CQuest; class CGObjectInstance; class CHeroClass; @@ -206,3 +208,5 @@ struct DLL_LINKAGE QuestInfo //universal interface for human and AI h & tile; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CGeneralTextHandler.cpp b/lib/CGeneralTextHandler.cpp index aa19fdfb3..b8070c7e6 100644 --- a/lib/CGeneralTextHandler.cpp +++ b/lib/CGeneralTextHandler.cpp @@ -19,6 +19,8 @@ #include "VCMI_Lib.h" #include "Terrain.h" +VCMI_LIB_NAMESPACE_BEGIN + size_t Unicode::getCharacterSize(char firstByte) { // length of utf-8 character can be determined from 1st byte by counting number of highest bits set to 1: @@ -519,3 +521,5 @@ int32_t CGeneralTextHandler::pluralText(const int32_t textIndex, const int32_t c else return textIndex + 1; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CGeneralTextHandler.h b/lib/CGeneralTextHandler.h index 58feed9ce..b7bffd1f9 100644 --- a/lib/CGeneralTextHandler.h +++ b/lib/CGeneralTextHandler.h @@ -11,6 +11,8 @@ #include "JsonNode.h" +VCMI_LIB_NAMESPACE_BEGIN + /// Namespace that provides utilites for unicode support (UTF-8) namespace Unicode { @@ -149,3 +151,5 @@ public: CGeneralTextHandler(const CGeneralTextHandler&) = delete; CGeneralTextHandler operator=(const CGeneralTextHandler&) = delete; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CHeroHandler.cpp b/lib/CHeroHandler.cpp index 890189eeb..6ed393ae5 100644 --- a/lib/CHeroHandler.cpp +++ b/lib/CHeroHandler.cpp @@ -27,6 +27,8 @@ #include "mapObjects/CObjectClassesHandler.h" #include "BattleFieldHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + CHero::CHero() = default; CHero::~CHero() = default; @@ -991,3 +993,5 @@ std::vector CHeroHandler::getDefaultAllowed() const return allowedHeroes; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CHeroHandler.h b/lib/CHeroHandler.h index 87da89149..d24f3de15 100644 --- a/lib/CHeroHandler.h +++ b/lib/CHeroHandler.h @@ -20,8 +20,9 @@ #include "IHandlerBase.h" #include "Terrain.h" +VCMI_LIB_NAMESPACE_BEGIN + class CHeroClass; -class CGameInfo; class CGHeroInstance; struct BattleHex; class JsonNode; @@ -316,3 +317,5 @@ protected: const std::vector & getTypeNames() const override; CHero * loadFromJson(const std::string & scope, const JsonNode & node, const std::string & identifier, size_t index) override; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CModHandler.cpp b/lib/CModHandler.cpp index e8a72cb5b..36a36dadc 100644 --- a/lib/CModHandler.cpp +++ b/lib/CModHandler.cpp @@ -30,6 +30,8 @@ #include +VCMI_LIB_NAMESPACE_BEGIN + CIdentifierStorage::CIdentifierStorage(): state(LOADING) { @@ -1144,3 +1146,5 @@ std::string CModHandler::makeFullIdentifier(const std::string & scope, const std return actualName == "" ? actualScope+ ":" + type : actualScope + ":" + type + "." + actualName; } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CModHandler.h b/lib/CModHandler.h index 1605f59fd..01f7a092b 100644 --- a/lib/CModHandler.h +++ b/lib/CModHandler.h @@ -14,6 +14,8 @@ #include "VCMI_Lib.h" #include "JsonNode.h" +VCMI_LIB_NAMESPACE_BEGIN + class CModHandler; class CModIndentifier; class CModInfo; @@ -398,3 +400,5 @@ public: h & identifiers; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CPathfinder.cpp b/lib/CPathfinder.cpp index 6ae919db0..0961ee52a 100644 --- a/lib/CPathfinder.cpp +++ b/lib/CPathfinder.cpp @@ -20,6 +20,8 @@ #include "CPlayerState.h" #include "PathfinderUtil.h" +VCMI_LIB_NAMESPACE_BEGIN + bool canSeeObj(const CGObjectInstance * obj) { /// Pathfinder should ignore placed events @@ -1424,3 +1426,5 @@ bool PathNodeInfo::isNodeObjectVisitable() const return (node->layer == EPathfindingLayer::LAND || node->layer == EPathfindingLayer::SAIL) && (canSeeObj(nodeObject) || canSeeObj(nodeHero)); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CPathfinder.h b/lib/CPathfinder.h index c047701a4..a5ed9e764 100644 --- a/lib/CPathfinder.h +++ b/lib/CPathfinder.h @@ -17,6 +17,8 @@ #include +VCMI_LIB_NAMESPACE_BEGIN + class CGHeroInstance; class CGObjectInstance; @@ -610,3 +612,5 @@ public: int movementPointsAfterEmbark(int movement, int basicCost, bool disembark) const; bool passOneTurnLimitCheck(const PathNodeInfo & source) const; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CPlayerState.cpp b/lib/CPlayerState.cpp index 78ee6b68a..edcc8c0db 100644 --- a/lib/CPlayerState.cpp +++ b/lib/CPlayerState.cpp @@ -12,6 +12,8 @@ #include "CPlayerState.h" #include "CGameStateFwd.h" +VCMI_LIB_NAMESPACE_BEGIN + PlayerState::PlayerState() : color(-1), human(false), enteredWinningCheatCode(false), enteredLosingCheatCode(false), status(EPlayerStatus::INGAME) @@ -67,3 +69,5 @@ int PlayerState::getResourceAmount(int type) const { return vstd::atOrDefault(resources, static_cast(type), 0); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CPlayerState.h b/lib/CPlayerState.h index 1caafa314..4d042f434 100644 --- a/lib/CPlayerState.h +++ b/lib/CPlayerState.h @@ -15,6 +15,8 @@ #include "HeroBonus.h" #include "ResourceSet.h" +VCMI_LIB_NAMESPACE_BEGIN + class CGHeroInstance; class CGTownInstance; class CGDwelling; @@ -95,3 +97,5 @@ public: } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CRandomGenerator.cpp b/lib/CRandomGenerator.cpp index c05b126b3..f55e97030 100644 --- a/lib/CRandomGenerator.cpp +++ b/lib/CRandomGenerator.cpp @@ -11,6 +11,8 @@ #include "StdInc.h" #include "CRandomGenerator.h" +VCMI_LIB_NAMESPACE_BEGIN + boost::thread_specific_ptr CRandomGenerator::defaultRand; CRandomGenerator::CRandomGenerator() @@ -88,3 +90,5 @@ TGenerator & CRandomGenerator::getStdGenerator() { return rand; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CRandomGenerator.h b/lib/CRandomGenerator.h index 0d052b32b..0b14c65ee 100644 --- a/lib/CRandomGenerator.h +++ b/lib/CRandomGenerator.h @@ -12,6 +12,8 @@ #include +VCMI_LIB_NAMESPACE_BEGIN + typedef std::mt19937 TGenerator; typedef std::uniform_int_distribution TIntDist; typedef std::uniform_int_distribution TInt64Dist; @@ -98,3 +100,5 @@ public: } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CScriptingModule.cpp b/lib/CScriptingModule.cpp index c6da26f01..f54ea063d 100644 --- a/lib/CScriptingModule.cpp +++ b/lib/CScriptingModule.cpp @@ -12,6 +12,8 @@ #include "CScriptingModule.h" #if SCRIPTING_ENABLED +VCMI_LIB_NAMESPACE_BEGIN + namespace scripting { @@ -31,4 +33,6 @@ Module::Module() Module::~Module() = default; } + +VCMI_LIB_NAMESPACE_END #endif diff --git a/lib/CScriptingModule.h b/lib/CScriptingModule.h index 77b59249f..9197d4951 100644 --- a/lib/CScriptingModule.h +++ b/lib/CScriptingModule.h @@ -12,6 +12,8 @@ #if SCRIPTING_ENABLED #include +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { namespace effects @@ -46,4 +48,6 @@ public: }; } + +VCMI_LIB_NAMESPACE_END #endif diff --git a/lib/CSkillHandler.cpp b/lib/CSkillHandler.cpp index feea6b009..74da3179c 100644 --- a/lib/CSkillHandler.cpp +++ b/lib/CSkillHandler.cpp @@ -22,6 +22,8 @@ #include "CModHandler.h" #include "StringConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + ///CSkill CSkill::LevelInfo::LevelInfo() { @@ -281,3 +283,5 @@ std::string CSkillHandler::encodeSkillWithType(const si32 index) { return CModHandler::makeFullIdentifier("", "skill", encodeSkill(index)); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CSkillHandler.h b/lib/CSkillHandler.h index 1f93b4678..2d06c3f3c 100644 --- a/lib/CSkillHandler.h +++ b/lib/CSkillHandler.h @@ -16,6 +16,8 @@ #include "GameConstants.h" #include "IHandlerBase.h" +VCMI_LIB_NAMESPACE_BEGIN + class JsonSerializeFormat; class DLL_LINKAGE CSkill : public Skill @@ -114,3 +116,5 @@ protected: const std::vector & getTypeNames() const override; CSkill * loadFromJson(const std::string & scope, const JsonNode & json, const std::string & identifier, size_t index) override; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CSoundBase.h b/lib/CSoundBase.h index 94ca7349c..d8b421494 100644 --- a/lib/CSoundBase.h +++ b/lib/CSoundBase.h @@ -9,6 +9,8 @@ */ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + // Use some magic to keep the list of files and their code name in sync. #define VCMI_SOUND_LIST \ @@ -1060,3 +1062,5 @@ public: #undef VCMI_SOUND_FILE #undef VCMI_SOUND_NAME }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CStack.cpp b/lib/CStack.cpp index 64c5e98f8..df76d3067 100644 --- a/lib/CStack.cpp +++ b/lib/CStack.cpp @@ -19,6 +19,8 @@ #include "spells/CSpellHandler.h" #include "NetPacks.h" +VCMI_LIB_NAMESPACE_BEGIN + ///CStack CStack::CStack(const CStackInstance * Base, PlayerColor O, int I, ui8 Side, SlotID S) @@ -410,3 +412,5 @@ void CStack::spendMana(ServerCallback * server, const int spellCost) const ssp.absolute = false; server->apply(&ssp); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CStack.h b/lib/CStack.h index f969efab3..645e4000e 100644 --- a/lib/CStack.h +++ b/lib/CStack.h @@ -18,6 +18,8 @@ #include "battle/CUnitState.h" +VCMI_LIB_NAMESPACE_BEGIN + struct BattleStackAttacked; class BattleInfo; @@ -139,3 +141,5 @@ public: private: const BattleInfo * battle; //do not serialize }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CStopWatch.h b/lib/CStopWatch.h index b2821130c..46e3cb65c 100644 --- a/lib/CStopWatch.h +++ b/lib/CStopWatch.h @@ -19,6 +19,8 @@ #define TO_MS_DIVISOR (CLOCKS_PER_SEC / 1000) #endif +VCMI_LIB_NAMESPACE_BEGIN + class CStopWatch { si64 start, last, mem; @@ -62,3 +64,5 @@ private: #endif } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CThreadHelper.cpp b/lib/CThreadHelper.cpp index d388807e6..0394d60d5 100644 --- a/lib/CThreadHelper.cpp +++ b/lib/CThreadHelper.cpp @@ -16,6 +16,8 @@ #include #endif +VCMI_LIB_NAMESPACE_BEGIN + CThreadHelper::CThreadHelper(std::vector > *Tasks, int Threads) { currentTask = 0; amount = (int)Tasks->size(); @@ -88,3 +90,5 @@ void setThreadName(const std::string &name) pthread_setname_np(name.c_str()); #endif } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CThreadHelper.h b/lib/CThreadHelper.h index 78205de22..a4eaf8f8b 100644 --- a/lib/CThreadHelper.h +++ b/lib/CThreadHelper.h @@ -9,6 +9,8 @@ */ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + ///DEPRECATED /// Can assign CPU work to other threads/cores @@ -81,3 +83,5 @@ private: void DLL_LINKAGE setThreadName(const std::string &name); + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CTownHandler.cpp b/lib/CTownHandler.cpp index bb5085f2b..393943d2d 100644 --- a/lib/CTownHandler.cpp +++ b/lib/CTownHandler.cpp @@ -24,6 +24,8 @@ #include "mapObjects/CObjectHandler.h" #include "HeroBonus.h" +VCMI_LIB_NAMESPACE_BEGIN + const int NAMES_PER_TOWN=16; // number of town names per faction in H3 files. Json can define any number const Terrain CTownHandler::defaultGoodTerrain{"grass"}; @@ -1179,3 +1181,5 @@ const std::vector & CTownHandler::getTypeNames() const return typeNames; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CTownHandler.h b/lib/CTownHandler.h index 7728d2992..47727abf0 100644 --- a/lib/CTownHandler.h +++ b/lib/CTownHandler.h @@ -22,6 +22,8 @@ #include "HeroBonus.h" #include "Terrain.h" +VCMI_LIB_NAMESPACE_BEGIN + class CLegacyConfigParser; class JsonNode; class CTown; @@ -430,3 +432,5 @@ protected: const std::vector & getTypeNames() const override; CFaction * loadFromJson(const std::string & scope, const JsonNode & data, const std::string & identifier, size_t index) override; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/CondSh.h b/lib/CondSh.h index 829af99a7..165e2a0c1 100644 --- a/lib/CondSh.h +++ b/lib/CondSh.h @@ -9,6 +9,8 @@ */ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + /// Used for multithreading, wraps boost functions template struct CondSh { @@ -63,3 +65,5 @@ template struct CondSh cond.wait(un); } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/ConstTransitivePtr.h b/lib/ConstTransitivePtr.h index 5aaaef5df..3fccbc554 100644 --- a/lib/ConstTransitivePtr.h +++ b/lib/ConstTransitivePtr.h @@ -11,6 +11,8 @@ class CGameHandler; +VCMI_LIB_NAMESPACE_BEGIN + template class ConstTransitivePtr { @@ -75,5 +77,7 @@ public: h & ptr; } - friend class CGameHandler; + friend class ::CGameHandler; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/FunctionList.h b/lib/FunctionList.h index eca94edfc..3c3ef4afe 100644 --- a/lib/FunctionList.h +++ b/lib/FunctionList.h @@ -9,6 +9,8 @@ */ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + /// List of functions that share the same signature - can be used to call all of them easily template class CFunctionList @@ -61,3 +63,5 @@ public: } } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/GameConstants.cpp b/lib/GameConstants.cpp index 7f6155316..a8d729d04 100644 --- a/lib/GameConstants.cpp +++ b/lib/GameConstants.cpp @@ -37,6 +37,8 @@ #include "BattleFieldHandler.h" #include "ObstacleHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + const SlotID SlotID::COMMANDER_SLOT_PLACEHOLDER = SlotID(-2); const SlotID SlotID::SUMMONED_SLOT_PLACEHOLDER = SlotID(-3); const SlotID SlotID::WAR_MACHINES_SLOT = SlotID(-4); @@ -322,3 +324,5 @@ Obstacle Obstacle::fromString(std::string identifier) else return Obstacle(-1); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/GameConstants.h b/lib/GameConstants.h index 54d098e12..642089dba 100644 --- a/lib/GameConstants.h +++ b/lib/GameConstants.h @@ -11,6 +11,8 @@ #include "ConstTransitivePtr.h" +VCMI_LIB_NAMESPACE_BEGIN + class Artifact; class ArtifactService; class Creature; @@ -1194,3 +1196,5 @@ typedef int TRmgTemplateZoneId; #undef ID_LIKE_OPERATORS_INTERNAL #undef INSTID_LIKE_CLASS_COMMON #undef OP_DECL_INT + +VCMI_LIB_NAMESPACE_END diff --git a/lib/HeroBonus.cpp b/lib/HeroBonus.cpp index 081d874f7..2fcdabeb7 100644 --- a/lib/HeroBonus.cpp +++ b/lib/HeroBonus.cpp @@ -25,6 +25,8 @@ #include "StringConstants.h" #include "battle/BattleInfo.h" +VCMI_LIB_NAMESPACE_BEGIN + #define FOREACH_PARENT(pname) TNodes lparents; getParents(lparents); for(CBonusSystemNode *pname : lparents) #define FOREACH_RED_CHILD(pname) TNodes lchildren; getRedChildren(lchildren); for(CBonusSystemNode *pname : lchildren) @@ -2559,3 +2561,5 @@ std::shared_ptr OwnerUpdater::createUpdatedBonus(const std::shared_ptrlimiter = std::make_shared(owner); return updated; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/HeroBonus.h b/lib/HeroBonus.h index 61941c27a..5afb1c92f 100644 --- a/lib/HeroBonus.h +++ b/lib/HeroBonus.h @@ -13,6 +13,8 @@ #include "JsonNode.h" #include "Terrain.h" +VCMI_LIB_NAMESPACE_BEGIN + class CCreature; struct Bonus; class IBonusBearer; @@ -1290,3 +1292,5 @@ public: virtual std::string toString() const override; virtual JsonNode toJsonNode() const override; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/IBonusTypeHandler.h b/lib/IBonusTypeHandler.h index 9563f4c87..f7edceb35 100644 --- a/lib/IBonusTypeHandler.h +++ b/lib/IBonusTypeHandler.h @@ -9,6 +9,8 @@ */ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + class IBonusBearer; struct Bonus; @@ -22,3 +24,5 @@ public: virtual std::string bonusToString(const std::shared_ptr & bonus, const IBonusBearer * bearer, bool description) const = 0; virtual std::string bonusToGraphics(const std::shared_ptr & bonus) const = 0; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/IGameCallback.cpp b/lib/IGameCallback.cpp index cf1d235f3..877eb0465 100644 --- a/lib/IGameCallback.cpp +++ b/lib/IGameCallback.cpp @@ -35,6 +35,8 @@ #include "serializer/Connection.h" +VCMI_LIB_NAMESPACE_BEGIN + void CPrivilegedInfoCallback::getFreeTiles(std::vector & tiles) const { std::vector floors; @@ -248,3 +250,5 @@ bool IGameCallback::isVisitCoveredByAnotherQuery(const CGObjectInstance *obj, co logGlobal->error("isVisitCoveredByAnotherQuery call on client side"); return false; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/IGameCallback.h b/lib/IGameCallback.h index 0f4ad0940..4850fdce1 100644 --- a/lib/IGameCallback.h +++ b/lib/IGameCallback.h @@ -14,6 +14,8 @@ #include "CGameInfoCallback.h" // for CGameInfoCallback #include "CRandomGenerator.h" +VCMI_LIB_NAMESPACE_BEGIN + struct SetMovePoints; struct GiveBonus; struct BlockingDialog; @@ -145,3 +147,5 @@ public: friend struct CPackForServer; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/IGameEventsReceiver.h b/lib/IGameEventsReceiver.h index 53cda9427..632489c76 100644 --- a/lib/IGameEventsReceiver.h +++ b/lib/IGameEventsReceiver.h @@ -14,6 +14,10 @@ #include "GameConstants.h" #include "int3.h" +class CCallback; + +VCMI_LIB_NAMESPACE_BEGIN + class CGTownInstance; class CCreature; class CArmedInstance; @@ -21,7 +25,6 @@ struct StackLocation; struct TryMoveHero; struct ArtifactLocation; class CGHeroInstance; -class CCallback; class IShipyard; class CGDwelling; struct Component; @@ -42,7 +45,6 @@ class CCreatureSet; struct BattleAttack; struct SetStackEffect; struct BattleTriggerEffect; -class CComponent; struct CObstacleInstance; struct CPackForServer; class EVictoryLossCheckResult; @@ -133,3 +135,5 @@ public: //TODO shouldn't be moved down the tree? virtual void heroExchangeStarted(ObjectInstanceID hero1, ObjectInstanceID hero2, QueryID queryID){}; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/IHandlerBase.cpp b/lib/IHandlerBase.cpp index e4bfe44e7..fe35ed850 100644 --- a/lib/IHandlerBase.cpp +++ b/lib/IHandlerBase.cpp @@ -12,6 +12,8 @@ #include "IHandlerBase.h" #include "CModHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + void IHandlerBase::registerObject(std::string scope, std::string type_name, std::string name, si32 index) { @@ -22,3 +24,5 @@ std::string IHandlerBase::normalizeIdentifier(const std::string& scope, const st { return VLC->modh->normalizeIdentifier(scope, remoteScope, identifier); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/IHandlerBase.h b/lib/IHandlerBase.h index 18566f294..04aa4d0e7 100644 --- a/lib/IHandlerBase.h +++ b/lib/IHandlerBase.h @@ -12,6 +12,8 @@ #include "../lib/ConstTransitivePtr.h" #include "VCMI_Lib.h" +VCMI_LIB_NAMESPACE_BEGIN + class JsonNode; class Entity; @@ -163,3 +165,5 @@ protected: public: //todo: make private std::vector> objects; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/Interprocess.h b/lib/Interprocess.h index 8137e77b7..cafe9666f 100644 --- a/lib/Interprocess.h +++ b/lib/Interprocess.h @@ -15,6 +15,8 @@ #include #include +VCMI_LIB_NAMESPACE_BEGIN + struct ServerReady { bool ready; @@ -78,3 +80,5 @@ struct SharedMemory boost::interprocess::shared_memory_object::remove(name.c_str()); } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/JsonDetail.cpp b/lib/JsonDetail.cpp index fde2a7523..3d0a6c47e 100644 --- a/lib/JsonDetail.cpp +++ b/lib/JsonDetail.cpp @@ -18,6 +18,8 @@ #include "filesystem/Filesystem.h" #include "ScopeGuard.h" +VCMI_LIB_NAMESPACE_BEGIN + static const JsonNode nullNode; template @@ -1242,3 +1244,5 @@ namespace Validation } } // Validation namespace + +VCMI_LIB_NAMESPACE_END diff --git a/lib/JsonDetail.h b/lib/JsonDetail.h index 89d19d5a6..23d3d8fb2 100644 --- a/lib/JsonDetail.h +++ b/lib/JsonDetail.h @@ -11,6 +11,8 @@ #include "JsonNode.h" +VCMI_LIB_NAMESPACE_BEGIN + class JsonWriter { //prefix for each line (tabulation) @@ -127,3 +129,5 @@ namespace Validation std::string check(std::string schemaName, const JsonNode & data, ValidationData & validator); std::string check(const JsonNode & schema, const JsonNode & data, ValidationData & validator); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/JsonNode.cpp b/lib/JsonNode.cpp index f80e8cfba..0014ae3a5 100644 --- a/lib/JsonNode.cpp +++ b/lib/JsonNode.cpp @@ -21,6 +21,40 @@ #include "JsonDetail.h" #include "StringConstants.h" +namespace +{ +// to avoid duplicating const and non-const code +template +Node & resolvePointer(Node & in, const std::string & pointer) +{ + if (pointer.empty()) + return in; + assert(pointer[0] == '/'); + + size_t splitPos = pointer.find('/', 1); + + std::string entry = pointer.substr(1, splitPos -1); + std::string remainer = splitPos == std::string::npos ? "" : pointer.substr(splitPos); + + if (in.getType() == VCMI_LIB_WRAP_NAMESPACE(JsonNode)::JsonType::DATA_VECTOR) + { + if (entry.find_first_not_of("0123456789") != std::string::npos) // non-numbers in string + throw std::runtime_error("Invalid Json pointer"); + + if (entry.size() > 1 && entry[0] == '0') // leading zeros are not allowed + throw std::runtime_error("Invalid Json pointer"); + + size_t index = boost::lexical_cast(entry); + + if (in.Vector().size() > index) + return in.Vector()[index].resolvePointer(remainer); + } + return in[entry].resolvePointer(remainer); +} +} + +VCMI_LIB_NAMESPACE_BEGIN + using namespace JsonDetail; class LibClasses; @@ -406,35 +440,6 @@ const JsonNode & JsonNode::operator[](std::string child) const return nullNode; } -// to avoid duplicating const and non-const code -template -Node & resolvePointer(Node & in, const std::string & pointer) -{ - if (pointer.empty()) - return in; - assert(pointer[0] == '/'); - - size_t splitPos = pointer.find('/', 1); - - std::string entry = pointer.substr(1, splitPos -1); - std::string remainer = splitPos == std::string::npos ? "" : pointer.substr(splitPos); - - if (in.getType() == JsonNode::JsonType::DATA_VECTOR) - { - if (entry.find_first_not_of("0123456789") != std::string::npos) // non-numbers in string - throw std::runtime_error("Invalid Json pointer"); - - if (entry.size() > 1 && entry[0] == '0') // leading zeros are not allowed - throw std::runtime_error("Invalid Json pointer"); - - size_t index = boost::lexical_cast(entry); - - if (in.Vector().size() > index) - return in.Vector()[index].resolvePointer(remainer); - } - return in[entry].resolvePointer(remainer); -} - const JsonNode & JsonNode::resolvePointer(const std::string &jsonPointer) const { return ::resolvePointer(*this, jsonPointer); @@ -1212,3 +1217,5 @@ DLL_LINKAGE JsonNode JsonUtils::intNode(si64 value) node.Integer() = value; return node; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/JsonNode.h b/lib/JsonNode.h index e29865f49..44a1ebdfc 100644 --- a/lib/JsonNode.h +++ b/lib/JsonNode.h @@ -10,6 +10,8 @@ #pragma once #include "GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + class JsonNode; typedef std::map JsonMap; typedef std::vector JsonVector; @@ -360,3 +362,5 @@ Type JsonNode::convertTo() const { return JsonDetail::JsonConverter::convert(*this); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/LogicalExpression.cpp b/lib/LogicalExpression.cpp index 42207afa8..e14891bf2 100644 --- a/lib/LogicalExpression.cpp +++ b/lib/LogicalExpression.cpp @@ -14,8 +14,12 @@ #include "VCMI_Lib.h" #include "CGeneralTextHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + std::string LogicalExpressionDetail::getTextForOperator(std::string operation) { //placed in cpp mostly to avoid unnecessary includes in header return VLC->generaltexth->localizedTexts["logicalExpressions"][operation].String(); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/LogicalExpression.h b/lib/LogicalExpression.h index d567eafa5..a1f2fb528 100644 --- a/lib/LogicalExpression.h +++ b/lib/LogicalExpression.h @@ -12,6 +12,8 @@ //FIXME: move some of code into .cpp to avoid this include? #include "JsonNode.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace LogicalExpressionDetail { /// class that defines required types for logical expressions @@ -625,3 +627,5 @@ public: h & data; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/NetPacks.h b/lib/NetPacks.h index 3016b2d19..e7ec6341f 100644 --- a/lib/NetPacks.h +++ b/lib/NetPacks.h @@ -23,8 +23,11 @@ #include "spells/ViewSpellInt.h" class CClient; -class CGameState; class CGameHandler; + +VCMI_LIB_NAMESPACE_BEGIN + +class CGameState; class CArtifact; class CGObjectInstance; class CArtifactInstance; @@ -2451,3 +2454,5 @@ struct CenterView : public CPackForClient h & focusTime; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/NetPacksBase.h b/lib/NetPacksBase.h index 868e50245..d14cf0eb4 100644 --- a/lib/NetPacksBase.h +++ b/lib/NetPacksBase.h @@ -9,9 +9,18 @@ */ #pragma once +#include + +#include "ConstTransitivePtr.h" +#include "GameConstants.h" +#include "JsonNode.h" + class CClient; -class CGameState; class CGameHandler; + +VCMI_LIB_NAMESPACE_BEGIN + +class CGameState; class CConnection; class CStackBasicDescriptor; class CGHeroInstance; @@ -21,12 +30,6 @@ class CArtifactSet; class CBonusSystemNode; struct ArtSlotInfo; -#include - -#include "ConstTransitivePtr.h" -#include "GameConstants.h" -#include "JsonNode.h" - struct DLL_LINKAGE CPack { std::shared_ptr c; // Pointer to connection that pack received from @@ -368,3 +371,5 @@ public: h & operation; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/NetPacksLib.cpp b/lib/NetPacksLib.cpp index 3fa981434..fe303a849 100644 --- a/lib/NetPacksLib.cpp +++ b/lib/NetPacksLib.cpp @@ -28,6 +28,8 @@ #include "StartInfo.h" #include "CPlayerState.h" +VCMI_LIB_NAMESPACE_BEGIN + DLL_LINKAGE void SetResources::applyGs(CGameState *gs) { @@ -1698,3 +1700,5 @@ DLL_LINKAGE void EntitiesChanged::applyGs(CGameState * gs) for(const auto & change : changes) gs->updateEntity(change.metatype, change.entityIndex, change.data); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/NetPacksLobby.h b/lib/NetPacksLobby.h index f635d3fa0..923cb84b8 100644 --- a/lib/NetPacksLobby.h +++ b/lib/NetPacksLobby.h @@ -13,14 +13,17 @@ #include "StartInfo.h" -class CCampaignState; class CLobbyScreen; class CServerHandler; +class CVCMIServer; + +VCMI_LIB_NAMESPACE_BEGIN + +class CCampaignState; class CMapInfo; struct StartInfo; class CMapGenOptions; struct ClientPlayer; -class CVCMIServer; struct CPackForLobby : public CPack { @@ -309,3 +312,5 @@ struct LobbyForceSetPlayer : public CLobbyPackToServer h & targetPlayerColor; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/ObstacleHandler.cpp b/lib/ObstacleHandler.cpp index a55fe0678..5e37d9a3d 100644 --- a/lib/ObstacleHandler.cpp +++ b/lib/ObstacleHandler.cpp @@ -11,6 +11,8 @@ #include "ObstacleHandler.h" #include "BattleFieldHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + int32_t ObstacleInfo::getIndex() const { return obstacle.getNum(); @@ -110,3 +112,5 @@ const std::vector & ObstacleHandler::getTypeNames() const static const std::vector types = { "obstacle" }; return types; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/ObstacleHandler.h b/lib/ObstacleHandler.h index 7075d140b..aa3e0be9c 100644 --- a/lib/ObstacleHandler.h +++ b/lib/ObstacleHandler.h @@ -16,6 +16,8 @@ #include "Terrain.h" #include "battle/BattleHex.h" +VCMI_LIB_NAMESPACE_BEGIN + class DLL_LINKAGE ObstacleInfo : public EntityT { public: @@ -92,3 +94,5 @@ public: h & objects; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/PathfinderUtil.h b/lib/PathfinderUtil.h index 0e750e9d4..558ee651d 100644 --- a/lib/PathfinderUtil.h +++ b/lib/PathfinderUtil.h @@ -12,6 +12,8 @@ #include "mapping/CMapDefines.h" #include "CGameState.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace PathfinderUtil { using FoW = std::shared_ptr>; @@ -74,3 +76,5 @@ namespace PathfinderUtil return CGPathNode::ACCESSIBLE; } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/ResourceSet.cpp b/lib/ResourceSet.cpp index 3d922c6f2..0a3470c5a 100644 --- a/lib/ResourceSet.cpp +++ b/lib/ResourceSet.cpp @@ -16,6 +16,8 @@ #include "VCMI_Lib.h" #include "mapObjects/CObjectHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + Res::ResourceSet::ResourceSet() { resize(GameConstants::RESOURCE_QUANTITY, 0); @@ -68,19 +70,19 @@ bool Res::ResourceSet::nonZero() const void Res::ResourceSet::amax(const TResourceCap &val) { for(auto & elem : *this) - ::vstd::amax(elem, val); + vstd::amax(elem, val); } void Res::ResourceSet::amin(const TResourceCap &val) { for(auto & elem : *this) - ::vstd::amin(elem, val); + vstd::amin(elem, val); } void Res::ResourceSet::positive() { for(auto & elem : *this) - ::vstd::amax(elem, 0); + vstd::amax(elem, 0); } bool Res::ResourceSet::canBeAfforded(const ResourceSet &res) const @@ -172,3 +174,5 @@ Res::ResourceSet::nziterator::nziterator(const ResourceSet &RS) if(!valid()) advance(); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/ResourceSet.h b/lib/ResourceSet.h index 7a6e58123..1ac047962 100644 --- a/lib/ResourceSet.h +++ b/lib/ResourceSet.h @@ -10,6 +10,8 @@ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + typedef si32 TResource; typedef si64 TResourceCap; //to avoid overflow when adding integers. Signed values are easier to control. @@ -167,3 +169,5 @@ namespace Res typedef Res::ResourceSet TResources; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/ScopeGuard.h b/lib/ScopeGuard.h index 6c57a0ca0..d72903711 100644 --- a/lib/ScopeGuard.h +++ b/lib/ScopeGuard.h @@ -10,6 +10,8 @@ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + namespace vstd { @@ -45,3 +47,5 @@ namespace vstd return ScopeGuard(std::forward(exitScope)); } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/ScriptHandler.cpp b/lib/ScriptHandler.cpp index 955ca2852..b64b0de2b 100644 --- a/lib/ScriptHandler.cpp +++ b/lib/ScriptHandler.cpp @@ -23,6 +23,8 @@ #include "serializer/JsonSerializer.h" #include "filesystem/Filesystem.h" +VCMI_LIB_NAMESPACE_BEGIN + static const std::vector IMPLEMENTS_MAP = { "ANYTHING", @@ -69,7 +71,7 @@ const std::string & ScriptImpl::getSource() const return sourceText; } -void ScriptImpl::performRegistration(::Services * services) const +void ScriptImpl::performRegistration(Services * services) const { switch(implements) { @@ -312,4 +314,6 @@ void ScriptHandler::saveState(JsonNode & state) } + +VCMI_LIB_NAMESPACE_END #endif diff --git a/lib/ScriptHandler.h b/lib/ScriptHandler.h index 53d91110c..a4eda8ab2 100644 --- a/lib/ScriptHandler.h +++ b/lib/ScriptHandler.h @@ -15,6 +15,8 @@ #include "IHandlerBase.h" #include "JsonNode.h" +VCMI_LIB_NAMESPACE_BEGIN + class JsonNode; class JsonSerializeFormat; class Services; @@ -61,7 +63,7 @@ public: const std::string & getName() const override; const std::string & getSource() const override; - void performRegistration(::Services * services) const; + void performRegistration(Services * services) const; private: const ScriptHandler * owner; @@ -85,7 +87,7 @@ private: ServerCallback * srv; }; -class DLL_LINKAGE ScriptHandler : public ::IHandlerBase, public Service +class DLL_LINKAGE ScriptHandler : public IHandlerBase, public Service { public: ScriptMap objects; @@ -132,4 +134,6 @@ private: }; } + +VCMI_LIB_NAMESPACE_END #endif diff --git a/lib/StartInfo.cpp b/lib/StartInfo.cpp index 97b703616..ba98f09c0 100644 --- a/lib/StartInfo.cpp +++ b/lib/StartInfo.cpp @@ -14,6 +14,8 @@ #include "rmg/CMapGenOptions.h" #include "mapping/CMapInfo.h" +VCMI_LIB_NAMESPACE_BEGIN + PlayerSettings::PlayerSettings() : bonus(RANDOM), castle(NONE), hero(RANDOM), heroPortrait(RANDOM), color(0), handicap(NO_HANDICAP), team(0), compOnly(false) { @@ -193,3 +195,5 @@ TeamID LobbyInfo::getPlayerTeamId(PlayerColor color) else return TeamID::NO_TEAM; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/StartInfo.h b/lib/StartInfo.h index 2f0fb3b71..35db7ca66 100644 --- a/lib/StartInfo.h +++ b/lib/StartInfo.h @@ -11,6 +11,8 @@ #include "GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + class CMapGenOptions; class CCampaignState; class CMapInfo; @@ -175,3 +177,8 @@ struct DLL_LINKAGE LobbyInfo : public LobbyState TeamID getPlayerTeamId(PlayerColor color); }; +class ExceptionMapMissing : public std::exception {}; +class ExceptionNoHuman : public std::exception {}; +class ExceptionNoTemplate : public std::exception {}; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/StringConstants.h b/lib/StringConstants.h index 721a070ae..08b0cbd9f 100644 --- a/lib/StringConstants.h +++ b/lib/StringConstants.h @@ -11,6 +11,8 @@ #include "GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + /// /// String ID which are pointless to move to config file - these types are mostly hardcoded /// @@ -114,3 +116,5 @@ namespace NMetaclass "object", "primarySkill", "secondarySkill", "spell", "resource" }; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/Terrain.cpp b/lib/Terrain.cpp index 7f89447d2..12f7f72fb 100644 --- a/lib/Terrain.cpp +++ b/lib/Terrain.cpp @@ -13,6 +13,8 @@ #include "VCMI_Lib.h" #include "CModHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + //regular expression to change id for string at config //("allowedTerrain"\s*:\s*\[.*)9(.*\],\n) //\1"rock"\2 @@ -251,3 +253,5 @@ bool Terrain::isTransitionRequired() const { return Terrain::Manager::getInfo(*this).transitionRequired; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/Terrain.h b/lib/Terrain.h index 95fa343b0..b71dc172e 100644 --- a/lib/Terrain.h +++ b/lib/Terrain.h @@ -14,6 +14,7 @@ #include "GameConstants.h" #include "JsonNode.h" +VCMI_LIB_NAMESPACE_BEGIN class DLL_LINKAGE Terrain { @@ -103,3 +104,5 @@ protected: }; DLL_LINKAGE std::ostream & operator<<(std::ostream & os, const Terrain terrainType); + +VCMI_LIB_NAMESPACE_END diff --git a/lib/UnlockGuard.h b/lib/UnlockGuard.h index f8a2835d1..51ec8541d 100644 --- a/lib/UnlockGuard.h +++ b/lib/UnlockGuard.h @@ -9,6 +9,8 @@ */ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + namespace vstd { namespace detail @@ -114,3 +116,5 @@ namespace vstd typedef unlock_guard > unlock_shared_guard; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/VCMIDirs.cpp b/lib/VCMIDirs.cpp index 7037bf72f..87b2abd50 100644 --- a/lib/VCMIDirs.cpp +++ b/lib/VCMIDirs.cpp @@ -11,6 +11,8 @@ #include "StdInc.h" #include "VCMIDirs.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace bfs = boost::filesystem; bfs::path IVCMIDirs::userLogsPath() const { return userCachePath(); } @@ -699,3 +701,5 @@ namespace VCMIDirs } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/VCMIDirs.h b/lib/VCMIDirs.h index deaa263ab..791f07483 100644 --- a/lib/VCMIDirs.h +++ b/lib/VCMIDirs.h @@ -9,6 +9,8 @@ */ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + class DLL_LINKAGE IVCMIDirs { public: @@ -64,3 +66,5 @@ namespace VCMIDirs { extern DLL_LINKAGE const IVCMIDirs & get(); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/VCMI_Lib.cpp b/lib/VCMI_Lib.cpp index d79a9003a..f1c862d7c 100644 --- a/lib/VCMI_Lib.cpp +++ b/lib/VCMI_Lib.cpp @@ -35,6 +35,8 @@ #include "BattleFieldHandler.h" #include "ObstacleHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + LibClasses * VLC = nullptr; DLL_LINKAGE void preinitDLL(CConsoleHandler * Console, bool onlyEssential) @@ -316,3 +318,5 @@ void LibClasses::setContent(std::shared_ptr content) { modh->content = content; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/VCMI_Lib.h b/lib/VCMI_Lib.h index 4b822751b..476819e36 100644 --- a/lib/VCMI_Lib.h +++ b/lib/VCMI_Lib.h @@ -11,6 +11,8 @@ #include +VCMI_LIB_NAMESPACE_BEGIN + class CConsoleHandler; class CArtHandler; class CHeroHandler; @@ -149,3 +151,5 @@ extern DLL_LINKAGE LibClasses * VLC; DLL_LINKAGE void preinitDLL(CConsoleHandler * Console, bool onlyEssential = false); DLL_LINKAGE void loadDLLClasses(bool onlyEssential = false); + +VCMI_LIB_NAMESPACE_END diff --git a/lib/abilities/Ability.h b/lib/abilities/Ability.h index 30f10fb67..14bf3d54e 100644 --- a/lib/abilities/Ability.h +++ b/lib/abilities/Ability.h @@ -7,6 +7,9 @@ * Full text of license available in license.txt file, in main folder * */ + +VCMI_LIB_NAMESPACE_BEGIN + namespace abilities { @@ -16,3 +19,5 @@ class DLL_LINKAGE Ability }; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/AccessibilityInfo.cpp b/lib/battle/AccessibilityInfo.cpp index 4ba58a802..2681dfeed 100644 --- a/lib/battle/AccessibilityInfo.cpp +++ b/lib/battle/AccessibilityInfo.cpp @@ -12,6 +12,8 @@ #include "Unit.h" #include "../GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + bool AccessibilityInfo::accessible(BattleHex tile, const battle::Unit * stack) const { return accessible(tile, stack->doubleWide(), stack->unitSide()); @@ -37,3 +39,5 @@ bool AccessibilityInfo::accessible(BattleHex tile, bool doubleWide, ui8 side) co return true; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/AccessibilityInfo.h b/lib/battle/AccessibilityInfo.h index 7386b794f..597b1473e 100644 --- a/lib/battle/AccessibilityInfo.h +++ b/lib/battle/AccessibilityInfo.h @@ -11,6 +11,8 @@ #include "BattleHex.h" #include "../GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace battle { class Unit; @@ -36,3 +38,5 @@ struct DLL_LINKAGE AccessibilityInfo : TAccessibilityArray bool accessible(BattleHex tile, const battle::Unit * stack) const; //checks for both tiles if stack is double wide bool accessible(BattleHex tile, bool doubleWide, ui8 side) const; //checks for both tiles if stack is double wide }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/BattleAction.cpp b/lib/battle/BattleAction.cpp index 36c53560b..9567ffbb1 100644 --- a/lib/battle/BattleAction.cpp +++ b/lib/battle/BattleAction.cpp @@ -13,6 +13,8 @@ #include "Unit.h" #include "CBattleInfoCallback.h" +VCMI_LIB_NAMESPACE_BEGIN + static const int32_t INVALID_UNIT_ID = -1000; BattleAction::BattleAction(): @@ -181,3 +183,5 @@ std::ostream & operator<<(std::ostream & os, const BattleAction & ba) os << ba.toString(); return os; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/BattleAction.h b/lib/battle/BattleAction.h index 228558ab5..ecce56ccb 100644 --- a/lib/battle/BattleAction.h +++ b/lib/battle/BattleAction.h @@ -11,6 +11,8 @@ #include "Destination.h" #include "../GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + class CBattleInfoCallback; namespace battle @@ -73,3 +75,5 @@ private: }; DLL_EXPORT std::ostream & operator<<(std::ostream & os, const BattleAction & ba); //todo: remove + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/BattleAttackInfo.cpp b/lib/battle/BattleAttackInfo.cpp index 7b42e23c8..1d38d699b 100644 --- a/lib/battle/BattleAttackInfo.cpp +++ b/lib/battle/BattleAttackInfo.cpp @@ -11,6 +11,8 @@ #include "BattleAttackInfo.h" #include "CUnitState.h" +VCMI_LIB_NAMESPACE_BEGIN + BattleAttackInfo::BattleAttackInfo(const battle::Unit * Attacker, const battle::Unit * Defender, bool Shooting) : attacker(Attacker), defender(Defender) @@ -38,3 +40,5 @@ BattleAttackInfo BattleAttackInfo::reverse() const return ret; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/BattleAttackInfo.h b/lib/battle/BattleAttackInfo.h index c121dc177..b24376a30 100644 --- a/lib/battle/BattleAttackInfo.h +++ b/lib/battle/BattleAttackInfo.h @@ -9,14 +9,16 @@ */ #pragma once +#include "BattleHex.h" + +VCMI_LIB_NAMESPACE_BEGIN + namespace battle { class Unit; class CUnitState; } -#include "BattleHex.h" - struct DLL_LINKAGE BattleAttackInfo { const battle::Unit * attacker; @@ -34,3 +36,5 @@ struct DLL_LINKAGE BattleAttackInfo BattleAttackInfo(const battle::Unit * Attacker, const battle::Unit * Defender, bool Shooting = false); BattleAttackInfo reverse() const; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/BattleHex.cpp b/lib/battle/BattleHex.cpp index db83f9c4f..7763fb335 100644 --- a/lib/battle/BattleHex.cpp +++ b/lib/battle/BattleHex.cpp @@ -10,6 +10,8 @@ #include "StdInc.h" #include "BattleHex.h" +VCMI_LIB_NAMESPACE_BEGIN + BattleHex::BattleHex() : hex(INVALID) {} BattleHex::BattleHex(si16 _hex) : hex(_hex) {} @@ -224,3 +226,5 @@ static BattleHex::NeighbouringTilesCache calculateNeighbouringTiles() } const BattleHex::NeighbouringTilesCache BattleHex::neighbouringTilesCache = calculateNeighbouringTiles(); + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/BattleHex.h b/lib/battle/BattleHex.h index 6633da3e6..c79d77a0a 100644 --- a/lib/battle/BattleHex.h +++ b/lib/battle/BattleHex.h @@ -9,6 +9,8 @@ */ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + //TODO: change to enum class namespace BattleSide @@ -82,3 +84,5 @@ struct DLL_LINKAGE BattleHex //TODO: decide if this should be changed to class f }; DLL_EXPORT std::ostream & operator<<(std::ostream & os, const BattleHex & hex); + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/BattleInfo.cpp b/lib/battle/BattleInfo.cpp index 3ffa5d742..c7a1c533a 100644 --- a/lib/battle/BattleInfo.cpp +++ b/lib/battle/BattleInfo.cpp @@ -22,6 +22,8 @@ //TODO: remove #include "../IGameCallback.h" +VCMI_LIB_NAMESPACE_BEGIN + ///BattleInfo std::pair< std::vector, int > BattleInfo::getPath(BattleHex start, BattleHex dest, const CStack * stack) { @@ -1011,3 +1013,5 @@ CMP_stack::CMP_stack(int Phase, int Turn, uint8_t Side) turn = Turn; side = Side; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/BattleInfo.h b/lib/battle/BattleInfo.h index 73a4ad0cc..bfcb52641 100644 --- a/lib/battle/BattleInfo.h +++ b/lib/battle/BattleInfo.h @@ -15,6 +15,8 @@ #include "SiegeInfo.h" #include "SideInBattle.h" +VCMI_LIB_NAMESPACE_BEGIN + class CStack; class CStackInstance; class CStackBasicDescriptor; @@ -160,3 +162,5 @@ public: bool operator ()(const battle::Unit * a, const battle::Unit * b); CMP_stack(int Phase = 1, int Turn = 0, uint8_t Side = BattleSide::ATTACKER); }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/BattleProxy.cpp b/lib/battle/BattleProxy.cpp index 83df1520a..4c10cde52 100644 --- a/lib/battle/BattleProxy.cpp +++ b/lib/battle/BattleProxy.cpp @@ -12,6 +12,8 @@ #include "Unit.h" #include "Terrain.h" +VCMI_LIB_NAMESPACE_BEGIN + ///BattleProxy BattleProxy::BattleProxy(Subject subject_) @@ -112,3 +114,5 @@ const IBonusBearer * BattleProxy::asBearer() const return subject->getBattleNode(); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/BattleProxy.h b/lib/battle/BattleProxy.h index b756dadea..cd728ef53 100644 --- a/lib/battle/BattleProxy.h +++ b/lib/battle/BattleProxy.h @@ -12,6 +12,8 @@ #include "CBattleInfoCallback.h" #include "IBattleState.h" +VCMI_LIB_NAMESPACE_BEGIN + class DLL_LINKAGE BattleProxy : public CBattleInfoCallback, public IBattleState { public: @@ -52,3 +54,5 @@ public: protected: Subject subject; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/CBattleInfoCallback.cpp b/lib/battle/CBattleInfoCallback.cpp index fbeb7d20a..8d891a8f6 100644 --- a/lib/battle/CBattleInfoCallback.cpp +++ b/lib/battle/CBattleInfoCallback.cpp @@ -19,6 +19,8 @@ #include "../mapObjects/CGTownInstance.h" #include "../BattleFieldHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace SiegeStuffThatShouldBeMovedToHandlers // <=== TODO { /* @@ -1991,3 +1993,5 @@ boost::optional CBattleInfoCallback::battleIsFinished() const else return 1; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/CBattleInfoCallback.h b/lib/battle/CBattleInfoCallback.h index b5cd714c3..db88b9f11 100644 --- a/lib/battle/CBattleInfoCallback.h +++ b/lib/battle/CBattleInfoCallback.h @@ -15,6 +15,8 @@ #include "ReachabilityInfo.h" #include "BattleAttackInfo.h" +VCMI_LIB_NAMESPACE_BEGIN + class CGHeroInstance; class CStack; class ISpellCaster; @@ -151,3 +153,5 @@ protected: bool isInObstacle(BattleHex hex, const std::set & obstacles, const ReachabilityInfo::Parameters & params) const; std::set getStoppers(BattlePerspective::BattlePerspective whichSidePerspective) const; //get hexes with stopping obstacles (quicksands) }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/CBattleInfoEssentials.cpp b/lib/battle/CBattleInfoEssentials.cpp index 9d0370a1f..8ed3b44a5 100644 --- a/lib/battle/CBattleInfoEssentials.cpp +++ b/lib/battle/CBattleInfoEssentials.cpp @@ -14,6 +14,8 @@ #include "../NetPacks.h" #include "../mapObjects/CGTownInstance.h" +VCMI_LIB_NAMESPACE_BEGIN + Terrain CBattleInfoEssentials::battleTerrainType() const { RETURN_IF_NOT_BATTLE(Terrain()); @@ -423,3 +425,5 @@ bool CBattleInfoEssentials::battleMatchOwner(const PlayerColor & attacker, const return boost::logic::indeterminate(positivness) || (attacker == initialOwner) == (bool)positivness; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/CBattleInfoEssentials.h b/lib/battle/CBattleInfoEssentials.h index bc354ab78..cc3ec0992 100644 --- a/lib/battle/CBattleInfoEssentials.h +++ b/lib/battle/CBattleInfoEssentials.h @@ -11,6 +11,8 @@ #include "CCallbackBase.h" #include "IBattleInfoCallback.h" +VCMI_LIB_NAMESPACE_BEGIN + class CGTownInstance; class CGHeroInstance; class CStack; @@ -113,3 +115,5 @@ public: bool battleMatchOwner(const battle::Unit * attacker, const battle::Unit * defender, const boost::logic::tribool positivness = false) const; bool battleMatchOwner(const PlayerColor & attacker, const battle::Unit * defender, const boost::logic::tribool positivness = false) const; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/CCallbackBase.cpp b/lib/battle/CCallbackBase.cpp index 39bdb5087..6bf4f7840 100644 --- a/lib/battle/CCallbackBase.cpp +++ b/lib/battle/CCallbackBase.cpp @@ -11,6 +11,8 @@ #include "CCallbackBase.h" #include "IBattleState.h" +VCMI_LIB_NAMESPACE_BEGIN + bool CCallbackBase::duringBattle() const { return getBattle() != nullptr; @@ -39,3 +41,5 @@ boost::optional CCallbackBase::getPlayerID() const return player; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/CCallbackBase.h b/lib/battle/CCallbackBase.h index 43ff7cfc8..b83a8e82e 100644 --- a/lib/battle/CCallbackBase.h +++ b/lib/battle/CCallbackBase.h @@ -13,6 +13,8 @@ #define RETURN_IF_NOT_BATTLE(...) if(!duringBattle()) {logGlobal->error("%s called when no battle!", __FUNCTION__); return __VA_ARGS__; } #define ASSERT_IF_CALLED_WITH_PLAYER if(!player) {logGlobal->error(BOOST_CURRENT_FUNCTION); assert(0);} +VCMI_LIB_NAMESPACE_BEGIN + class IBattleInfo; class BattleInfo; class CBattleInfoEssentials; @@ -40,3 +42,5 @@ public: friend class CBattleInfoEssentials; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/CObstacleInstance.cpp b/lib/battle/CObstacleInstance.cpp index 78edff13b..92e07c76c 100644 --- a/lib/battle/CObstacleInstance.cpp +++ b/lib/battle/CObstacleInstance.cpp @@ -18,6 +18,8 @@ #include "../serializer/JsonDeserializer.h" #include "../serializer/JsonSerializer.h" +VCMI_LIB_NAMESPACE_BEGIN + CObstacleInstance::CObstacleInstance() { obstacleType = USUAL; @@ -213,3 +215,5 @@ std::vector MoatObstacle::getAffectedTiles() const { return (*VLC->townh)[ID]->town->moatHexes; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/CObstacleInstance.h b/lib/battle/CObstacleInstance.h index 041330779..c668b8ba4 100644 --- a/lib/battle/CObstacleInstance.h +++ b/lib/battle/CObstacleInstance.h @@ -10,6 +10,8 @@ #pragma once #include "BattleHex.h" +VCMI_LIB_NAMESPACE_BEGIN + class ObstacleInfo; class ObstacleChanges; class JsonSerializeFormat; @@ -118,3 +120,5 @@ struct DLL_LINKAGE SpellCreatedObstacle : CObstacleInstance h & customSize; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/CPlayerBattleCallback.cpp b/lib/battle/CPlayerBattleCallback.cpp index 5dae89f11..abdc631ed 100644 --- a/lib/battle/CPlayerBattleCallback.cpp +++ b/lib/battle/CPlayerBattleCallback.cpp @@ -12,6 +12,8 @@ #include "../CStack.h" #include "../CGameState.h" +VCMI_LIB_NAMESPACE_BEGIN + bool CPlayerBattleCallback::battleCanFlee() const { RETURN_IF_NOT_BATTLE(false); @@ -52,3 +54,5 @@ InfoAboutHero CPlayerBattleCallback::battleGetEnemyHero() const return battleGetHeroInfo(!battleGetMySide()); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/CPlayerBattleCallback.h b/lib/battle/CPlayerBattleCallback.h index 38ac80baa..f903a37af 100644 --- a/lib/battle/CPlayerBattleCallback.h +++ b/lib/battle/CPlayerBattleCallback.h @@ -10,6 +10,8 @@ #pragma once #include "CBattleInfoCallback.h" +VCMI_LIB_NAMESPACE_BEGIN + class CGHeroInstance; class DLL_LINKAGE CPlayerBattleCallback : public CBattleInfoCallback @@ -24,3 +26,5 @@ public: InfoAboutHero battleGetEnemyHero() const; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/CUnitState.cpp b/lib/battle/CUnitState.cpp index 248dcfd10..770ce2b9d 100644 --- a/lib/battle/CUnitState.cpp +++ b/lib/battle/CUnitState.cpp @@ -19,6 +19,8 @@ #include "../serializer/JsonDeserializer.h" #include "../serializer/JsonSerializer.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace battle { ///CAmmo @@ -952,3 +954,5 @@ void CUnitStateDetached::spendMana(ServerCallback * server, const int spellCost) } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/CUnitState.h b/lib/battle/CUnitState.h index 46fee68b3..5bd3e02e4 100644 --- a/lib/battle/CUnitState.h +++ b/lib/battle/CUnitState.h @@ -12,6 +12,8 @@ #include "Unit.h" +VCMI_LIB_NAMESPACE_BEGIN + class JsonSerializeFormat; class UnitChanges; @@ -294,3 +296,5 @@ private: }; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/Destination.cpp b/lib/battle/Destination.cpp index ba7fea41d..406b51f97 100644 --- a/lib/battle/Destination.cpp +++ b/lib/battle/Destination.cpp @@ -13,6 +13,8 @@ #include "Unit.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace battle { @@ -62,3 +64,5 @@ Destination & Destination::operator=(const Destination & other) } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/Destination.h b/lib/battle/Destination.h index 8d5cb274f..904e8fc8d 100644 --- a/lib/battle/Destination.h +++ b/lib/battle/Destination.h @@ -12,6 +12,8 @@ #include "BattleHex.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace battle { @@ -37,3 +39,5 @@ public: using Target = std::vector; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/IBattleInfoCallback.h b/lib/battle/IBattleInfoCallback.h index fcce0c7f2..d1bb1a3d6 100644 --- a/lib/battle/IBattleInfoCallback.h +++ b/lib/battle/IBattleInfoCallback.h @@ -12,6 +12,8 @@ #include "BattleHex.h" +VCMI_LIB_NAMESPACE_BEGIN + struct CObstacleInstance; class BattleField; class Terrain; @@ -62,3 +64,5 @@ public: }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/IBattleState.h b/lib/battle/IBattleState.h index 02f21d935..6e88b13ac 100644 --- a/lib/battle/IBattleState.h +++ b/lib/battle/IBattleState.h @@ -11,6 +11,8 @@ #pragma once #include "CBattleInfoEssentials.h" +VCMI_LIB_NAMESPACE_BEGIN + class ObstacleChanges; class UnitChanges; struct Bonus; @@ -91,3 +93,5 @@ public: virtual void updateObstacle(const ObstacleChanges & changes) = 0; virtual void removeObstacle(uint32_t id) = 0; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/IUnitInfo.h b/lib/battle/IUnitInfo.h index e8edfe3f0..f91ccce2f 100644 --- a/lib/battle/IUnitInfo.h +++ b/lib/battle/IUnitInfo.h @@ -12,6 +12,8 @@ #include "../GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + class CCreature; namespace battle @@ -41,3 +43,5 @@ public: }; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/ReachabilityInfo.cpp b/lib/battle/ReachabilityInfo.cpp index 2dc8caa61..0a5452e26 100644 --- a/lib/battle/ReachabilityInfo.cpp +++ b/lib/battle/ReachabilityInfo.cpp @@ -12,6 +12,8 @@ #include "ReachabilityInfo.h" #include "Unit.h" +VCMI_LIB_NAMESPACE_BEGIN + ReachabilityInfo::Parameters::Parameters() { @@ -72,3 +74,5 @@ int ReachabilityInfo::distToNearestNeighbour( return distToNearestNeighbour(attackableHexes, chosenHex); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/ReachabilityInfo.h b/lib/battle/ReachabilityInfo.h index 9078a3b86..502a269ec 100644 --- a/lib/battle/ReachabilityInfo.h +++ b/lib/battle/ReachabilityInfo.h @@ -12,6 +12,8 @@ #include "CBattleInfoEssentials.h" #include "AccessibilityInfo.h" +VCMI_LIB_NAMESPACE_BEGIN + // Reachability info is result of BFS calculation. It's dependent on stack (it's owner, whether it's flying), // startPosition and perpective. struct DLL_LINKAGE ReachabilityInfo @@ -55,3 +57,5 @@ struct DLL_LINKAGE ReachabilityInfo }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/SideInBattle.cpp b/lib/battle/SideInBattle.cpp index 3696f4128..638de4929 100644 --- a/lib/battle/SideInBattle.cpp +++ b/lib/battle/SideInBattle.cpp @@ -11,6 +11,8 @@ #include "SideInBattle.h" #include "../mapObjects/CArmedInstance.h" +VCMI_LIB_NAMESPACE_BEGIN + SideInBattle::SideInBattle() { color = PlayerColor::CANNOT_DETERMINE; @@ -29,3 +31,5 @@ void SideInBattle::init(const CGHeroInstance * Hero, const CArmedInstance * Army if(color == PlayerColor::UNFLAGGABLE) color = PlayerColor::NEUTRAL; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/SideInBattle.h b/lib/battle/SideInBattle.h index 9f571e614..14ff2cc13 100644 --- a/lib/battle/SideInBattle.h +++ b/lib/battle/SideInBattle.h @@ -10,6 +10,8 @@ #pragma once #include "../GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + class CGHeroInstance; class CArmedInstance; @@ -37,3 +39,5 @@ struct DLL_LINKAGE SideInBattle h & enchanterCounter; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/SiegeInfo.cpp b/lib/battle/SiegeInfo.cpp index 42a33e9de..13c2dc468 100644 --- a/lib/battle/SiegeInfo.cpp +++ b/lib/battle/SiegeInfo.cpp @@ -10,6 +10,8 @@ #include "StdInc.h" #include "SiegeInfo.h" +VCMI_LIB_NAMESPACE_BEGIN + SiegeInfo::SiegeInfo() { @@ -37,3 +39,5 @@ EWallState::EWallState SiegeInfo::applyDamage(EWallState::EWallState state, unsi return EWallState::NONE; } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/SiegeInfo.h b/lib/battle/SiegeInfo.h index 7859d2740..f508c1f14 100644 --- a/lib/battle/SiegeInfo.h +++ b/lib/battle/SiegeInfo.h @@ -10,6 +10,8 @@ #pragma once #include "../GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + //only for use in BattleInfo struct DLL_LINKAGE SiegeInfo { @@ -27,3 +29,5 @@ struct DLL_LINKAGE SiegeInfo h & gateState; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/Unit.cpp b/lib/battle/Unit.cpp index 663da7d89..d98cfe2e9 100644 --- a/lib/battle/Unit.cpp +++ b/lib/battle/Unit.cpp @@ -18,6 +18,8 @@ #include "../serializer/JsonDeserializer.h" #include "../serializer/JsonSerializer.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace battle { @@ -238,3 +240,5 @@ void UnitInfo::load(uint32_t id_, const JsonNode & data) } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/battle/Unit.h b/lib/battle/Unit.h index 26d834d93..656c7bd7a 100644 --- a/lib/battle/Unit.h +++ b/lib/battle/Unit.h @@ -17,6 +17,8 @@ #include "IUnitInfo.h" #include "BattleHex.h" +VCMI_LIB_NAMESPACE_BEGIN + struct MetaString; class JsonNode; class JsonSerializeFormat; @@ -129,3 +131,5 @@ public: }; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/events/ApplyDamage.cpp b/lib/events/ApplyDamage.cpp index 93b387899..b0466da64 100644 --- a/lib/events/ApplyDamage.cpp +++ b/lib/events/ApplyDamage.cpp @@ -15,6 +15,8 @@ #include "../../lib/NetPacks.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace events { @@ -58,3 +60,5 @@ const battle::Unit * CApplyDamage::getTarget() const }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/events/ApplyDamage.h b/lib/events/ApplyDamage.h index 178d12224..a7a426c45 100644 --- a/lib/events/ApplyDamage.h +++ b/lib/events/ApplyDamage.h @@ -12,6 +12,8 @@ #include +VCMI_LIB_NAMESPACE_BEGIN + namespace events { @@ -33,3 +35,5 @@ private: }; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/events/GameResumed.cpp b/lib/events/GameResumed.cpp index b7d98bb77..b2e493900 100644 --- a/lib/events/GameResumed.cpp +++ b/lib/events/GameResumed.cpp @@ -13,6 +13,8 @@ #include +VCMI_LIB_NAMESPACE_BEGIN + namespace events { @@ -37,3 +39,5 @@ bool CGameResumed::isEnabled() const } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/events/GameResumed.h b/lib/events/GameResumed.h index c0c36e3be..9fc3df73a 100644 --- a/lib/events/GameResumed.h +++ b/lib/events/GameResumed.h @@ -12,6 +12,8 @@ #include +VCMI_LIB_NAMESPACE_BEGIN + namespace events { @@ -24,3 +26,5 @@ public: }; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/events/ObjectVisitEnded.cpp b/lib/events/ObjectVisitEnded.cpp index 6c8f2e2af..61d4d801f 100644 --- a/lib/events/ObjectVisitEnded.cpp +++ b/lib/events/ObjectVisitEnded.cpp @@ -13,6 +13,8 @@ #include +VCMI_LIB_NAMESPACE_BEGIN + namespace events { @@ -53,3 +55,5 @@ ObjectInstanceID CObjectVisitEnded::getHero() const } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/events/ObjectVisitEnded.h b/lib/events/ObjectVisitEnded.h index a3b8323ab..2cdf22d2e 100644 --- a/lib/events/ObjectVisitEnded.h +++ b/lib/events/ObjectVisitEnded.h @@ -14,6 +14,8 @@ #include "../GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace events { @@ -31,3 +33,5 @@ private: }; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/events/ObjectVisitStarted.cpp b/lib/events/ObjectVisitStarted.cpp index 863da819d..d535bd263 100644 --- a/lib/events/ObjectVisitStarted.cpp +++ b/lib/events/ObjectVisitStarted.cpp @@ -13,6 +13,8 @@ #include +VCMI_LIB_NAMESPACE_BEGIN + namespace events { @@ -65,3 +67,5 @@ void CObjectVisitStarted::setEnabled(bool enable) } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/events/ObjectVisitStarted.h b/lib/events/ObjectVisitStarted.h index d3754bddc..68fca2d8e 100644 --- a/lib/events/ObjectVisitStarted.h +++ b/lib/events/ObjectVisitStarted.h @@ -14,6 +14,8 @@ #include "../GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace events { @@ -36,3 +38,5 @@ private: }; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/events/PlayerGotTurn.cpp b/lib/events/PlayerGotTurn.cpp index ae5453a7a..cbe7f7c2d 100644 --- a/lib/events/PlayerGotTurn.cpp +++ b/lib/events/PlayerGotTurn.cpp @@ -13,6 +13,8 @@ #include +VCMI_LIB_NAMESPACE_BEGIN + namespace events { @@ -59,3 +61,5 @@ void CPlayerGotTurn::setPlayerIndex(int32_t value) } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/events/PlayerGotTurn.h b/lib/events/PlayerGotTurn.h index 8258f25e6..78d61adc5 100644 --- a/lib/events/PlayerGotTurn.h +++ b/lib/events/PlayerGotTurn.h @@ -14,6 +14,8 @@ #include "../GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace events { @@ -34,3 +36,5 @@ private: }; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/events/TurnStarted.cpp b/lib/events/TurnStarted.cpp index 015ab9ca0..655c32532 100644 --- a/lib/events/TurnStarted.cpp +++ b/lib/events/TurnStarted.cpp @@ -13,6 +13,8 @@ #include +VCMI_LIB_NAMESPACE_BEGIN + namespace events { @@ -37,3 +39,5 @@ bool CTurnStarted::isEnabled() const } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/events/TurnStarted.h b/lib/events/TurnStarted.h index a7bb3cb98..5a5520a02 100644 --- a/lib/events/TurnStarted.h +++ b/lib/events/TurnStarted.h @@ -12,6 +12,8 @@ #include +VCMI_LIB_NAMESPACE_BEGIN + namespace events { @@ -24,3 +26,5 @@ public: }; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/AdapterLoaders.cpp b/lib/filesystem/AdapterLoaders.cpp index dd483d2ae..361bcf6c6 100644 --- a/lib/filesystem/AdapterLoaders.cpp +++ b/lib/filesystem/AdapterLoaders.cpp @@ -13,6 +13,8 @@ #include "../JsonNode.h" #include "Filesystem.h" +VCMI_LIB_NAMESPACE_BEGIN + CMappedFileLoader::CMappedFileLoader(const std::string & mountPoint, const JsonNode &config) { for(auto entry : config.Struct()) @@ -181,3 +183,5 @@ bool CFilesystemList::removeLoader(ISimpleResourceLoader * loader) } return false; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/AdapterLoaders.h b/lib/filesystem/AdapterLoaders.h index 460a54d63..7f5620c88 100644 --- a/lib/filesystem/AdapterLoaders.h +++ b/lib/filesystem/AdapterLoaders.h @@ -12,6 +12,8 @@ #include "ISimpleResourceLoader.h" #include "ResourceID.h" +VCMI_LIB_NAMESPACE_BEGIN + class CInputStream; class JsonNode; @@ -95,3 +97,5 @@ public: */ bool removeLoader(ISimpleResourceLoader * loader); }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/CArchiveLoader.cpp b/lib/filesystem/CArchiveLoader.cpp index 294f4db2d..f53241d46 100644 --- a/lib/filesystem/CArchiveLoader.cpp +++ b/lib/filesystem/CArchiveLoader.cpp @@ -15,6 +15,8 @@ #include "CBinaryReader.h" +VCMI_LIB_NAMESPACE_BEGIN + ArchiveEntry::ArchiveEntry() : offset(0), fullSize(0), compressedSize(0) { @@ -179,3 +181,5 @@ std::unordered_set CArchiveLoader::getFilteredFiles(std::function entries; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/CBinaryReader.cpp b/lib/filesystem/CBinaryReader.cpp index 5a4808003..a3c7fc706 100644 --- a/lib/filesystem/CBinaryReader.cpp +++ b/lib/filesystem/CBinaryReader.cpp @@ -15,6 +15,8 @@ #include "CInputStream.h" #include "../CGeneralTextHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + #if SDL_BYTEORDER == SDL_BIG_ENDIAN template CData readLE(CData data) @@ -117,3 +119,5 @@ std::string CBinaryReader::getEndOfStreamExceptionMsg(long bytesToRead) const return ss.str(); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/CBinaryReader.h b/lib/filesystem/CBinaryReader.h index 166adc0b3..c5a5f2829 100644 --- a/lib/filesystem/CBinaryReader.h +++ b/lib/filesystem/CBinaryReader.h @@ -9,6 +9,8 @@ */ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + class CInputStream; /** @@ -101,3 +103,5 @@ private: /** The underlying base stream */ CInputStream * stream; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/CCompressedStream.cpp b/lib/filesystem/CCompressedStream.cpp index 7fa23529f..520011784 100644 --- a/lib/filesystem/CCompressedStream.cpp +++ b/lib/filesystem/CCompressedStream.cpp @@ -12,6 +12,8 @@ #include +VCMI_LIB_NAMESPACE_BEGIN + static const int inflateBlockSize = 10000; CBufferedStream::CBufferedStream(): @@ -189,3 +191,5 @@ bool CCompressedStream::getNextBlock() reset(); return true; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/CCompressedStream.h b/lib/filesystem/CCompressedStream.h index 8f6191cdb..5c5930e67 100644 --- a/lib/filesystem/CCompressedStream.h +++ b/lib/filesystem/CCompressedStream.h @@ -13,6 +13,8 @@ struct z_stream_s; +VCMI_LIB_NAMESPACE_BEGIN + /// Abstract class that provides buffer for one-directional input streams (e.g. compressed data) /// Used for zip archives support and in .lod deflate compression class CBufferedStream : public CInputStream @@ -135,3 +137,5 @@ private: FINISHED }; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/CFileInputStream.cpp b/lib/filesystem/CFileInputStream.cpp index aa54e353c..eb14e3eda 100644 --- a/lib/filesystem/CFileInputStream.cpp +++ b/lib/filesystem/CFileInputStream.cpp @@ -10,6 +10,8 @@ #include "StdInc.h" #include "CFileInputStream.h" +VCMI_LIB_NAMESPACE_BEGIN + CFileInputStream::CFileInputStream(const boost::filesystem::path & file, si64 start, si64 size) : dataStart{start}, dataSize{size}, @@ -61,3 +63,5 @@ si64 CFileInputStream::getSize() { return dataSize; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/CFileInputStream.h b/lib/filesystem/CFileInputStream.h index e72755feb..4dd499188 100644 --- a/lib/filesystem/CFileInputStream.h +++ b/lib/filesystem/CFileInputStream.h @@ -12,6 +12,8 @@ #include "CInputStream.h" #include "FileStream.h" +VCMI_LIB_NAMESPACE_BEGIN + /** * A class which provides method definitions for reading a file from the filesystem. */ @@ -75,3 +77,5 @@ private: /** Native c++ input file stream object. */ FileStream fileStream; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/CFilesystemLoader.cpp b/lib/filesystem/CFilesystemLoader.cpp index d4c8b7e51..122d22bf8 100644 --- a/lib/filesystem/CFilesystemLoader.cpp +++ b/lib/filesystem/CFilesystemLoader.cpp @@ -13,6 +13,8 @@ #include "CFileInputStream.h" #include "FileStream.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace bfs = boost::filesystem; CFilesystemLoader::CFilesystemLoader(std::string _mountPoint, bfs::path baseDirectory, size_t depth, bool initial): @@ -164,3 +166,5 @@ std::unordered_map CFilesystemLoader::listFiles(const std return fileList; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/CFilesystemLoader.h b/lib/filesystem/CFilesystemLoader.h index e8230b91b..847aaa42c 100644 --- a/lib/filesystem/CFilesystemLoader.h +++ b/lib/filesystem/CFilesystemLoader.h @@ -12,6 +12,8 @@ #include "ISimpleResourceLoader.h" #include "ResourceID.h" +VCMI_LIB_NAMESPACE_BEGIN + class CInputStream; /** @@ -65,3 +67,5 @@ private: */ std::unordered_map listFiles(const std::string &mountPoint, size_t depth, bool initial) const; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/CInputOutputStream.h b/lib/filesystem/CInputOutputStream.h index 8c80c4bac..86d561997 100644 --- a/lib/filesystem/CInputOutputStream.h +++ b/lib/filesystem/CInputOutputStream.h @@ -12,7 +12,11 @@ #include "CInputStream.h" #include "COutputStream.h" +VCMI_LIB_NAMESPACE_BEGIN + class CInputOutputStream: public CInputStream, public COutputStream { }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/CInputStream.h b/lib/filesystem/CInputStream.h index 087534330..e5f2c0839 100644 --- a/lib/filesystem/CInputStream.h +++ b/lib/filesystem/CInputStream.h @@ -11,6 +11,8 @@ #include "CStream.h" +VCMI_LIB_NAMESPACE_BEGIN + /** * Abstract class which provides method definitions for reading from a stream. */ @@ -65,3 +67,5 @@ public: return checksum.checksum(); } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/CMemoryBuffer.cpp b/lib/filesystem/CMemoryBuffer.cpp index 849502e7a..a7fcbcc59 100644 --- a/lib/filesystem/CMemoryBuffer.cpp +++ b/lib/filesystem/CMemoryBuffer.cpp @@ -11,6 +11,8 @@ #include "StdInc.h" #include "CMemoryBuffer.h" +VCMI_LIB_NAMESPACE_BEGIN + ///CMemoryBuffer CMemoryBuffer::CMemoryBuffer(): position(0) @@ -71,3 +73,5 @@ si64 CMemoryBuffer::getSize() } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/CMemoryBuffer.h b/lib/filesystem/CMemoryBuffer.h index e35a78313..add14cf15 100644 --- a/lib/filesystem/CMemoryBuffer.h +++ b/lib/filesystem/CMemoryBuffer.h @@ -11,6 +11,8 @@ #include "CInputOutputStream.h" +VCMI_LIB_NAMESPACE_BEGIN + /** * A class which provides IO memory buffer. */ @@ -84,3 +86,5 @@ private: si64 position; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/CMemoryStream.cpp b/lib/filesystem/CMemoryStream.cpp index 36eaacfaa..3c3ef4ba3 100644 --- a/lib/filesystem/CMemoryStream.cpp +++ b/lib/filesystem/CMemoryStream.cpp @@ -10,6 +10,8 @@ #include "StdInc.h" #include "CMemoryStream.h" +VCMI_LIB_NAMESPACE_BEGIN + CMemoryStream::CMemoryStream(const ui8 * data, si64 size) : data(data), size(size), position(0) { @@ -47,3 +49,5 @@ si64 CMemoryStream::getSize() { return size; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/CMemoryStream.h b/lib/filesystem/CMemoryStream.h index 8af312cc3..f21e5ba14 100644 --- a/lib/filesystem/CMemoryStream.h +++ b/lib/filesystem/CMemoryStream.h @@ -11,6 +11,8 @@ #include "CInputStream.h" +VCMI_LIB_NAMESPACE_BEGIN + /** * A class which provides method definitions for reading from memory. * @deprecated use CMemoryBuffer @@ -75,3 +77,5 @@ private: /** Current reading position of the stream. */ si64 position; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/COutputStream.h b/lib/filesystem/COutputStream.h index 819fa8820..a6e3d008a 100644 --- a/lib/filesystem/COutputStream.h +++ b/lib/filesystem/COutputStream.h @@ -11,6 +11,8 @@ #include "CStream.h" +VCMI_LIB_NAMESPACE_BEGIN + /** * Abstract class which provides method definitions for writing into a stream. */ @@ -31,3 +33,5 @@ public: */ virtual si64 write(const ui8 * data, si64 size) = 0; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/CStream.h b/lib/filesystem/CStream.h index b8a0ca55f..0a1e6c961 100644 --- a/lib/filesystem/CStream.h +++ b/lib/filesystem/CStream.h @@ -9,6 +9,8 @@ */ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + class DLL_LINKAGE CStream : private boost::noncopyable { public: @@ -47,3 +49,5 @@ public: */ virtual si64 getSize() = 0; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/CZipLoader.cpp b/lib/filesystem/CZipLoader.cpp index 35e4cdcd8..30604b952 100644 --- a/lib/filesystem/CZipLoader.cpp +++ b/lib/filesystem/CZipLoader.cpp @@ -13,6 +13,8 @@ #include "../ScopeGuard.h" +VCMI_LIB_NAMESPACE_BEGIN + CZipStream::CZipStream(std::shared_ptr api, const boost::filesystem::path & archive, unz64_file_pos filepos) { zlib_filefunc64_def zlibApi; @@ -216,3 +218,5 @@ bool ZipArchive::extract(boost::filesystem::path from, boost::filesystem::path w } return true; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/CZipLoader.h b/lib/filesystem/CZipLoader.h index 0365c67c2..288362da3 100644 --- a/lib/filesystem/CZipLoader.h +++ b/lib/filesystem/CZipLoader.h @@ -16,6 +16,8 @@ #include "MinizipExtensions.h" +VCMI_LIB_NAMESPACE_BEGIN + class DLL_LINKAGE CZipStream : public CBufferedStream { unzFile file; @@ -70,3 +72,5 @@ namespace ZipArchive ///same as above, but extracts only files mentioned in "what" list bool DLL_LINKAGE extract(boost::filesystem::path from, boost::filesystem::path where, std::vector what); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/CZipSaver.cpp b/lib/filesystem/CZipSaver.cpp index 28647cb2b..87c3b848d 100644 --- a/lib/filesystem/CZipSaver.cpp +++ b/lib/filesystem/CZipSaver.cpp @@ -11,6 +11,8 @@ #include "StdInc.h" #include "CZipSaver.h" +VCMI_LIB_NAMESPACE_BEGIN + ///CZipOutputStream CZipOutputStream::CZipOutputStream(CZipSaver * owner_, zipFile archive, const std::string & archiveFilename): handle(archive), @@ -118,3 +120,5 @@ std::unique_ptr CZipSaver::addFile(const std::string & archiveFil return stream; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/CZipSaver.h b/lib/filesystem/CZipSaver.h index 88993f5d4..d9214468d 100644 --- a/lib/filesystem/CZipSaver.h +++ b/lib/filesystem/CZipSaver.h @@ -13,6 +13,8 @@ #include "MinizipExtensions.h" +VCMI_LIB_NAMESPACE_BEGIN + class CZipSaver; class DLL_LINKAGE CZipOutputStream: public COutputStream @@ -54,3 +56,5 @@ private: COutputStream * activeStream; friend class CZipOutputStream; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/FileInfo.cpp b/lib/filesystem/FileInfo.cpp index 89498a3a2..332fb71fa 100644 --- a/lib/filesystem/FileInfo.cpp +++ b/lib/filesystem/FileInfo.cpp @@ -11,6 +11,8 @@ #include "FileInfo.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace FileInfo { @@ -63,3 +65,5 @@ boost::string_ref GetPathStem(boost::string_ref path) } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/FileInfo.h b/lib/filesystem/FileInfo.h index 484f17ecd..a8cd7963c 100644 --- a/lib/filesystem/FileInfo.h +++ b/lib/filesystem/FileInfo.h @@ -11,6 +11,8 @@ #include +VCMI_LIB_NAMESPACE_BEGIN + namespace FileInfo { @@ -50,3 +52,5 @@ boost::string_ref DLL_LINKAGE GetParentPath(boost::string_ref path); boost::string_ref DLL_LINKAGE GetPathStem(boost::string_ref path); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/FileStream.cpp b/lib/filesystem/FileStream.cpp index d3d4796f8..a85fcc913 100644 --- a/lib/filesystem/FileStream.cpp +++ b/lib/filesystem/FileStream.cpp @@ -218,6 +218,10 @@ void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def) } +template struct boost::iostreams::stream; + +VCMI_LIB_NAMESPACE_BEGIN + zlib_filefunc64_def* FileStream::GetMinizipFilefunc() { static zlib_filefunc64_def MinizipFilefunc; @@ -231,8 +235,6 @@ zlib_filefunc64_def* FileStream::GetMinizipFilefunc() return &MinizipFilefunc; } -template struct boost::iostreams::stream; - /*static*/ bool FileStream::CreateFile(const boost::filesystem::path& filename) { @@ -322,3 +324,5 @@ std::streamoff FileBuf::seek(std::streamoff off, std::ios_base::seekdir way) return static_cast(std::ftell(GETFILE)); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/FileStream.h b/lib/filesystem/FileStream.h index 57b9b420d..145a2e067 100644 --- a/lib/filesystem/FileStream.h +++ b/lib/filesystem/FileStream.h @@ -12,6 +12,8 @@ #include #include +VCMI_LIB_NAMESPACE_BEGIN + class DLL_LINKAGE FileBuf { public: @@ -32,13 +34,17 @@ private: void* filePtr; }; +VCMI_LIB_NAMESPACE_END + struct zlib_filefunc64_def_s; typedef zlib_filefunc64_def_s zlib_filefunc64_def; #ifdef VCMI_DLL -extern template struct DLL_LINKAGE boost::iostreams::stream; +extern template struct DLL_LINKAGE boost::iostreams::stream; #endif +VCMI_LIB_NAMESPACE_BEGIN + class DLL_LINKAGE FileStream : public boost::iostreams::stream { public: @@ -50,3 +56,5 @@ public: static zlib_filefunc64_def* GetMinizipFilefunc(); }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/Filesystem.cpp b/lib/filesystem/Filesystem.cpp index 7afe29345..45e423a56 100644 --- a/lib/filesystem/Filesystem.cpp +++ b/lib/filesystem/Filesystem.cpp @@ -21,6 +21,8 @@ #include "../VCMIDirs.h" #include "../CStopWatch.h" +VCMI_LIB_NAMESPACE_BEGIN + std::map CResourceHandler::knownLoaders = std::map(); CResourceHandler CResourceHandler::globalResourceHandler; @@ -247,3 +249,5 @@ ISimpleResourceLoader * CResourceHandler::createFileSystem(const std::string & p generator.loadConfig(fsConfig); return generator.getFilesystem(); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/Filesystem.h b/lib/filesystem/Filesystem.h index 8839a0e9c..1ea993b4d 100644 --- a/lib/filesystem/Filesystem.h +++ b/lib/filesystem/Filesystem.h @@ -13,6 +13,8 @@ #include "ISimpleResourceLoader.h" #include "ResourceID.h" +VCMI_LIB_NAMESPACE_BEGIN + class CFilesystemList; class JsonNode; @@ -113,3 +115,5 @@ private: CResourceHandler() {}; std::unique_ptr rootLoader; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/ISimpleResourceLoader.h b/lib/filesystem/ISimpleResourceLoader.h index 05371a22b..833000df1 100644 --- a/lib/filesystem/ISimpleResourceLoader.h +++ b/lib/filesystem/ISimpleResourceLoader.h @@ -9,6 +9,8 @@ */ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + class CInputStream; class ResourceID; @@ -105,3 +107,5 @@ public: return std::vector(); } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/MinizipExtensions.cpp b/lib/filesystem/MinizipExtensions.cpp index 23edf26d4..3ddf40b09 100644 --- a/lib/filesystem/MinizipExtensions.cpp +++ b/lib/filesystem/MinizipExtensions.cpp @@ -13,6 +13,8 @@ #include "CMemoryBuffer.h" #include "FileStream.h" +VCMI_LIB_NAMESPACE_BEGIN + template inline uLong streamRead(voidpf opaque, voidpf stream, void * buf, uLong size) { assert(opaque != nullptr); @@ -252,3 +254,5 @@ int ZCALLBACK CProxyROIOApi::errorFileProxy(voidpf opaque, voidpf stream) { return 0; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/MinizipExtensions.h b/lib/filesystem/MinizipExtensions.h index 43c739440..d4029ed83 100644 --- a/lib/filesystem/MinizipExtensions.h +++ b/lib/filesystem/MinizipExtensions.h @@ -18,6 +18,9 @@ #include "../minizip/zip.h" #include "../minizip/ioapi.h" #endif + +VCMI_LIB_NAMESPACE_BEGIN + class CInputStream; class CInputOutputStream; class CMemoryBuffer; @@ -85,3 +88,5 @@ private: static int ZCALLBACK errorFileProxy(voidpf opaque, voidpf stream); }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/ResourceID.cpp b/lib/filesystem/ResourceID.cpp index 7b70d960c..63f61afca 100644 --- a/lib/filesystem/ResourceID.cpp +++ b/lib/filesystem/ResourceID.cpp @@ -11,6 +11,8 @@ #include "ResourceID.h" #include "FileInfo.h" +VCMI_LIB_NAMESPACE_BEGIN + // trivial to_upper that completely ignores localization and only work with ASCII // Technically not a problem since // 1) Right now VCMI does not supports unicode in filenames on Win @@ -205,3 +207,5 @@ std::string EResTypeHelper::getEResTypeAsString(EResType::Type type) return iter->second; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/ResourceID.h b/lib/filesystem/ResourceID.h index 4310b5911..d30fb4288 100644 --- a/lib/filesystem/ResourceID.h +++ b/lib/filesystem/ResourceID.h @@ -9,6 +9,8 @@ */ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + /** * Specifies the resource type. @@ -114,19 +116,6 @@ private: std::string name; }; -namespace std -{ - template <> struct hash - { - size_t operator()(const ResourceID & resourceIdent) const - { - std::hash intHasher; - std::hash stringHasher; - return stringHasher(resourceIdent.getName()) ^ intHasher(static_cast(resourceIdent.getType())); - } - }; -} - /** * A helper class which provides a functionality to convert extension strings to EResTypes. */ @@ -149,3 +138,16 @@ public: */ static std::string getEResTypeAsString(EResType::Type type); }; + +VCMI_LIB_NAMESPACE_END + + +template <> struct std::hash +{ + size_t operator()(const VCMI_LIB_WRAP_NAMESPACE(ResourceID) & resourceIdent) const + { + std::hash intHasher; + std::hash stringHasher; + return stringHasher(resourceIdent.getName()) ^ intHasher(static_cast(resourceIdent.getType())); + } +}; diff --git a/lib/int3.h b/lib/int3.h index d8861e314..b77e508b4 100644 --- a/lib/int3.h +++ b/lib/int3.h @@ -9,6 +9,8 @@ */ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + /// Class which consists of three integer values. Represents position on adventure map. class int3 { @@ -216,3 +218,5 @@ int3 findClosestTile (Container & container, int3 dest) } return result; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/logging/CBasicLogConfigurator.cpp b/lib/logging/CBasicLogConfigurator.cpp index 94e37b17d..727386bf0 100644 --- a/lib/logging/CBasicLogConfigurator.cpp +++ b/lib/logging/CBasicLogConfigurator.cpp @@ -13,6 +13,8 @@ #include "../CConfigHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + CBasicLogConfigurator::CBasicLogConfigurator(boost::filesystem::path filePath, CConsoleHandler * const console) : filePath(std::move(filePath)), console(console), appendToLogFile(false) {} @@ -147,3 +149,5 @@ void CBasicLogConfigurator::deconfigure() if(l != nullptr) l->clearTargets(); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/logging/CBasicLogConfigurator.h b/lib/logging/CBasicLogConfigurator.h index df0bfe587..ba96f3d3f 100644 --- a/lib/logging/CBasicLogConfigurator.h +++ b/lib/logging/CBasicLogConfigurator.h @@ -12,6 +12,8 @@ #include "../CConsoleHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + class CConsoleHandler; class JsonNode; @@ -45,3 +47,5 @@ private: CConsoleHandler * console; bool appendToLogFile; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/logging/CLogger.cpp b/lib/logging/CLogger.cpp index fa30eea09..9799c4bb5 100644 --- a/lib/logging/CLogger.cpp +++ b/lib/logging/CLogger.cpp @@ -37,6 +37,8 @@ extern "C" { } #endif +VCMI_LIB_NAMESPACE_BEGIN + namespace vstd { @@ -447,3 +449,5 @@ CLogFileTarget::~CLogFileTarget() { file.close(); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/logging/CLogger.h b/lib/logging/CLogger.h index d2a15fb39..4f5ee2773 100644 --- a/lib/logging/CLogger.h +++ b/lib/logging/CLogger.h @@ -12,6 +12,8 @@ #include "../CConsoleHandler.h" #include "../filesystem/FileStream.h" +VCMI_LIB_NAMESPACE_BEGIN + class CLogger; struct LogRecord; class ILogTarget; @@ -225,3 +227,5 @@ private: CLogFormatter formatter; mutable boost::mutex mx; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CArmedInstance.cpp b/lib/mapObjects/CArmedInstance.cpp index 5d23e8ef4..e98b4b719 100644 --- a/lib/mapObjects/CArmedInstance.cpp +++ b/lib/mapObjects/CArmedInstance.cpp @@ -17,6 +17,8 @@ #include "../CGameState.h" #include "../CPlayerState.h" +VCMI_LIB_NAMESPACE_BEGIN + void CArmedInstance::randomizeArmy(int type) { for (auto & elem : stacks) @@ -152,3 +154,5 @@ CBonusSystemNode * CArmedInstance::whatShouldBeAttached() { return this; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CArmedInstance.h b/lib/mapObjects/CArmedInstance.h index a17a3998e..559e94e51 100644 --- a/lib/mapObjects/CArmedInstance.h +++ b/lib/mapObjects/CArmedInstance.h @@ -1,4 +1,4 @@ -/* +/* * CArmedInstance.h, part of VCMI engine * * Authors: listed in file AUTHORS in main folder @@ -12,6 +12,8 @@ #include "CObjectHandler.h" #include "../CCreatureSet.h" +VCMI_LIB_NAMESPACE_BEGIN + class BattleInfo; class CGameState; @@ -50,3 +52,5 @@ public: h & static_cast(*this); } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CBank.cpp b/lib/mapObjects/CBank.cpp index 69e4d6459..7cbe050b1 100644 --- a/lib/mapObjects/CBank.cpp +++ b/lib/mapObjects/CBank.cpp @@ -1,4 +1,4 @@ -/* +/* * CBank.cpp, part of VCMI engine * * Authors: listed in file AUTHORS in main folder @@ -21,6 +21,8 @@ #include "../IGameCallback.h" #include "../CGameState.h" +VCMI_LIB_NAMESPACE_BEGIN + ///helpers static std::string & visitedTxt(const bool visited) { @@ -351,3 +353,5 @@ void CBank::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) cons doVisit(hero); } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CBank.h b/lib/mapObjects/CBank.h index c274fe653..22819005a 100644 --- a/lib/mapObjects/CBank.h +++ b/lib/mapObjects/CBank.h @@ -1,4 +1,4 @@ -/* +/* * CBank.h, part of VCMI engine * * Authors: listed in file AUTHORS in main folder @@ -12,6 +12,8 @@ #include "CObjectHandler.h" #include "CArmedInstance.h" +VCMI_LIB_NAMESPACE_BEGIN + struct BankConfig; class CBankInstanceConstructor; @@ -48,3 +50,5 @@ public: friend class CBankInstanceConstructor; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CGHeroInstance.cpp b/lib/mapObjects/CGHeroInstance.cpp index 903de00dd..743af6b32 100644 --- a/lib/mapObjects/CGHeroInstance.cpp +++ b/lib/mapObjects/CGHeroInstance.cpp @@ -32,6 +32,8 @@ #include "../StringConstants.h" #include "../battle/Unit.h" +VCMI_LIB_NAMESPACE_BEGIN + ///helpers static void showInfoDialog(const PlayerColor playerID, const ui32 txtID, const ui16 soundID = 0) @@ -1642,3 +1644,5 @@ bool CGHeroInstance::isMissionCritical() const } return false; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CGHeroInstance.h b/lib/mapObjects/CGHeroInstance.h index ea88e41b9..61a50aed0 100644 --- a/lib/mapObjects/CGHeroInstance.h +++ b/lib/mapObjects/CGHeroInstance.h @@ -17,6 +17,8 @@ #include "../CArtHandler.h" // For CArtifactSet #include "../CRandomGenerator.h" +VCMI_LIB_NAMESPACE_BEGIN + class CHero; class CGBoat; class CGTownInstance; @@ -315,3 +317,5 @@ public: BONUS_TREE_DESERIALIZATION_FIX } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CGMarket.cpp b/lib/mapObjects/CGMarket.cpp index 81f7150c9..95687a963 100644 --- a/lib/mapObjects/CGMarket.cpp +++ b/lib/mapObjects/CGMarket.cpp @@ -20,6 +20,8 @@ #include "../CModHandler.h" #include "../CSkillHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + ///helpers static void openWindow(const OpenWindow::EWindow type, const int id1, const int id2 = -1) { @@ -339,3 +341,5 @@ void CGUniversity::onHeroVisit(const CGHeroInstance * h) const { openWindow(OpenWindow::UNIVERSITY_WINDOW,id.getNum(),h->id.getNum()); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CGMarket.h b/lib/mapObjects/CGMarket.h index bdf7cba71..4697179d8 100644 --- a/lib/mapObjects/CGMarket.h +++ b/lib/mapObjects/CGMarket.h @@ -1,4 +1,4 @@ -/* +/* * CGMarket.h, part of VCMI engine * * Authors: listed in file AUTHORS in main folder @@ -11,6 +11,8 @@ #include "CObjectHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + class DLL_LINKAGE IMarket { public: @@ -85,3 +87,5 @@ public: h & skills; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CGPandoraBox.cpp b/lib/mapObjects/CGPandoraBox.cpp index c07de1358..e04dfa377 100644 --- a/lib/mapObjects/CGPandoraBox.cpp +++ b/lib/mapObjects/CGPandoraBox.cpp @@ -1,4 +1,4 @@ -/* +/* * CGPandoraBox.cpp, part of VCMI engine * * Authors: listed in file AUTHORS in main folder @@ -23,6 +23,8 @@ #include "../StringConstants.h" #include "../serializer/JsonSerializeFormat.h" +VCMI_LIB_NAMESPACE_BEGIN + ///helpers static void showInfoDialog(const PlayerColor playerID, const ui32 txtID, const ui16 soundID) { @@ -530,3 +532,5 @@ void CGEvent::serializeJsonOptions(JsonSerializeFormat & handler) handler.serializeIdArray("availableFor", availableFor, GameConstants::ALL_PLAYERS, decodePlayer, encodePlayer); } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CGPandoraBox.h b/lib/mapObjects/CGPandoraBox.h index 3af409e0c..d525bf279 100644 --- a/lib/mapObjects/CGPandoraBox.h +++ b/lib/mapObjects/CGPandoraBox.h @@ -1,4 +1,4 @@ -/* +/* * CGPandoraBox.h, part of VCMI engine * * Authors: listed in file AUTHORS in main folder @@ -13,6 +13,8 @@ #include "CArmedInstance.h" #include "../ResourceSet.h" +VCMI_LIB_NAMESPACE_BEGIN + struct InfoWindow; class DLL_LINKAGE CGPandoraBox : public CArmedInstance @@ -93,3 +95,5 @@ private: void activated(const CGHeroInstance * h) const; void afterSuccessfulVisit() const override; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CGTownInstance.cpp b/lib/mapObjects/CGTownInstance.cpp index 42cd5c2d2..a9d7dedbb 100644 --- a/lib/mapObjects/CGTownInstance.cpp +++ b/lib/mapObjects/CGTownInstance.cpp @@ -23,6 +23,8 @@ #include "../serializer/JsonSerializeFormat.h" #include "../HeroBonus.h" +VCMI_LIB_NAMESPACE_BEGIN + std::vector CGTownInstance::merchantArtifacts; std::vector CGTownInstance::universitySkills; @@ -1867,3 +1869,5 @@ const std::string CGTownBuilding::getCustomBonusGreeting(const Bonus & bonus) co std::string greeting = fmt.str(); return greeting; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CGTownInstance.h b/lib/mapObjects/CGTownInstance.h index fea47b1a4..0d261f2af 100644 --- a/lib/mapObjects/CGTownInstance.h +++ b/lib/mapObjects/CGTownInstance.h @@ -15,6 +15,8 @@ #include "../CTownHandler.h" // For CTown +VCMI_LIB_NAMESPACE_BEGIN + class CCastleEvent; class CGTownInstance; class CGDwelling; @@ -365,3 +367,5 @@ private: void initOverriddenBids(); void addTownBonuses(); }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CObjectClassesHandler.cpp b/lib/mapObjects/CObjectClassesHandler.cpp index 4a3e8ad12..03ed19e24 100644 --- a/lib/mapObjects/CObjectClassesHandler.cpp +++ b/lib/mapObjects/CObjectClassesHandler.cpp @@ -24,6 +24,8 @@ #include "CommonConstructors.h" #include "MapObjects.h" +VCMI_LIB_NAMESPACE_BEGIN + // FIXME: move into inheritNode? static void inheritNodeWithMeta(JsonNode & descendant, const JsonNode & base) { @@ -627,3 +629,5 @@ bool AObjectTypeHandler::isStaticObject() void AObjectTypeHandler::afterLoadFinalization() { } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CObjectClassesHandler.h b/lib/mapObjects/CObjectClassesHandler.h index cff16a715..af7099b6a 100644 --- a/lib/mapObjects/CObjectClassesHandler.h +++ b/lib/mapObjects/CObjectClassesHandler.h @@ -17,6 +17,8 @@ #include "../JsonNode.h" #include "Terrain.h" +VCMI_LIB_NAMESPACE_BEGIN + class JsonNode; class CRandomGenerator; @@ -320,3 +322,5 @@ public: h & objects; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CObjectHandler.cpp b/lib/mapObjects/CObjectHandler.cpp index 35904fb65..0dc476d61 100644 --- a/lib/mapObjects/CObjectHandler.cpp +++ b/lib/mapObjects/CObjectHandler.cpp @@ -26,6 +26,8 @@ #include "../serializer/JsonSerializeFormat.h" +VCMI_LIB_NAMESPACE_BEGIN + IGameCallback * IObjectInterface::cb = nullptr; ///helpers @@ -524,3 +526,5 @@ const IShipyard * IShipyard::castFrom( const CGObjectInstance *obj ) { return castFrom(const_cast(obj)); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CObjectHandler.h b/lib/mapObjects/CObjectHandler.h index 1afa229a6..387020f72 100644 --- a/lib/mapObjects/CObjectHandler.h +++ b/lib/mapObjects/CObjectHandler.h @@ -15,6 +15,8 @@ #include "../int3.h" #include "../HeroBonus.h" +VCMI_LIB_NAMESPACE_BEGIN + class CGHeroInstance; class IGameCallback; class CGObjectInstance; @@ -255,3 +257,5 @@ public: h & resVals; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CQuest.cpp b/lib/mapObjects/CQuest.cpp index 53e0dd43d..f22327ed7 100644 --- a/lib/mapObjects/CQuest.cpp +++ b/lib/mapObjects/CQuest.cpp @@ -28,6 +28,8 @@ #include "../CSkillHandler.h" #include "../mapping/CMap.h" +VCMI_LIB_NAMESPACE_BEGIN + std::map > CGKeys::playerKeyMap; @@ -1172,3 +1174,5 @@ bool CGBorderGate::passableFor(PlayerColor color) const { return wasMyColorVisited(color); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CQuest.h b/lib/mapObjects/CQuest.h index 3fff59254..a2cb8b75f 100644 --- a/lib/mapObjects/CQuest.h +++ b/lib/mapObjects/CQuest.h @@ -15,6 +15,8 @@ #include "../CCreatureSet.h" #include "../NetPacksBase.h" +VCMI_LIB_NAMESPACE_BEGIN + class CGCreature; class DLL_LINKAGE CQuest @@ -239,3 +241,5 @@ public: h & static_cast(*this); //need to serialize or object will be empty } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CRewardableConstructor.cpp b/lib/mapObjects/CRewardableConstructor.cpp index dbe59e68e..4a6442eb7 100644 --- a/lib/mapObjects/CRewardableConstructor.cpp +++ b/lib/mapObjects/CRewardableConstructor.cpp @@ -16,6 +16,8 @@ #include "JsonRandom.h" #include "../IGameCallback.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace { MetaString loadMessage(const JsonNode & value) { @@ -220,3 +222,5 @@ std::unique_ptr CRewardableConstructor::getObjectInfo(std::shared_p { return std::unique_ptr(new CRandomRewardObjectInfo(objectInfo)); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CRewardableConstructor.h b/lib/mapObjects/CRewardableConstructor.h index 4157ae7cb..7dee06f27 100644 --- a/lib/mapObjects/CRewardableConstructor.h +++ b/lib/mapObjects/CRewardableConstructor.h @@ -14,6 +14,8 @@ #include "../JsonNode.h" +VCMI_LIB_NAMESPACE_BEGIN + class DLL_LINKAGE CRandomRewardObjectInfo : public IObjectInfo { JsonNode parameters; @@ -55,3 +57,5 @@ public: std::unique_ptr getObjectInfo(std::shared_ptr tmpl) const override; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CRewardableObject.cpp b/lib/mapObjects/CRewardableObject.cpp index 34b57072d..8e78fc8e3 100644 --- a/lib/mapObjects/CRewardableObject.cpp +++ b/lib/mapObjects/CRewardableObject.cpp @@ -20,6 +20,8 @@ #include "CObjectClassesHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + bool CRewardLimiter::heroAllowed(const CGHeroInstance * hero) const { if(dayOfWeek != 0) @@ -1163,3 +1165,5 @@ std::vector CGMagicSpring::getAvailableRewards(const CGHeroInstance * hero // hero is either not on visitable tile (should not happen) or tile is already used return std::vector(); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CRewardableObject.h b/lib/mapObjects/CRewardableObject.h index a259153ea..60ab5e386 100644 --- a/lib/mapObjects/CRewardableObject.h +++ b/lib/mapObjects/CRewardableObject.h @@ -15,6 +15,8 @@ #include "../NetPacksBase.h" #include "../ResourceSet.h" +VCMI_LIB_NAMESPACE_BEGIN + class CRandomRewardObjectInfo; /// Limiters of rewards. Rewards will be granted to hero only if he satisfies requirements @@ -403,3 +405,5 @@ public: // class DLL_LINKAGE CGSignBottle : public CGObjectInstance //signs and ocean bottles // class DLL_LINKAGE CGWitchHut : public CPlayersVisited // class DLL_LINKAGE CGScholar : public CGObjectInstance + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CommonConstructors.cpp b/lib/mapObjects/CommonConstructors.cpp index 3b870847a..a7d39bb0d 100644 --- a/lib/mapObjects/CommonConstructors.cpp +++ b/lib/mapObjects/CommonConstructors.cpp @@ -20,6 +20,8 @@ #include "../CModHandler.h" #include "../IGameCallback.h" +VCMI_LIB_NAMESPACE_BEGIN + CObstacleConstructor::CObstacleConstructor() { } @@ -498,3 +500,5 @@ std::unique_ptr CBankInstanceConstructor::getObjectInfo(std::shared { return std::unique_ptr(new CBankInfo(levels)); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/CommonConstructors.h b/lib/mapObjects/CommonConstructors.h index 605ad429c..98b3e623b 100644 --- a/lib/mapObjects/CommonConstructors.h +++ b/lib/mapObjects/CommonConstructors.h @@ -13,6 +13,8 @@ #include "../CTownHandler.h" // for building ID-based filters #include "MapObjects.h" +VCMI_LIB_NAMESPACE_BEGIN + class CGObjectInstance; class CGTownInstance; class CGHeroInstance; @@ -233,3 +235,5 @@ public: h & static_cast&>(*this); } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/JsonRandom.cpp b/lib/mapObjects/JsonRandom.cpp index aecba04a9..b2d10559d 100644 --- a/lib/mapObjects/JsonRandom.cpp +++ b/lib/mapObjects/JsonRandom.cpp @@ -21,6 +21,8 @@ #include "../CCreatureSet.h" #include "../spells/CSpellHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace JsonRandom { si32 loadValue(const JsonNode & value, CRandomGenerator & rng, si32 defaultValue) @@ -225,3 +227,5 @@ namespace JsonRandom } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/JsonRandom.h b/lib/mapObjects/JsonRandom.h index 8eaf085fb..0ed636aae 100644 --- a/lib/mapObjects/JsonRandom.h +++ b/lib/mapObjects/JsonRandom.h @@ -12,6 +12,8 @@ #include "../GameConstants.h" #include "../ResourceSet.h" +VCMI_LIB_NAMESPACE_BEGIN + class JsonNode; typedef std::vector JsonVector; class CRandomGenerator; @@ -47,3 +49,5 @@ namespace JsonRandom DLL_LINKAGE std::vector loadBonuses(const JsonNode & value); //DLL_LINKAGE std::vector loadComponents(const JsonNode & value); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/MiscObjects.cpp b/lib/mapObjects/MiscObjects.cpp index 741ad4ba9..cd9b5a620 100644 --- a/lib/mapObjects/MiscObjects.cpp +++ b/lib/mapObjects/MiscObjects.cpp @@ -26,6 +26,8 @@ #include "../CPlayerState.h" #include "../serializer/JsonSerializeFormat.h" +VCMI_LIB_NAMESPACE_BEGIN + std::map > CGMagi::eyelist; ui8 CGObelisk::obeliskCount = 0; //how many obelisks are on map std::map CGObelisk::visited; //map: team_id => how many obelisks has been visited @@ -2207,4 +2209,6 @@ void CGLighthouse::giveBonusTo(PlayerColor player, bool onInit) const void CGLighthouse::serializeJsonOptions(JsonSerializeFormat& handler) { serializeJsonOwner(handler); -} \ No newline at end of file +} + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/MiscObjects.h b/lib/mapObjects/MiscObjects.h index 8949debeb..9eeeee41e 100644 --- a/lib/mapObjects/MiscObjects.h +++ b/lib/mapObjects/MiscObjects.h @@ -13,6 +13,8 @@ #include "CArmedInstance.h" #include "../ResourceSet.h" +VCMI_LIB_NAMESPACE_BEGIN + class CMap; /// Legacy class, use CRewardableObject instead @@ -541,3 +543,5 @@ public: return true; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/ObjectTemplate.cpp b/lib/mapObjects/ObjectTemplate.cpp index 40f9693df..3eb23cd86 100644 --- a/lib/mapObjects/ObjectTemplate.cpp +++ b/lib/mapObjects/ObjectTemplate.cpp @@ -23,6 +23,8 @@ #include "CRewardableConstructor.h" +VCMI_LIB_NAMESPACE_BEGIN + static bool isOnVisitableFromTopList(int identifier, int type) { if(type == 2 || type == 3 || type == 4 || type == 5) //creature, hero, artifact, resource @@ -572,3 +574,4 @@ void ObjectTemplate::recalculate() calculateVisitableOffset(); } +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapObjects/ObjectTemplate.h b/lib/mapObjects/ObjectTemplate.h index e10f1efad..24a219ac0 100644 --- a/lib/mapObjects/ObjectTemplate.h +++ b/lib/mapObjects/ObjectTemplate.h @@ -12,6 +12,8 @@ #include "../GameConstants.h" #include "../int3.h" +VCMI_LIB_NAMESPACE_BEGIN + class CBinaryReader; class CLegacyConfigParser; class JsonNode; @@ -153,3 +155,5 @@ public: } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/CCampaignHandler.cpp b/lib/mapping/CCampaignHandler.cpp index 71c130383..60918e0b3 100644 --- a/lib/mapping/CCampaignHandler.cpp +++ b/lib/mapping/CCampaignHandler.cpp @@ -30,6 +30,8 @@ #include "serializer/JsonDeserializer.h" #include "serializer/JsonSerializer.h" +VCMI_LIB_NAMESPACE_BEGIN + CCampaignHeader::CCampaignHeader() : version(0), mapVersion(0), difficultyChoosenByPlayer(0), music(0), filename(), loadFromLod(0) { @@ -562,3 +564,5 @@ std::string CCampaignHandler::prologVoiceName(ui8 index) + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/CCampaignHandler.h b/lib/mapping/CCampaignHandler.h index 1e3e923c1..ebd11d459 100644 --- a/lib/mapping/CCampaignHandler.h +++ b/lib/mapping/CCampaignHandler.h @@ -11,6 +11,8 @@ #include "../../lib/GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + struct StartInfo; class CGHeroInstance; class CBinaryReader; @@ -242,3 +244,5 @@ public: static std::unique_ptr getCampaign(const std::string & name); //name - name of appropriate file }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/CDrawRoadsOperation.cpp b/lib/mapping/CDrawRoadsOperation.cpp index d0dd1fff9..c7bd1d6e6 100644 --- a/lib/mapping/CDrawRoadsOperation.cpp +++ b/lib/mapping/CDrawRoadsOperation.cpp @@ -12,6 +12,8 @@ #include "CDrawRoadsOperation.h" #include "CMap.h" +VCMI_LIB_NAMESPACE_BEGIN + const std::vector CDrawLinesOperation::patterns = { //single tile. fall-back pattern @@ -389,3 +391,5 @@ void CDrawRiversOperation::updateTile(TerrainTile & tile, const LinePattern & pa tile.riverDir = gen->nextInt(mapping.first, mapping.second); tile.extTileFlags = (tile.extTileFlags & 0b00111111) | (flip << 2); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/CDrawRoadsOperation.h b/lib/mapping/CDrawRoadsOperation.h index b283c5dc8..67c9bb0ff 100644 --- a/lib/mapping/CDrawRoadsOperation.h +++ b/lib/mapping/CDrawRoadsOperation.h @@ -13,6 +13,8 @@ #include "../CRandomGenerator.h" #include "CMapEditManager.h" +VCMI_LIB_NAMESPACE_BEGIN + struct TerrainTile; class CDrawLinesOperation : public CMapOperation @@ -91,3 +93,5 @@ protected: private: std::string riverType; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/CMap.cpp b/lib/mapping/CMap.cpp index 742e709a8..fa0037f48 100644 --- a/lib/mapping/CMap.cpp +++ b/lib/mapping/CMap.cpp @@ -23,6 +23,8 @@ #include "CMapEditManager.h" #include "../serializer/JsonSerializeFormat.h" +VCMI_LIB_NAMESPACE_BEGIN + SHeroName::SHeroName() : heroId(-1) { @@ -713,3 +715,5 @@ void CMap::resetStaticData() CGObelisk::reset(); CGTownInstance::reset(); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/CMap.h b/lib/mapping/CMap.h index 1c1ae34db..e32d47ab6 100644 --- a/lib/mapping/CMap.h +++ b/lib/mapping/CMap.h @@ -20,6 +20,8 @@ #include "../LogicalExpression.h" #include "CMapDefines.h" +VCMI_LIB_NAMESPACE_BEGIN + class CArtifactInstance; class CGObjectInstance; class CGHeroInstance; @@ -496,3 +498,5 @@ public: h & instanceNames; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/CMapDefines.h b/lib/mapping/CMapDefines.h index dbaf97f30..9e55436a1 100644 --- a/lib/mapping/CMapDefines.h +++ b/lib/mapping/CMapDefines.h @@ -10,6 +10,8 @@ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + /// The map event is an event which e.g. gives or takes resources of a specific /// amount to/from players and can appear regularly or once a time. class DLL_LINKAGE CMapEvent @@ -111,3 +113,5 @@ struct DLL_LINKAGE TerrainTile h & blockingObjects; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/CMapEditManager.cpp b/lib/mapping/CMapEditManager.cpp index 2f8d44af9..ba8ab5d59 100644 --- a/lib/mapping/CMapEditManager.cpp +++ b/lib/mapping/CMapEditManager.cpp @@ -18,6 +18,8 @@ #include "../mapping/CMap.h" #include "CMapOperation.h" +VCMI_LIB_NAMESPACE_BEGIN + CMapUndoManager::CMapUndoManager() : undoRedoLimit(100000), //not sure if we ever need to bother about undo limit undoCallback([](bool, bool) {}) @@ -199,3 +201,5 @@ CMapUndoManager & CMapEditManager::getUndoManager() { return undoManager; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/CMapEditManager.h b/lib/mapping/CMapEditManager.h index 7fe216d16..7ce123e8a 100644 --- a/lib/mapping/CMapEditManager.h +++ b/lib/mapping/CMapEditManager.h @@ -14,6 +14,8 @@ #include "CMapOperation.h" #include "Terrain.h" +VCMI_LIB_NAMESPACE_BEGIN + class CGObjectInstance; class CTerrainViewPatternConfig; struct TerrainViewPattern; @@ -98,3 +100,5 @@ private: CTerrainSelection terrainSel; CObjectSelection objectSel; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/CMapInfo.cpp b/lib/mapping/CMapInfo.cpp index 25b6a78b8..3756ae580 100644 --- a/lib/mapping/CMapInfo.cpp +++ b/lib/mapping/CMapInfo.cpp @@ -23,6 +23,8 @@ #include "../CHeroHandler.h" #include "../CModHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + CMapInfo::CMapInfo() : scenarioOptionsOfSave(nullptr), amountOfPlayersOnMap(0), amountOfHumanControllablePlayers(0), amountOfHumanPlayersInSave(0), isRandomMap(false) { @@ -182,3 +184,5 @@ std::string CMapInfo::getMapSizeName() const return "C"; } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/CMapInfo.h b/lib/mapping/CMapInfo.h index c04058bd9..69c4e96de 100644 --- a/lib/mapping/CMapInfo.h +++ b/lib/mapping/CMapInfo.h @@ -20,6 +20,8 @@ #include "CMap.h" #include "CCampaignHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + struct StartInfo; /** @@ -69,3 +71,5 @@ public: h & isRandomMap; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/CMapOperation.cpp b/lib/mapping/CMapOperation.cpp index 4e00496c1..c89a5518d 100644 --- a/lib/mapping/CMapOperation.cpp +++ b/lib/mapping/CMapOperation.cpp @@ -13,7 +13,9 @@ #include "../VCMI_Lib.h" #include "CMap.h" -#include "MapEditUtils.h" +#include "MapEditUtils.h" + +VCMI_LIB_NAMESPACE_BEGIN CMapOperation::CMapOperation(CMap* map) : map(map) { @@ -672,3 +674,5 @@ std::string CRemoveObjectOperation::getLabel() const { return "Remove Object"; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/CMapOperation.h b/lib/mapping/CMapOperation.h index 921832470..2121e9fad 100644 --- a/lib/mapping/CMapOperation.h +++ b/lib/mapping/CMapOperation.h @@ -13,6 +13,8 @@ #include "../int3.h" #include "MapEditUtils.h" +VCMI_LIB_NAMESPACE_BEGIN + class CGObjectInstance; class CMap; class CRandomGenerator; @@ -158,4 +160,6 @@ public: private: CGObjectInstance* obj; -}; \ No newline at end of file +}; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/CMapService.cpp b/lib/mapping/CMapService.cpp index 4c27ed957..2ad1c8430 100644 --- a/lib/mapping/CMapService.cpp +++ b/lib/mapping/CMapService.cpp @@ -21,6 +21,8 @@ #include "MapFormatH3M.h" #include "MapFormatJson.h" +VCMI_LIB_NAMESPACE_BEGIN + std::unique_ptr CMapService::loadMap(const ResourceID & name) const { @@ -138,3 +140,5 @@ std::unique_ptr CMapService::getMapPatcher(std::string scenarioName logGlobal->debug("Request to patch map %s", scenarioName); return std::unique_ptr(new CMapPatcher(node[scenarioName])); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/CMapService.h b/lib/mapping/CMapService.h index f0882640f..98aac2a4c 100644 --- a/lib/mapping/CMapService.h +++ b/lib/mapping/CMapService.h @@ -10,6 +10,8 @@ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + class ResourceID; class CMap; @@ -171,3 +173,5 @@ public: virtual ~IMapSaver(){} }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/MapEditUtils.cpp b/lib/mapping/MapEditUtils.cpp index 489954356..2d1b491f6 100644 --- a/lib/mapping/MapEditUtils.cpp +++ b/lib/mapping/MapEditUtils.cpp @@ -16,6 +16,8 @@ #include "CMap.h" #include "CMapOperation.h" +VCMI_LIB_NAMESPACE_BEGIN + MapRect::MapRect() : x(0), y(0), z(0), width(0), height(0) { @@ -369,3 +371,5 @@ void CTerrainViewPatternUtils::printDebuggingInfoAboutTile(const CMap * map, int logGlobal->debug(line); } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/MapEditUtils.h b/lib/mapping/MapEditUtils.h index 6df777a3d..d2f35781a 100644 --- a/lib/mapping/MapEditUtils.h +++ b/lib/mapping/MapEditUtils.h @@ -14,6 +14,8 @@ #include "../CRandomGenerator.h" #include "Terrain.h" +VCMI_LIB_NAMESPACE_BEGIN + class CGObjectInstance; class CMap; @@ -231,3 +233,5 @@ class DLL_LINKAGE CTerrainViewPatternUtils public: static void printDebuggingInfoAboutTile(const CMap * map, int3 pos); }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/MapFormatH3M.cpp b/lib/mapping/MapFormatH3M.cpp index 26faf348b..fdd35b68a 100644 --- a/lib/mapping/MapFormatH3M.cpp +++ b/lib/mapping/MapFormatH3M.cpp @@ -26,6 +26,8 @@ #include "../VCMI_Lib.h" #include "../NetPacksBase.h" +VCMI_LIB_NAMESPACE_BEGIN + const bool CMapLoaderH3M::IS_PROFILING_ENABLED = false; @@ -2266,3 +2268,5 @@ void CMapLoaderH3M::afterRead() } } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/MapFormatH3M.h b/lib/mapping/MapFormatH3M.h index 1a71f2d1d..908cef1a7 100644 --- a/lib/mapping/MapFormatH3M.h +++ b/lib/mapping/MapFormatH3M.h @@ -19,6 +19,8 @@ #include "../filesystem/CBinaryReader.h" +VCMI_LIB_NAMESPACE_BEGIN + class CGHeroInstance; class CArtifactInstance; class CGObjectInstance; @@ -260,3 +262,5 @@ private: CInputStream * inputStream; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/MapFormatJson.cpp b/lib/mapping/MapFormatJson.cpp index e14de101b..f06a84ce3 100644 --- a/lib/mapping/MapFormatJson.cpp +++ b/lib/mapping/MapFormatJson.cpp @@ -30,6 +30,8 @@ #include "../serializer/JsonDeserializer.h" #include "../serializer/JsonSerializer.h" +VCMI_LIB_NAMESPACE_BEGIN + class MapObjectResolver: public IInstanceResolver { public: @@ -1364,3 +1366,5 @@ void CMapSaverJson::writeObjects() addToArchive(data, OBJECTS_FILE_NAME); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/MapFormatJson.h b/lib/mapping/MapFormatJson.h index 4dc36df5a..149984e63 100644 --- a/lib/mapping/MapFormatJson.h +++ b/lib/mapping/MapFormatJson.h @@ -19,6 +19,8 @@ #include "../serializer/JsonSerializeFormat.h" +VCMI_LIB_NAMESPACE_BEGIN + struct TriggeredEvent; struct TerrainTile; struct PlayerInfo; @@ -265,3 +267,5 @@ private: std::shared_ptr ioApi; CZipSaver saver;///< object to handle zip archive operations }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/registerTypes/RegisterTypes.cpp b/lib/registerTypes/RegisterTypes.cpp index a3db27100..94b8436e5 100644 --- a/lib/registerTypes/RegisterTypes.cpp +++ b/lib/registerTypes/RegisterTypes.cpp @@ -24,6 +24,8 @@ #include "../serializer/BinarySerializer.h" #include "../serializer/CTypeList.h" +VCMI_LIB_NAMESPACE_BEGIN + // For reference: peak memory usage by gcc during compilation of register type templates // registerTypesMapObjects: 1.9 Gb // registerTypes2: 2.2 Gb @@ -49,3 +51,5 @@ DEFINE_EXTERNAL_METHOD(registerTypesLobbyPacks) template void registerTypes(BinaryDeserializer & s); template void registerTypes(BinarySerializer & s); template void registerTypes(CTypeList & s); + +VCMI_LIB_NAMESPACE_END diff --git a/lib/registerTypes/RegisterTypes.h b/lib/registerTypes/RegisterTypes.h index 17e46c54c..f50fac623 100644 --- a/lib/registerTypes/RegisterTypes.h +++ b/lib/registerTypes/RegisterTypes.h @@ -24,6 +24,8 @@ #include "../battle/CObstacleInstance.h" #include "../CStack.h" +VCMI_LIB_NAMESPACE_BEGIN + class BinarySerializer; class BinaryDeserializer; class CTypeList; @@ -408,3 +410,5 @@ extern template DLL_LINKAGE void registerTypes(CTypeList & s); #endif + +VCMI_LIB_NAMESPACE_END diff --git a/lib/registerTypes/TypesClientPacks1.cpp b/lib/registerTypes/TypesClientPacks1.cpp index 3044df426..305f53e56 100644 --- a/lib/registerTypes/TypesClientPacks1.cpp +++ b/lib/registerTypes/TypesClientPacks1.cpp @@ -29,7 +29,11 @@ #include "../serializer/BinarySerializer.h" #include "../serializer/CTypeList.h" +VCMI_LIB_NAMESPACE_BEGIN + template void registerTypesClientPacks1(BinaryDeserializer & s); template void registerTypesClientPacks1(BinarySerializer & s); template void registerTypesClientPacks1(CTypeList & s); + +VCMI_LIB_NAMESPACE_END diff --git a/lib/registerTypes/TypesClientPacks2.cpp b/lib/registerTypes/TypesClientPacks2.cpp index 4a6dd9b30..5d8400b80 100644 --- a/lib/registerTypes/TypesClientPacks2.cpp +++ b/lib/registerTypes/TypesClientPacks2.cpp @@ -31,9 +31,13 @@ #include "../serializer/BinarySerializer.h" #include "../serializer/CTypeList.h" +VCMI_LIB_NAMESPACE_BEGIN + template void registerTypesClientPacks2(BinaryDeserializer & s); template void registerTypesClientPacks2(BinarySerializer & s); template void registerTypesClientPacks2(CTypeList & s); + +VCMI_LIB_NAMESPACE_END diff --git a/lib/registerTypes/TypesLobbyPacks.cpp b/lib/registerTypes/TypesLobbyPacks.cpp index e7360a6e3..3a65eb231 100644 --- a/lib/registerTypes/TypesLobbyPacks.cpp +++ b/lib/registerTypes/TypesLobbyPacks.cpp @@ -31,7 +31,11 @@ #include "../serializer/BinarySerializer.h" #include "../serializer/CTypeList.h" +VCMI_LIB_NAMESPACE_BEGIN + template void registerTypesLobbyPacks(BinaryDeserializer & s); template void registerTypesLobbyPacks(BinarySerializer & s); template void registerTypesLobbyPacks(CTypeList & s); + +VCMI_LIB_NAMESPACE_END diff --git a/lib/registerTypes/TypesMapObjects1.cpp b/lib/registerTypes/TypesMapObjects1.cpp index 7fc2e66b6..690248cd5 100644 --- a/lib/registerTypes/TypesMapObjects1.cpp +++ b/lib/registerTypes/TypesMapObjects1.cpp @@ -29,8 +29,12 @@ #include "../serializer/BinarySerializer.h" #include "../serializer/CTypeList.h" +VCMI_LIB_NAMESPACE_BEGIN + template void registerTypesMapObjects1(BinaryDeserializer & s); template void registerTypesMapObjects1(BinarySerializer & s); template void registerTypesMapObjects1(CTypeList & s); + +VCMI_LIB_NAMESPACE_END diff --git a/lib/registerTypes/TypesMapObjects2.cpp b/lib/registerTypes/TypesMapObjects2.cpp index 7a52f3764..cc3a05e47 100644 --- a/lib/registerTypes/TypesMapObjects2.cpp +++ b/lib/registerTypes/TypesMapObjects2.cpp @@ -31,8 +31,12 @@ #include "../serializer/BinarySerializer.h" #include "../serializer/CTypeList.h" +VCMI_LIB_NAMESPACE_BEGIN + template void registerTypesMapObjects2(BinaryDeserializer & s); template void registerTypesMapObjects2(BinarySerializer & s); template void registerTypesMapObjects2(CTypeList & s); + +VCMI_LIB_NAMESPACE_END diff --git a/lib/registerTypes/TypesMapObjects3.cpp b/lib/registerTypes/TypesMapObjects3.cpp index 03022ffb7..fbac38dc0 100644 --- a/lib/registerTypes/TypesMapObjects3.cpp +++ b/lib/registerTypes/TypesMapObjects3.cpp @@ -29,6 +29,10 @@ #include "../serializer/BinarySerializer.h" #include "../serializer/CTypeList.h" +VCMI_LIB_NAMESPACE_BEGIN + template void registerTypesMapObjectTypes(BinaryDeserializer & s); template void registerTypesMapObjectTypes(BinarySerializer & s); template void registerTypesMapObjectTypes(CTypeList & s); + +VCMI_LIB_NAMESPACE_END diff --git a/lib/registerTypes/TypesServerPacks.cpp b/lib/registerTypes/TypesServerPacks.cpp index 18f9e53e3..82d00d4f0 100644 --- a/lib/registerTypes/TypesServerPacks.cpp +++ b/lib/registerTypes/TypesServerPacks.cpp @@ -29,6 +29,10 @@ #include "../serializer/BinarySerializer.h" #include "../serializer/CTypeList.h" +VCMI_LIB_NAMESPACE_BEGIN + template void registerTypesServerPacks(BinaryDeserializer & s); template void registerTypesServerPacks(BinarySerializer & s); template void registerTypesServerPacks(CTypeList & s); + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/CMapGenOptions.cpp b/lib/rmg/CMapGenOptions.cpp index dfd8f4ec8..774f374d5 100644 --- a/lib/rmg/CMapGenOptions.cpp +++ b/lib/rmg/CMapGenOptions.cpp @@ -18,6 +18,8 @@ #include "../VCMI_Lib.h" #include "../CTownHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + CMapGenOptions::CMapGenOptions() : width(CMapHeader::MAP_SIZE_MIDDLE), height(CMapHeader::MAP_SIZE_MIDDLE), hasTwoLevels(true), playerCount(RANDOM_SIZE), teamCount(RANDOM_SIZE), compOnlyPlayerCount(RANDOM_SIZE), compOnlyTeamCount(RANDOM_SIZE), @@ -491,3 +493,5 @@ void CMapGenOptions::CPlayerSettings::setPlayerType(EPlayerType::EPlayerType val { playerType = value; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/CMapGenOptions.h b/lib/rmg/CMapGenOptions.h index 01c2f815f..9017576b1 100644 --- a/lib/rmg/CMapGenOptions.h +++ b/lib/rmg/CMapGenOptions.h @@ -12,6 +12,8 @@ #include "../GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + class CRmgTemplate; class CRandomGenerator; @@ -188,3 +190,5 @@ public: //TODO add name of template to class, enables selection of a template by a user } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/CMapGenerator.cpp b/lib/rmg/CMapGenerator.cpp index 60f54eee1..7796e5f49 100644 --- a/lib/rmg/CMapGenerator.cpp +++ b/lib/rmg/CMapGenerator.cpp @@ -27,6 +27,8 @@ #include "TreasurePlacer.h" #include "RoadPlacer.h" +VCMI_LIB_NAMESPACE_BEGIN + CMapGenerator::CMapGenerator(CMapGenOptions& mapGenOptions, int RandomSeed) : mapGenOptions(mapGenOptions), randomSeed(RandomSeed), prisonsRemaining(0), monolithIndex(0) @@ -396,3 +398,5 @@ Zone * CMapGenerator::getZoneWater() const return z.second.get(); return nullptr; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/CMapGenerator.h b/lib/rmg/CMapGenerator.h index 96c52ce98..5bbc575ae 100644 --- a/lib/rmg/CMapGenerator.h +++ b/lib/rmg/CMapGenerator.h @@ -17,6 +17,8 @@ #include "CRmgTemplate.h" #include "../LoadProgress.h" +VCMI_LIB_NAMESPACE_BEGIN + class CRmgTemplate; class CMapGenOptions; class JsonNode; @@ -100,3 +102,5 @@ private: void fillZones(); }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/CRmgTemplate.cpp b/lib/rmg/CRmgTemplate.cpp index 1025ff874..f1d8e8bec 100644 --- a/lib/rmg/CRmgTemplate.cpp +++ b/lib/rmg/CRmgTemplate.cpp @@ -20,6 +20,8 @@ #include "../serializer/JsonSerializeFormat.h" #include "../StringConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace { si32 decodeZoneId(const std::string & json) @@ -799,3 +801,5 @@ void CRmgTemplate::serializePlayers(JsonSerializeFormat & handler, CPlayerCountR value.fromString(encodedValue); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/CRmgTemplate.h b/lib/rmg/CRmgTemplate.h index 2637d8c5a..31cc4bca7 100644 --- a/lib/rmg/CRmgTemplate.h +++ b/lib/rmg/CRmgTemplate.h @@ -16,6 +16,8 @@ #include "../Terrain.h" #include "CMapGenOptions.h" +VCMI_LIB_NAMESPACE_BEGIN + class JsonSerializeFormat; namespace ETemplateZoneType @@ -216,3 +218,5 @@ private: void serializeSize(JsonSerializeFormat & handler, int3 & value, const std::string & fieldName); void serializePlayers(JsonSerializeFormat & handler, CPlayerCountRange & value, const std::string & fieldName); }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/CRmgTemplateStorage.cpp b/lib/rmg/CRmgTemplateStorage.cpp index ec3f7e890..15648a224 100644 --- a/lib/rmg/CRmgTemplateStorage.cpp +++ b/lib/rmg/CRmgTemplateStorage.cpp @@ -15,6 +15,8 @@ #include "../serializer/JsonDeserializer.h" +VCMI_LIB_NAMESPACE_BEGIN + using namespace rmg; void CRmgTemplateStorage::loadObject(std::string scope, std::string name, const JsonNode & data, size_t index) @@ -78,3 +80,5 @@ std::vector CRmgTemplateStorage::getTemplates() const } return result; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/CRmgTemplateStorage.h b/lib/rmg/CRmgTemplateStorage.h index b59631802..0e6f66288 100644 --- a/lib/rmg/CRmgTemplateStorage.h +++ b/lib/rmg/CRmgTemplateStorage.h @@ -14,6 +14,8 @@ #include "../int3.h" #include "CRmgTemplate.h" +VCMI_LIB_NAMESPACE_BEGIN + class JsonNode; /// The CJsonRmgTemplateLoader loads templates from a JSON file. @@ -38,3 +40,5 @@ private: std::map templatesByName; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/CZonePlacer.cpp b/lib/rmg/CZonePlacer.cpp index 8200895a7..4c37f3458 100644 --- a/lib/rmg/CZonePlacer.cpp +++ b/lib/rmg/CZonePlacer.cpp @@ -17,6 +17,8 @@ #include "Zone.h" #include "Functions.h" +VCMI_LIB_NAMESPACE_BEGIN + class CRandomGenerator; CZonePlacer::CZonePlacer(RmgMap & map) @@ -576,3 +578,5 @@ void CZonePlacer::assignZones(CRandomGenerator * rand) } logGlobal->info("Finished zone colouring"); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/CZonePlacer.h b/lib/rmg/CZonePlacer.h index 6558435bb..8e26a7e7e 100644 --- a/lib/rmg/CZonePlacer.h +++ b/lib/rmg/CZonePlacer.h @@ -14,6 +14,8 @@ #include "../int3.h" #include "../GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + class CZoneGraph; class CMap; class CRandomGenerator; @@ -58,3 +60,5 @@ private: //std::unique_ptr graph; RmgMap & map; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/ConnectionsPlacer.cpp b/lib/rmg/ConnectionsPlacer.cpp index bd4633398..dcdb2b28d 100644 --- a/lib/rmg/ConnectionsPlacer.cpp +++ b/lib/rmg/ConnectionsPlacer.cpp @@ -25,6 +25,8 @@ #include "WaterProxy.h" #include "TownPlacer.h" +VCMI_LIB_NAMESPACE_BEGIN + void ConnectionsPlacer::process() { collectNeighbourZones(); @@ -278,3 +280,5 @@ void ConnectionsPlacer::collectNeighbourZones() dNeighbourZones[zid].insert(i); } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/ConnectionsPlacer.h b/lib/rmg/ConnectionsPlacer.h index bdbd86740..ac577b687 100644 --- a/lib/rmg/ConnectionsPlacer.h +++ b/lib/rmg/ConnectionsPlacer.h @@ -12,6 +12,8 @@ #include "Zone.h" #include "RmgArea.h" +VCMI_LIB_NAMESPACE_BEGIN + class ConnectionsPlacer: public Modificator { public: @@ -33,3 +35,5 @@ protected: std::vector dConnections, dCompleted; std::map dNeighbourZones; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/Functions.cpp b/lib/rmg/Functions.cpp index 210bf9fe2..9795cc621 100644 --- a/lib/rmg/Functions.cpp +++ b/lib/rmg/Functions.cpp @@ -28,6 +28,8 @@ #include "../mapObjects/MapObjects.h" //needed to resolve templates for CommonConstructors.h #include "../VCMI_Lib.h" +VCMI_LIB_NAMESPACE_BEGIN + void createModificators(RmgMap & map) { for(auto & z : map.getZones()) @@ -176,3 +178,5 @@ void createObstaclesCommon2(RmgMap & map, CRandomGenerator & generator) } } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/Functions.h b/lib/rmg/Functions.h index 0be072e84..5696126da 100644 --- a/lib/rmg/Functions.h +++ b/lib/rmg/Functions.h @@ -13,6 +13,8 @@ #include "Zone.h" #include //A* +VCMI_LIB_NAMESPACE_BEGIN + class RmgMap; class ObjectManager; class ObjectTemplate; @@ -46,3 +48,5 @@ void initTerrainType(Zone & zone, CMapGenerator & gen); int chooseRandomAppearance(CRandomGenerator & generator, si32 ObjID, const Terrain & terrain); + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/ObjectManager.cpp b/lib/rmg/ObjectManager.cpp index 875b9974a..217c03017 100644 --- a/lib/rmg/ObjectManager.cpp +++ b/lib/rmg/ObjectManager.cpp @@ -24,6 +24,8 @@ #include "Functions.h" #include "RmgObject.h" +VCMI_LIB_NAMESPACE_BEGIN + void ObjectManager::process() { zone.fractalize(); @@ -491,3 +493,5 @@ bool ObjectManager::addGuard(rmg::Object & object, si32 strength, bool zoneGuard return true; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/ObjectManager.h b/lib/rmg/ObjectManager.h index 071b3ab8a..37ad5b1f0 100644 --- a/lib/rmg/ObjectManager.h +++ b/lib/rmg/ObjectManager.h @@ -14,6 +14,8 @@ #include "RmgObject.h" #include //A* +VCMI_LIB_NAMESPACE_BEGIN + class CGObjectInstance; class ObjectTemplate; class CGCreature; @@ -79,3 +81,5 @@ protected: boost::heap::priority_queue> tilesByDistance; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/ObstaclePlacer.cpp b/lib/rmg/ObstaclePlacer.cpp index 29fba34ab..519cacf00 100644 --- a/lib/rmg/ObstaclePlacer.cpp +++ b/lib/rmg/ObstaclePlacer.cpp @@ -24,6 +24,8 @@ #include "Functions.h" #include "../mapping/CMapEditManager.h" +VCMI_LIB_NAMESPACE_BEGIN + void ObstacleProxy::collectPossibleObstacles(const Terrain & terrain) { //get all possible obstacles for this terrain @@ -262,3 +264,5 @@ bool ObstaclePlacer::isProhibited(const rmg::Area & objArea) const void ObstaclePlacer::finalInsertion(CMapEditManager *, std::set &) { } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/ObstaclePlacer.h b/lib/rmg/ObstaclePlacer.h index b98d042aa..8f2fedbbe 100644 --- a/lib/rmg/ObstaclePlacer.h +++ b/lib/rmg/ObstaclePlacer.h @@ -11,10 +11,13 @@ #pragma once #include "Zone.h" +VCMI_LIB_NAMESPACE_BEGIN + class CMap; class CMapEditManager; class RiverPlacer; class ObjectManager; + class DLL_LINKAGE ObstacleProxy { public: @@ -69,3 +72,5 @@ private: RiverPlacer * riverManager; ObjectManager * manager; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/RiverPlacer.cpp b/lib/rmg/RiverPlacer.cpp index 599c1cded..b1d6229db 100644 --- a/lib/rmg/RiverPlacer.cpp +++ b/lib/rmg/RiverPlacer.cpp @@ -22,6 +22,8 @@ #include "WaterProxy.h" #include "RoadPlacer.h" +VCMI_LIB_NAMESPACE_BEGIN + const int RIVER_DELTA_ID = 143; const int RIVER_DELTA_SUBTYPE = 0; const std::map RIVER_DELTA_TEMPLATE_NAME @@ -402,3 +404,5 @@ void RiverPlacer::connectRiver(const int3 & tile) rivers.unite(pathToSource.getPathArea()); rivers.unite(pathToSink.getPathArea()); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/RiverPlacer.h b/lib/rmg/RiverPlacer.h index 46c6e1e23..f20233af7 100644 --- a/lib/rmg/RiverPlacer.h +++ b/lib/rmg/RiverPlacer.h @@ -11,6 +11,8 @@ #pragma once #include "Zone.h" +VCMI_LIB_NAMESPACE_BEGIN + class RiverPlacer: public Modificator { public: @@ -46,3 +48,5 @@ private: std::map heightMap; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/RmgArea.cpp b/lib/rmg/RmgArea.cpp index a2fb40045..f733a4d01 100644 --- a/lib/rmg/RmgArea.cpp +++ b/lib/rmg/RmgArea.cpp @@ -12,6 +12,8 @@ #include "RmgArea.h" #include "CMapGenerator.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace rmg { @@ -402,3 +404,5 @@ bool operator== (const Area & l, const Area & r) } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/RmgArea.h b/lib/rmg/RmgArea.h index cc995f6b0..a9b0f4d0b 100644 --- a/lib/rmg/RmgArea.h +++ b/lib/rmg/RmgArea.h @@ -13,6 +13,8 @@ #include "../GameConstants.h" #include "../int3.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace rmg { static const std::array dirs4 = { int3(0,1,0),int3(0,-1,0),int3(-1,0,0),int3(+1,0,0) }; @@ -84,3 +86,5 @@ namespace rmg mutable int3 dTotalShiftCache; }; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/RmgMap.cpp b/lib/rmg/RmgMap.cpp index 95c40acbb..ee8d35767 100644 --- a/lib/rmg/RmgMap.cpp +++ b/lib/rmg/RmgMap.cpp @@ -30,6 +30,8 @@ #include "Functions.h" #include "CMapGenerator.h" +VCMI_LIB_NAMESPACE_BEGIN + RmgMap::RmgMap(const CMapGenOptions& mapGenOptions) : mapGenOptions(mapGenOptions), zonesTotal(0) { @@ -338,3 +340,5 @@ void RmgMap::dump(bool zoneId) const } out << std::endl; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/RmgMap.h b/lib/rmg/RmgMap.h index ab5be9b78..a4702c362 100644 --- a/lib/rmg/RmgMap.h +++ b/lib/rmg/RmgMap.h @@ -13,6 +13,8 @@ #include "../GameConstants.h" #include "../mapping/CMap.h" +VCMI_LIB_NAMESPACE_BEGIN + class CMapEditManager; class TileInfo; class CMapGenOptions; @@ -79,3 +81,5 @@ private: boost::multi_array tiles; //[x][y][z] boost::multi_array zoneColouring; //[x][y][z] }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/RmgObject.cpp b/lib/rmg/RmgObject.cpp index 9635daf53..f7898f143 100644 --- a/lib/rmg/RmgObject.cpp +++ b/lib/rmg/RmgObject.cpp @@ -19,6 +19,8 @@ #include "../mapObjects/MapObjects.h" //needed to resolve templates for CommonConstructors.h #include "Functions.h" +VCMI_LIB_NAMESPACE_BEGIN + using namespace rmg; Object::Instance::Instance(const Object& parent, CGObjectInstance & object): dParent(parent), dObject(object) @@ -325,3 +327,5 @@ void Object::clear() dAccessibleAreaFullCache.clear(); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/RmgObject.h b/lib/rmg/RmgObject.h index e418631c3..9a4737c70 100644 --- a/lib/rmg/RmgObject.h +++ b/lib/rmg/RmgObject.h @@ -14,6 +14,8 @@ #include "../int3.h" #include "RmgArea.h" +VCMI_LIB_NAMESPACE_BEGIN + class CGObjectInstance; class RmgMap; class Terrain; @@ -85,3 +87,5 @@ private: ui32 dStrenght; }; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/RmgPath.cpp b/lib/rmg/RmgPath.cpp index 7e38ae04c..fe7319736 100644 --- a/lib/rmg/RmgPath.cpp +++ b/lib/rmg/RmgPath.cpp @@ -12,6 +12,8 @@ #include "RmgPath.h" #include //A* +VCMI_LIB_NAMESPACE_BEGIN + using namespace rmg; const std::function Path::DEFAULT_MOVEMENT_FUNCTION = @@ -191,3 +193,5 @@ const Area & Path::getPathArea() const { return dPath; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/RmgPath.h b/lib/rmg/RmgPath.h index 0866f856c..6f65c1454 100644 --- a/lib/rmg/RmgPath.h +++ b/lib/rmg/RmgPath.h @@ -14,6 +14,8 @@ #include "../int3.h" #include "RmgArea.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace rmg { class Path @@ -47,3 +49,5 @@ private: Area dPath; }; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/RoadPlacer.cpp b/lib/rmg/RoadPlacer.cpp index 8f605a0d6..8dde55600 100644 --- a/lib/rmg/RoadPlacer.cpp +++ b/lib/rmg/RoadPlacer.cpp @@ -18,6 +18,8 @@ #include "../mapping/CMapEditManager.h" #include "RmgPath.h" +VCMI_LIB_NAMESPACE_BEGIN + void RoadPlacer::process() { connectRoads(); @@ -121,3 +123,5 @@ char RoadPlacer::dump(const int3 & t) return 'i'; return Modificator::dump(t); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/RoadPlacer.h b/lib/rmg/RoadPlacer.h index 585679ee6..092f3499f 100644 --- a/lib/rmg/RoadPlacer.h +++ b/lib/rmg/RoadPlacer.h @@ -11,6 +11,8 @@ #pragma once #include "Zone.h" +VCMI_LIB_NAMESPACE_BEGIN + class RoadPlacer: public Modificator { public: @@ -35,3 +37,5 @@ protected: rmg::Area roads; //all tiles with roads rmg::Area areaRoads, isolated; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/RockPlacer.cpp b/lib/rmg/RockPlacer.cpp index 7688c690c..c07251a04 100644 --- a/lib/rmg/RockPlacer.cpp +++ b/lib/rmg/RockPlacer.cpp @@ -20,6 +20,8 @@ #include "../CRandomGenerator.h" #include "../mapping/CMapEditManager.h" +VCMI_LIB_NAMESPACE_BEGIN + void RockPlacer::process() { rockTerrain = Terrain::Manager::getInfo(zone.getTerrainType()).rockTerrain; @@ -101,3 +103,5 @@ char RockPlacer::dump(const int3 & t) } return Modificator::dump(t); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/RockPlacer.h b/lib/rmg/RockPlacer.h index c7217674f..76bd77a14 100644 --- a/lib/rmg/RockPlacer.h +++ b/lib/rmg/RockPlacer.h @@ -11,6 +11,8 @@ #pragma once #include "Zone.h" +VCMI_LIB_NAMESPACE_BEGIN + class RockPlacer: public Modificator { public: @@ -28,3 +30,5 @@ protected: rmg::Area rockArea, accessibleArea; Terrain rockTerrain; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/TerrainPainter.cpp b/lib/rmg/TerrainPainter.cpp index fba82c55c..bec92812b 100644 --- a/lib/rmg/TerrainPainter.cpp +++ b/lib/rmg/TerrainPainter.cpp @@ -19,6 +19,8 @@ #include "CMapGenerator.h" #include "RmgMap.h" +VCMI_LIB_NAMESPACE_BEGIN + void TerrainPainter::process() { initTerrainType(zone, generator); @@ -33,3 +35,5 @@ void TerrainPainter::init() POSTFUNCTION_ALL(ConnectionsPlacer); POSTFUNCTION(ObjectManager); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/TerrainPainter.h b/lib/rmg/TerrainPainter.h index 7052d883f..59024c9e1 100644 --- a/lib/rmg/TerrainPainter.h +++ b/lib/rmg/TerrainPainter.h @@ -11,6 +11,8 @@ #pragma once #include "Zone.h" +VCMI_LIB_NAMESPACE_BEGIN + class TerrainPainter: public Modificator { public: @@ -19,3 +21,5 @@ public: void process() override; void init() override; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/TileInfo.cpp b/lib/rmg/TileInfo.cpp index 9070333d3..a4475f0cf 100644 --- a/lib/rmg/TileInfo.cpp +++ b/lib/rmg/TileInfo.cpp @@ -11,6 +11,8 @@ #include "StdInc.h" #include "TileInfo.h" +VCMI_LIB_NAMESPACE_BEGIN + TileInfo::TileInfo():nearestObjectDistance(float(INT_MAX)), terrain() { occupied = ETileType::POSSIBLE; //all tiles are initially possible to place objects or passages @@ -76,3 +78,5 @@ void TileInfo::setRoadType(const std::string & value) roadType = value; // setOccupied(ETileType::FREE); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/TileInfo.h b/lib/rmg/TileInfo.h index 30ed5d90f..02b4887c0 100644 --- a/lib/rmg/TileInfo.h +++ b/lib/rmg/TileInfo.h @@ -13,6 +13,8 @@ #include "../GameConstants.h" #include "../Terrain.h" +VCMI_LIB_NAMESPACE_BEGIN + class TileInfo { public: @@ -39,3 +41,5 @@ private: Terrain terrain; std::string roadType; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/TownPlacer.cpp b/lib/rmg/TownPlacer.cpp index d33ae032b..d6971adfd 100644 --- a/lib/rmg/TownPlacer.cpp +++ b/lib/rmg/TownPlacer.cpp @@ -24,6 +24,8 @@ #include "WaterAdopter.h" #include "TileInfo.h" +VCMI_LIB_NAMESPACE_BEGIN + void TownPlacer::process() { auto * manager = zone.getModificator(); @@ -278,3 +280,5 @@ int TownPlacer::getTotalTowns() const { return totalTowns; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/TownPlacer.h b/lib/rmg/TownPlacer.h index 3c7fcadbe..d667852db 100644 --- a/lib/rmg/TownPlacer.h +++ b/lib/rmg/TownPlacer.h @@ -10,6 +10,8 @@ #pragma once #include "Zone.h" +VCMI_LIB_NAMESPACE_BEGIN + class ObjectManager; class CGTownInstance; @@ -35,3 +37,5 @@ protected: int totalTowns = 0; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/TreasurePlacer.cpp b/lib/rmg/TreasurePlacer.cpp index cf1d58abb..7ae6a37d7 100644 --- a/lib/rmg/TreasurePlacer.cpp +++ b/lib/rmg/TreasurePlacer.cpp @@ -24,6 +24,8 @@ #include "../mapping/CMap.h" #include "../mapping/CMapEditManager.h" +VCMI_LIB_NAMESPACE_BEGIN + void TreasurePlacer::process() { addAllPossibleObjects(); @@ -823,3 +825,5 @@ void ObjectInfo::setTemplate(si32 type, si32 subtype, Terrain terrainType) templ = templates.front(); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/TreasurePlacer.h b/lib/rmg/TreasurePlacer.h index 457ef35a8..baba38047 100644 --- a/lib/rmg/TreasurePlacer.h +++ b/lib/rmg/TreasurePlacer.h @@ -12,6 +12,8 @@ #include "Zone.h" #include "../mapObjects/ObjectTemplate.h" +VCMI_LIB_NAMESPACE_BEGIN + class CGObjectInstance; class ObjectManager; class RmgMap; @@ -65,3 +67,5 @@ protected: Zone * questArtZone = nullptr; //artifacts required for Seer Huts will be placed here - or not if null }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/WaterAdopter.cpp b/lib/rmg/WaterAdopter.cpp index df06e682d..2dd540995 100644 --- a/lib/rmg/WaterAdopter.cpp +++ b/lib/rmg/WaterAdopter.cpp @@ -25,6 +25,8 @@ #include "ConnectionsPlacer.h" #include "TileInfo.h" +VCMI_LIB_NAMESPACE_BEGIN + void WaterAdopter::process() { createWater(map.getMapGenOptions().getWaterContent()); @@ -259,3 +261,5 @@ char WaterAdopter::dump(const int3 & t) return Modificator::dump(t); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/WaterAdopter.h b/lib/rmg/WaterAdopter.h index 8b97b8d74..ef47d3fa8 100644 --- a/lib/rmg/WaterAdopter.h +++ b/lib/rmg/WaterAdopter.h @@ -11,6 +11,8 @@ #pragma once #include "Zone.h" +VCMI_LIB_NAMESPACE_BEGIN + class WaterAdopter: public Modificator { public: @@ -34,3 +36,5 @@ protected: std::map distanceMap; std::map reverseDistanceMap; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/WaterProxy.cpp b/lib/rmg/WaterProxy.cpp index 777cf8c11..a2a8c9f93 100644 --- a/lib/rmg/WaterProxy.cpp +++ b/lib/rmg/WaterProxy.cpp @@ -27,6 +27,8 @@ #include "WaterAdopter.h" #include "RmgArea.h" +VCMI_LIB_NAMESPACE_BEGIN + void WaterProxy::process() { for(auto & t : zone.area().getTilesVector()) @@ -358,3 +360,5 @@ char WaterProxy::dump(const int3 & t) return '~'; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/WaterProxy.h b/lib/rmg/WaterProxy.h index 769d70208..de50f7354 100644 --- a/lib/rmg/WaterProxy.h +++ b/lib/rmg/WaterProxy.h @@ -11,6 +11,8 @@ #pragma once #include "Zone.h" +VCMI_LIB_NAMESPACE_BEGIN + struct RouteInfo { rmg::Area blocked; @@ -53,3 +55,5 @@ protected: std::map lakeMap; //map tile on lakeId which is position of lake in lakes array +1 }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/WaterRoutes.cpp b/lib/rmg/WaterRoutes.cpp index 40569d4a2..8cca1e426 100644 --- a/lib/rmg/WaterRoutes.cpp +++ b/lib/rmg/WaterRoutes.cpp @@ -28,6 +28,8 @@ #include "WaterAdopter.h" #include "RmgArea.h" +VCMI_LIB_NAMESPACE_BEGIN + void WaterRoutes::process() { auto * wproxy = zone.getModificator(); @@ -117,3 +119,5 @@ char WaterRoutes::dump(const int3 & t) return ' '; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/WaterRoutes.h b/lib/rmg/WaterRoutes.h index 996318362..b693f3d2b 100644 --- a/lib/rmg/WaterRoutes.h +++ b/lib/rmg/WaterRoutes.h @@ -11,6 +11,8 @@ #pragma once #include "Zone.h" +VCMI_LIB_NAMESPACE_BEGIN + struct RouteInfo; class WaterRoutes: public Modificator @@ -25,3 +27,5 @@ public: private: std::vector result; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/Zone.cpp b/lib/rmg/Zone.cpp index 6b2f977f2..b66cf44c8 100644 --- a/lib/rmg/Zone.cpp +++ b/lib/rmg/Zone.cpp @@ -18,6 +18,8 @@ #include "CMapGenerator.h" #include "RmgPath.h" +VCMI_LIB_NAMESPACE_BEGIN + std::function AREA_NO_FILTER = [](const int3 & t) { return true; @@ -405,3 +407,5 @@ Modificator::~Modificator() { } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/Zone.h b/lib/rmg/Zone.h index 3679506c5..37cf07e22 100644 --- a/lib/rmg/Zone.h +++ b/lib/rmg/Zone.h @@ -33,6 +33,8 @@ postfunction(z.second->getModificator()); \ } +VCMI_LIB_NAMESPACE_BEGIN + class RmgMap; class CMapGenerator; class Zone; @@ -141,3 +143,5 @@ protected: Terrain terrainType; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/rmg/float3.h b/lib/rmg/float3.h index 13942d6fb..3398f2877 100644 --- a/lib/rmg/float3.h +++ b/lib/rmg/float3.h @@ -9,6 +9,8 @@ */ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + // FIXME: Class doesn't contain three float values. Update name and description. /// Class which consists of three float values. Represents position virtual RMG (0;1) area. class float3 @@ -161,3 +163,5 @@ struct Shashfloat3 return ret; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/BinaryDeserializer.cpp b/lib/serializer/BinaryDeserializer.cpp index d48587c42..d1773b434 100644 --- a/lib/serializer/BinaryDeserializer.cpp +++ b/lib/serializer/BinaryDeserializer.cpp @@ -13,6 +13,8 @@ #include "../registerTypes/RegisterTypes.h" +VCMI_LIB_NAMESPACE_BEGIN + extern template void registerTypes(BinaryDeserializer & s); CLoadFile::CLoadFile(const boost::filesystem::path & fname, int minimalVersion) @@ -101,3 +103,5 @@ void CLoadFile::checkMagicBytes(const std::string &text) if(loaded != text) throw std::runtime_error("Magic bytes doesn't match!"); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/BinaryDeserializer.h b/lib/serializer/BinaryDeserializer.h index 16b7f22ce..bbb2b0774 100644 --- a/lib/serializer/BinaryDeserializer.h +++ b/lib/serializer/BinaryDeserializer.h @@ -15,6 +15,8 @@ #include "../mapObjects/CGHeroInstance.h" #include "../../Global.h" +VCMI_LIB_NAMESPACE_BEGIN + class CStackInstance; class FileStream; @@ -601,3 +603,5 @@ public: return * this; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/BinarySerializer.cpp b/lib/serializer/BinarySerializer.cpp index 229860012..0e3870920 100644 --- a/lib/serializer/BinarySerializer.cpp +++ b/lib/serializer/BinarySerializer.cpp @@ -13,6 +13,8 @@ #include "../registerTypes/RegisterTypes.h" +VCMI_LIB_NAMESPACE_BEGIN + extern template void registerTypes(BinarySerializer & s); CSaveFile::CSaveFile(const boost::filesystem::path &fname) @@ -73,3 +75,5 @@ void CSaveFile::putMagicBytes(const std::string &text) { write(text.c_str(), (unsigned int)text.length()); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/BinarySerializer.h b/lib/serializer/BinarySerializer.h index 4b6df7d8d..be1cb377c 100644 --- a/lib/serializer/BinarySerializer.h +++ b/lib/serializer/BinarySerializer.h @@ -12,6 +12,8 @@ #include "CTypeList.h" #include "../mapObjects/CArmedInstance.h" +VCMI_LIB_NAMESPACE_BEGIN + class FileStream; class DLL_LINKAGE CSaverBase @@ -389,3 +391,5 @@ public: return * this; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/CLoadIntegrityValidator.cpp b/lib/serializer/CLoadIntegrityValidator.cpp index 7b4637921..e04e4fbff 100644 --- a/lib/serializer/CLoadIntegrityValidator.cpp +++ b/lib/serializer/CLoadIntegrityValidator.cpp @@ -13,6 +13,8 @@ #include "../registerTypes/RegisterTypes.h" +VCMI_LIB_NAMESPACE_BEGIN + CLoadIntegrityValidator::CLoadIntegrityValidator(const boost::filesystem::path &primaryFileName, const boost::filesystem::path &controlFileName, int minimalVersion) : serializer(this), foundDesync(false) { @@ -63,3 +65,5 @@ void CLoadIntegrityValidator::checkMagicBytes( const std::string &text ) primaryFile->checkMagicBytes(text); controlFile->checkMagicBytes(text); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/CLoadIntegrityValidator.h b/lib/serializer/CLoadIntegrityValidator.h index 7ab627914..139e73db1 100644 --- a/lib/serializer/CLoadIntegrityValidator.h +++ b/lib/serializer/CLoadIntegrityValidator.h @@ -11,6 +11,8 @@ #include "BinaryDeserializer.h" +VCMI_LIB_NAMESPACE_BEGIN + /// Simple byte-to-byte saves comparator class DLL_LINKAGE CLoadIntegrityValidator : public IBinaryReader @@ -27,3 +29,5 @@ public: std::unique_ptr decay(); //returns primary file. CLoadIntegrityValidator stops being usable anymore }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/CMemorySerializer.cpp b/lib/serializer/CMemorySerializer.cpp index e63fa67b5..341ab925f 100644 --- a/lib/serializer/CMemorySerializer.cpp +++ b/lib/serializer/CMemorySerializer.cpp @@ -12,6 +12,8 @@ #include "../registerTypes/RegisterTypes.h" +VCMI_LIB_NAMESPACE_BEGIN + int CMemorySerializer::read(void * data, unsigned size) { if(buffer.size() < readPos + size) @@ -38,3 +40,5 @@ CMemorySerializer::CMemorySerializer(): iser(this), oser(this) iser.fileVersion = SERIALIZATION_VERSION; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/CMemorySerializer.h b/lib/serializer/CMemorySerializer.h index 799faa424..586220724 100644 --- a/lib/serializer/CMemorySerializer.h +++ b/lib/serializer/CMemorySerializer.h @@ -12,6 +12,8 @@ #include "BinarySerializer.h" #include "BinaryDeserializer.h" +VCMI_LIB_NAMESPACE_BEGIN + /// Serializer that stores objects in the dynamic buffer. Allows performing deep object copies. class DLL_LINKAGE CMemorySerializer : public IBinaryReader, public IBinaryWriter @@ -39,3 +41,5 @@ public: return ret; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/CSerializer.cpp b/lib/serializer/CSerializer.cpp index ee9977f75..fe53ad072 100644 --- a/lib/serializer/CSerializer.cpp +++ b/lib/serializer/CSerializer.cpp @@ -15,6 +15,8 @@ #include "../CHeroHandler.h" #include "../mapObjects/CGHeroInstance.h" +VCMI_LIB_NAMESPACE_BEGIN + CSerializer::~CSerializer() { @@ -46,3 +48,5 @@ void CSerializer::addStdVecItems(CGameState *gs, LibClasses *lib) smartVectorMembersSerialization = true; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/CSerializer.h b/lib/serializer/CSerializer.h index 00891b786..9b0d14e47 100644 --- a/lib/serializer/CSerializer.h +++ b/lib/serializer/CSerializer.h @@ -12,6 +12,8 @@ #include "../ConstTransitivePtr.h" #include "../GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + const ui32 SERIALIZATION_VERSION = 805; const ui32 MINIMAL_SERIALIZATION_VERSION = 805; const std::string SAVEGAME_MAGIC = "VCMISVG"; @@ -199,3 +201,5 @@ class DLL_LINKAGE IBinaryWriter : public virtual CSerializer public: virtual int write(const void * data, unsigned size) = 0; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/CTypeList.cpp b/lib/serializer/CTypeList.cpp index 8ff73749d..64ae07050 100644 --- a/lib/serializer/CTypeList.cpp +++ b/lib/serializer/CTypeList.cpp @@ -12,6 +12,8 @@ #include "../registerTypes/RegisterTypes.h" +VCMI_LIB_NAMESPACE_BEGIN + extern template void registerTypes(CTypeList & s); CTypeList typeList; @@ -135,3 +137,5 @@ CTypeList::TypeInfoPtr CTypeList::getTypeDescriptor(const std::type_info *type, THROW_FORMAT("Cannot find type descriptor for type %s. Was it registered?", type->name()); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/CTypeList.h b/lib/serializer/CTypeList.h index 951df3ec0..38ba68975 100644 --- a/lib/serializer/CTypeList.h +++ b/lib/serializer/CTypeList.h @@ -11,6 +11,8 @@ #include "CSerializer.h" +VCMI_LIB_NAMESPACE_BEGIN + struct IPointerCaster { virtual boost::any castRawPtr(const boost::any &ptr) const = 0; // takes From*, returns To* @@ -231,3 +233,5 @@ public: addApplier(typeList.getTypeID(d)); } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/Cast.h b/lib/serializer/Cast.h index 4bef39ce6..ebc7957af 100644 --- a/lib/serializer/Cast.h +++ b/lib/serializer/Cast.h @@ -13,6 +13,8 @@ #include #include "CTypeList.h" +VCMI_LIB_NAMESPACE_BEGIN + template inline const T * dynamic_ptr_cast(const F * ptr) { @@ -60,3 +62,5 @@ inline T * dynamic_ptr_cast(F * ptr) return static_cast(ptr); #endif } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/Connection.cpp b/lib/serializer/Connection.cpp index cd98406b4..bce54123f 100644 --- a/lib/serializer/Connection.cpp +++ b/lib/serializer/Connection.cpp @@ -16,6 +16,8 @@ #include +VCMI_LIB_NAMESPACE_BEGIN + using namespace boost; using namespace boost::asio::ip; @@ -282,3 +284,5 @@ std::string CConnection::toString() const fmt % name % connectionID % uuid; return fmt.str(); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/Connection.h b/lib/serializer/Connection.h index 6ba68d269..63a161b56 100644 --- a/lib/serializer/Connection.h +++ b/lib/serializer/Connection.h @@ -12,8 +12,6 @@ #include "BinaryDeserializer.h" #include "BinarySerializer.h" -struct CPack; - #if BOOST_VERSION >= 107000 // Boost version >= 1.70 #include typedef boost::asio::basic_stream_socket < boost::asio::ip::tcp > TSocket; @@ -51,6 +49,10 @@ typedef boost::asio::basic_socket_acceptor +VCMI_LIB_NAMESPACE_BEGIN + JsonDeserializer::JsonDeserializer(const IInstanceResolver * instanceResolver_, const JsonNode & root_): JsonTreeSerializer(instanceResolver_, &root_, false, false) { @@ -281,3 +283,5 @@ void JsonDeserializer::readLICPart(const JsonNode & part, const TDecoder & decod } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/JsonDeserializer.h b/lib/serializer/JsonDeserializer.h index bace8e371..8c19c15a2 100644 --- a/lib/serializer/JsonDeserializer.h +++ b/lib/serializer/JsonDeserializer.h @@ -11,6 +11,8 @@ #include "JsonTreeSerializer.h" +VCMI_LIB_NAMESPACE_BEGIN + class DLL_LINKAGE JsonDeserializer: public JsonTreeSerializer { public: @@ -38,3 +40,5 @@ private: void readLICPart(const JsonNode & part, const TDecoder & decoder, const bool val, std::vector & value); void readLICPart(const JsonNode & part, const TDecoder & decoder, std::set & value); }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/JsonSerializeFormat.cpp b/lib/serializer/JsonSerializeFormat.cpp index 8e7143629..7525685f3 100644 --- a/lib/serializer/JsonSerializeFormat.cpp +++ b/lib/serializer/JsonSerializeFormat.cpp @@ -12,6 +12,8 @@ #include "../JsonNode.h" +VCMI_LIB_NAMESPACE_BEGIN + //JsonSerializeHelper JsonSerializeHelper::JsonSerializeHelper(JsonSerializeHelper && other): owner(other.owner), @@ -151,3 +153,5 @@ void JsonSerializeFormat::serializeBool(const std::string & fieldName, bool & va { serializeBool(fieldName, value, true, false, defaultValue); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/JsonSerializeFormat.h b/lib/serializer/JsonSerializeFormat.h index 27070923a..83d171c90 100644 --- a/lib/serializer/JsonSerializeFormat.h +++ b/lib/serializer/JsonSerializeFormat.h @@ -11,6 +11,8 @@ #include "../JsonNode.h" +VCMI_LIB_NAMESPACE_BEGIN + class JsonSerializeFormat; class JsonStructSerializer; class JsonArraySerializer; @@ -523,3 +525,5 @@ void JsonArraySerializer::serializeInt(const size_t index, T & value) if (!owner->saving) value = static_cast(temp); }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/JsonSerializer.cpp b/lib/serializer/JsonSerializer.cpp index 7285d7e9e..d01ca0e4c 100644 --- a/lib/serializer/JsonSerializer.cpp +++ b/lib/serializer/JsonSerializer.cpp @@ -12,6 +12,8 @@ #include "../JsonNode.h" +VCMI_LIB_NAMESPACE_BEGIN + JsonSerializer::JsonSerializer(const IInstanceResolver * instanceResolver_, JsonNode & root_): JsonTreeSerializer(instanceResolver_, &root_, true, false) { @@ -185,3 +187,5 @@ void JsonSerializer::writeLICPartBuffer(const std::string & fieldName, const std } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/JsonSerializer.h b/lib/serializer/JsonSerializer.h index 8621750c9..c75bf1ac6 100644 --- a/lib/serializer/JsonSerializer.h +++ b/lib/serializer/JsonSerializer.h @@ -11,6 +11,8 @@ #include "JsonTreeSerializer.h" +VCMI_LIB_NAMESPACE_BEGIN + class DLL_LINKAGE JsonSerializer : public JsonTreeSerializer { public: @@ -44,3 +46,5 @@ private: void writeLICPartBuffer(const std::string & fieldName, const std::string & partName, std::vector & buffer); }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/JsonTreeSerializer.h b/lib/serializer/JsonTreeSerializer.h index c5d2becac..c1cb36e61 100644 --- a/lib/serializer/JsonTreeSerializer.h +++ b/lib/serializer/JsonTreeSerializer.h @@ -12,6 +12,8 @@ #include "JsonSerializeFormat.h" +VCMI_LIB_NAMESPACE_BEGIN + template class JsonTreeSerializer : public JsonSerializeFormat { @@ -71,3 +73,5 @@ private: currentObject = newCurrentObject; } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/JsonUpdater.cpp b/lib/serializer/JsonUpdater.cpp index dc69e991b..b5702236b 100644 --- a/lib/serializer/JsonUpdater.cpp +++ b/lib/serializer/JsonUpdater.cpp @@ -13,6 +13,8 @@ #include "../JsonNode.h" #include "../HeroBonus.h" +VCMI_LIB_NAMESPACE_BEGIN + JsonUpdater::JsonUpdater(const IInstanceResolver * instanceResolver_, const JsonNode & root_) : JsonTreeSerializer(instanceResolver_, &root_, false, true) { @@ -307,3 +309,5 @@ void JsonUpdater::readLICPart(const JsonNode & part, const TDecoder & decoder, s } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/serializer/JsonUpdater.h b/lib/serializer/JsonUpdater.h index d1caa7ec7..238058692 100644 --- a/lib/serializer/JsonUpdater.h +++ b/lib/serializer/JsonUpdater.h @@ -11,6 +11,8 @@ #include "JsonTreeSerializer.h" +VCMI_LIB_NAMESPACE_BEGIN + class CBonusSystemNode; class DLL_LINKAGE JsonUpdater: public JsonTreeSerializer @@ -42,3 +44,5 @@ private: void readLICPart(const JsonNode & part, const TDecoder & decoder, const bool val, std::vector & value); void readLICPart(const JsonNode & part, const TDecoder & decoder, std::set & value); }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/AbilityCaster.cpp b/lib/spells/AbilityCaster.cpp index 0a9192d89..1e9d23c3c 100644 --- a/lib/spells/AbilityCaster.cpp +++ b/lib/spells/AbilityCaster.cpp @@ -15,6 +15,8 @@ #include "../battle/Unit.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { @@ -58,3 +60,5 @@ void AbilityCaster::spendMana(ServerCallback * server, const int32_t spellCost) } } // namespace spells + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/AbilityCaster.h b/lib/spells/AbilityCaster.h index 86585ffdc..2b9c7c2ff 100644 --- a/lib/spells/AbilityCaster.h +++ b/lib/spells/AbilityCaster.h @@ -12,6 +12,8 @@ #include "ProxyCaster.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { @@ -32,3 +34,5 @@ private: }; } // namespace spells + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/AdventureSpellMechanics.cpp b/lib/spells/AdventureSpellMechanics.cpp index b428db9e3..2d00da72b 100644 --- a/lib/spells/AdventureSpellMechanics.cpp +++ b/lib/spells/AdventureSpellMechanics.cpp @@ -21,6 +21,8 @@ #include "../mapping/CMap.h" #include "../CPlayerState.h" +VCMI_LIB_NAMESPACE_BEGIN + ///AdventureSpellMechanics AdventureSpellMechanics::AdventureSpellMechanics(const CSpell * s): IAdventureSpellMechanics(s) @@ -612,3 +614,5 @@ bool ViewEarthMechanics::filterObject(const CGObjectInstance * obj, const int32_ return (obj->ID == Obj::RESOURCE) || (spellLevel > 1 && obj->ID == Obj::MINE); } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/AdventureSpellMechanics.h b/lib/spells/AdventureSpellMechanics.h index f8860f8b6..9b6a5cf63 100644 --- a/lib/spells/AdventureSpellMechanics.h +++ b/lib/spells/AdventureSpellMechanics.h @@ -12,6 +12,8 @@ #include "ISpellMechanics.h" +VCMI_LIB_NAMESPACE_BEGIN + class CGTownInstance; enum class ESpellCastResult @@ -99,3 +101,5 @@ protected: }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/BattleSpellMechanics.cpp b/lib/spells/BattleSpellMechanics.cpp index 3ab3fd991..135c9eee2 100644 --- a/lib/spells/BattleSpellMechanics.cpp +++ b/lib/spells/BattleSpellMechanics.cpp @@ -20,6 +20,8 @@ #include "../CStack.h" #include "../NetPacks.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { @@ -674,3 +676,5 @@ const Spell * BattleSpellMechanics::getSpell() const } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/BattleSpellMechanics.h b/lib/spells/BattleSpellMechanics.h index d4a792412..3742f1b23 100644 --- a/lib/spells/BattleSpellMechanics.h +++ b/lib/spells/BattleSpellMechanics.h @@ -14,6 +14,8 @@ #include "effects/Effects.h" +VCMI_LIB_NAMESPACE_BEGIN + struct BattleSpellCast; namespace spells @@ -69,3 +71,5 @@ private: } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/BonusCaster.cpp b/lib/spells/BonusCaster.cpp index e6f2a8959..09cafa4bd 100644 --- a/lib/spells/BonusCaster.cpp +++ b/lib/spells/BonusCaster.cpp @@ -17,6 +17,8 @@ #include "../HeroBonus.h" #include "../battle/Unit.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { @@ -57,3 +59,5 @@ void BonusCaster::spendMana(ServerCallback * server, const int spellCost) const } // namespace spells + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/BonusCaster.h b/lib/spells/BonusCaster.h index c102c662b..12f888b77 100644 --- a/lib/spells/BonusCaster.h +++ b/lib/spells/BonusCaster.h @@ -12,6 +12,8 @@ #include "ProxyCaster.h" +VCMI_LIB_NAMESPACE_BEGIN + struct Bonus; namespace spells @@ -34,3 +36,5 @@ private: } // namespace spells + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/CSpellHandler.cpp b/lib/spells/CSpellHandler.cpp index aca31549c..6595ab950 100644 --- a/lib/spells/CSpellHandler.cpp +++ b/lib/spells/CSpellHandler.cpp @@ -32,6 +32,8 @@ #include "ISpellMechanics.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace SpellConfig { static const std::string LEVEL_NAMES[] = {"none", "basic", "advanced", "expert"}; @@ -1017,4 +1019,6 @@ std::vector CSpellHandler::getDefaultAllowed() const } return allowedSpells; -} \ No newline at end of file +} + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/CSpellHandler.h b/lib/spells/CSpellHandler.h index f821abc46..53345fcfe 100644 --- a/lib/spells/CSpellHandler.h +++ b/lib/spells/CSpellHandler.h @@ -21,6 +21,8 @@ #include "../battle/BattleHex.h" #include "../HeroBonus.h" +VCMI_LIB_NAMESPACE_BEGIN + class CSpell; class IAdventureSpellMechanics; class CBattleInfoCallback; @@ -391,3 +393,5 @@ protected: const std::vector & getTypeNames() const override; CSpell * loadFromJson(const std::string & scope, const JsonNode & json, const std::string & identifier, size_t index) override; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/ISpellMechanics.cpp b/lib/spells/ISpellMechanics.cpp index 29578ff56..1a14e0d53 100644 --- a/lib/spells/ISpellMechanics.cpp +++ b/lib/spells/ISpellMechanics.cpp @@ -42,6 +42,8 @@ #include "../IGameCallback.h"//todo: remove #include "../BattleFieldHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { @@ -776,3 +778,5 @@ std::unique_ptr IAdventureSpellMechanics::createMechan return std::unique_ptr(); } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/ISpellMechanics.h b/lib/spells/ISpellMechanics.h index 927a5a308..6206da9ba 100644 --- a/lib/spells/ISpellMechanics.h +++ b/lib/spells/ISpellMechanics.h @@ -18,6 +18,8 @@ #include "../GameConstants.h" #include "../HeroBonus.h" +VCMI_LIB_NAMESPACE_BEGIN + struct Query; class IBattleState; class CRandomGenerator; @@ -362,3 +364,5 @@ public: protected: const CSpell * owner; }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/Problem.cpp b/lib/spells/Problem.cpp index 6e8c76766..7d17d0bbc 100644 --- a/lib/spells/Problem.cpp +++ b/lib/spells/Problem.cpp @@ -11,6 +11,8 @@ #include "Problem.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { namespace detail @@ -52,3 +54,5 @@ void ProblemImpl::getAll(std::vector & target) const } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/Problem.h b/lib/spells/Problem.h index b5432d98f..c3d5e247d 100644 --- a/lib/spells/Problem.h +++ b/lib/spells/Problem.h @@ -14,6 +14,8 @@ #include "../NetPacksBase.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { namespace detail @@ -36,3 +38,5 @@ private: } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/ProxyCaster.cpp b/lib/spells/ProxyCaster.cpp index 1ae601b62..e93afe58c 100644 --- a/lib/spells/ProxyCaster.cpp +++ b/lib/spells/ProxyCaster.cpp @@ -13,6 +13,8 @@ #include "../GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { @@ -85,3 +87,5 @@ void ProxyCaster::spendMana(ServerCallback * server, const int32_t spellCost) co } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/ProxyCaster.h b/lib/spells/ProxyCaster.h index f3656e880..b3829da7f 100644 --- a/lib/spells/ProxyCaster.h +++ b/lib/spells/ProxyCaster.h @@ -12,6 +12,8 @@ #include +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { @@ -39,3 +41,5 @@ private: }; } // namespace spells + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/TargetCondition.cpp b/lib/spells/TargetCondition.cpp index cb4ddc976..cdcc2086e 100644 --- a/lib/spells/TargetCondition.cpp +++ b/lib/spells/TargetCondition.cpp @@ -20,6 +20,8 @@ #include "../VCMI_Lib.h" #include "../CModHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { @@ -512,3 +514,5 @@ void TargetCondition::loadConditions(const JsonNode & source, bool exclusive, bo } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/TargetCondition.h b/lib/spells/TargetCondition.h index c5ab39b9e..36dd413ae 100644 --- a/lib/spells/TargetCondition.h +++ b/lib/spells/TargetCondition.h @@ -12,6 +12,8 @@ #include "ISpellMechanics.h" +VCMI_LIB_NAMESPACE_BEGIN + class JsonNode; class JsonSerializeFormat; @@ -83,3 +85,5 @@ private: }; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/ViewSpellInt.cpp b/lib/spells/ViewSpellInt.cpp index 950da1447..7d436f284 100644 --- a/lib/spells/ViewSpellInt.cpp +++ b/lib/spells/ViewSpellInt.cpp @@ -14,6 +14,8 @@ #include "../mapObjects/CObjectHandler.h" +VCMI_LIB_NAMESPACE_BEGIN + ObjectPosInfo::ObjectPosInfo(): pos(), id(Obj::NO_OBJ), subId(-1), owner(PlayerColor::CANNOT_DETERMINE) { @@ -25,3 +27,5 @@ ObjectPosInfo::ObjectPosInfo(const CGObjectInstance * obj): { } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/ViewSpellInt.h b/lib/spells/ViewSpellInt.h index 67efe94c6..d570967bf 100644 --- a/lib/spells/ViewSpellInt.h +++ b/lib/spells/ViewSpellInt.h @@ -13,6 +13,8 @@ #include "../int3.h" #include "../GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + class CGObjectInstance; struct DLL_LINKAGE ObjectPosInfo @@ -33,3 +35,5 @@ } }; + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Catapult.cpp b/lib/spells/effects/Catapult.cpp index f1ed4051f..660be493e 100644 --- a/lib/spells/effects/Catapult.cpp +++ b/lib/spells/effects/Catapult.cpp @@ -21,6 +21,8 @@ #include "../../mapObjects/CGTownInstance.h" #include "../../serializer/JsonSerializeFormat.h" +VCMI_LIB_NAMESPACE_BEGIN + static const std::string EFFECT_NAME = "core:catapult"; namespace spells @@ -152,3 +154,5 @@ void Catapult::serializeJsonEffect(JsonSerializeFormat & handler) } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Catapult.h b/lib/spells/effects/Catapult.h index 762cd49d6..d03ef8e35 100644 --- a/lib/spells/effects/Catapult.h +++ b/lib/spells/effects/Catapult.h @@ -12,6 +12,8 @@ #include "LocationEffect.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { namespace effects @@ -34,3 +36,5 @@ private: } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Clone.cpp b/lib/spells/effects/Clone.cpp index 97e9e7ebd..58c7e2b11 100644 --- a/lib/spells/effects/Clone.cpp +++ b/lib/spells/effects/Clone.cpp @@ -17,6 +17,8 @@ #include "../../battle/CUnitState.h" #include "../../serializer/JsonSerializeFormat.h" +VCMI_LIB_NAMESPACE_BEGIN + static const std::string EFFECT_NAME = "core:clone"; namespace spells @@ -137,3 +139,5 @@ void Clone::serializeJsonUnitEffect(JsonSerializeFormat & handler) } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Clone.h b/lib/spells/effects/Clone.h index 8047a0e51..824551f6e 100644 --- a/lib/spells/effects/Clone.h +++ b/lib/spells/effects/Clone.h @@ -12,6 +12,8 @@ #include "UnitEffect.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { namespace effects @@ -35,3 +37,5 @@ private: } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Damage.cpp b/lib/spells/effects/Damage.cpp index 2db14bf46..88b0d1848 100644 --- a/lib/spells/effects/Damage.cpp +++ b/lib/spells/effects/Damage.cpp @@ -20,6 +20,8 @@ #include "../../CGeneralTextHandler.h" #include "../../serializer/JsonSerializeFormat.h" +VCMI_LIB_NAMESPACE_BEGIN + static const std::string EFFECT_NAME = "core:damage"; namespace spells @@ -225,3 +227,5 @@ void Damage::describeEffect(std::vector & log, const Mechanics * m, } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Damage.h b/lib/spells/effects/Damage.h index 27e6bb5af..699d5005d 100644 --- a/lib/spells/effects/Damage.h +++ b/lib/spells/effects/Damage.h @@ -12,6 +12,8 @@ #include "UnitEffect.h" +VCMI_LIB_NAMESPACE_BEGIN + struct StacksInjured; namespace spells @@ -44,3 +46,5 @@ private: } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Dispel.cpp b/lib/spells/effects/Dispel.cpp index 06d41dfba..ffe6bb454 100644 --- a/lib/spells/effects/Dispel.cpp +++ b/lib/spells/effects/Dispel.cpp @@ -21,6 +21,8 @@ #include "../../battle/Unit.h" #include "../../serializer/JsonSerializeFormat.h" +VCMI_LIB_NAMESPACE_BEGIN + static const std::string EFFECT_NAME = "core:dispel"; namespace spells @@ -142,3 +144,5 @@ std::shared_ptr Dispel::getBonuses(const Mechanics * m, const b } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Dispel.h b/lib/spells/effects/Dispel.h index bebb1200a..54667f25f 100644 --- a/lib/spells/effects/Dispel.h +++ b/lib/spells/effects/Dispel.h @@ -12,6 +12,8 @@ #include "UnitEffect.h" +VCMI_LIB_NAMESPACE_BEGIN + struct Bonus; class CSelector; class BonusList; @@ -44,3 +46,5 @@ private: } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Effect.cpp b/lib/spells/effects/Effect.cpp index 77f240f51..cb0462f6a 100644 --- a/lib/spells/effects/Effect.cpp +++ b/lib/spells/effects/Effect.cpp @@ -14,6 +14,8 @@ #include "../../serializer/JsonSerializeFormat.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { namespace effects @@ -64,3 +66,5 @@ std::shared_ptr Effect::create(const Registry * registry, const std::str } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Effect.h b/lib/spells/effects/Effect.h index 8ebf0f332..a8f6ec387 100644 --- a/lib/spells/effects/Effect.h +++ b/lib/spells/effects/Effect.h @@ -12,6 +12,8 @@ #include +VCMI_LIB_NAMESPACE_BEGIN + struct BattleHex; class CBattleInfoCallback; class JsonSerializeFormat; @@ -28,7 +30,7 @@ using EffectTarget = Target; namespace effects { -using RNG = ::vstd::RNG; +using RNG = vstd::RNG; class Effects; class Effect; class Registry; @@ -36,7 +38,7 @@ class Registry; template class RegisterEffect; -using TargetType = ::spells::AimType; +using TargetType = spells::AimType; class DLL_LINKAGE Effect { @@ -72,3 +74,5 @@ protected: } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Effects.cpp b/lib/spells/effects/Effects.cpp index 4a300d49b..f953ab0a7 100644 --- a/lib/spells/effects/Effects.cpp +++ b/lib/spells/effects/Effects.cpp @@ -17,6 +17,8 @@ #include "../../serializer/JsonSerializeFormat.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { @@ -156,3 +158,5 @@ void Effects::serializeJson(const Registry * registry, JsonSerializeFormat & han } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Effects.h b/lib/spells/effects/Effects.h index f9bc264df..7dc7f4e21 100644 --- a/lib/spells/effects/Effects.h +++ b/lib/spells/effects/Effects.h @@ -13,6 +13,8 @@ #include "Effect.h" #include "../../GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { namespace effects @@ -46,3 +48,5 @@ public: } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/EffectsFwd.h b/lib/spells/effects/EffectsFwd.h index d9db3e64f..b7c2bf9e9 100644 --- a/lib/spells/effects/EffectsFwd.h +++ b/lib/spells/effects/EffectsFwd.h @@ -10,6 +10,8 @@ #pragma once +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { namespace effects @@ -21,3 +23,5 @@ class Effects; } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Heal.cpp b/lib/spells/effects/Heal.cpp index 4d07e15dd..b192315b8 100644 --- a/lib/spells/effects/Heal.cpp +++ b/lib/spells/effects/Heal.cpp @@ -19,6 +19,8 @@ #include "../../battle/Unit.h" #include "../../serializer/JsonSerializeFormat.h" +VCMI_LIB_NAMESPACE_BEGIN + static const std::string EFFECT_NAME = "core:heal"; @@ -137,3 +139,5 @@ void Heal::prepareHealEffect(int64_t value, BattleUnitsChanged & pack, RNG & rng } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Heal.h b/lib/spells/effects/Heal.h index 0160be35f..138935626 100644 --- a/lib/spells/effects/Heal.h +++ b/lib/spells/effects/Heal.h @@ -13,6 +13,8 @@ #include "UnitEffect.h" #include "../../GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + struct BattleUnitsChanged; namespace spells @@ -45,3 +47,5 @@ private: } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/LocationEffect.cpp b/lib/spells/effects/LocationEffect.cpp index e66d80e63..5bd88dd74 100644 --- a/lib/spells/effects/LocationEffect.cpp +++ b/lib/spells/effects/LocationEffect.cpp @@ -12,6 +12,8 @@ #include "LocationEffect.h" #include "../ISpellMechanics.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { namespace effects @@ -53,3 +55,5 @@ EffectTarget LocationEffect::transformTarget(const Mechanics * m, const Target & } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/LocationEffect.h b/lib/spells/effects/LocationEffect.h index d51c9568d..b13a375c7 100644 --- a/lib/spells/effects/LocationEffect.h +++ b/lib/spells/effects/LocationEffect.h @@ -12,6 +12,8 @@ #include "Effect.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { @@ -38,3 +40,5 @@ private: } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Obstacle.cpp b/lib/spells/effects/Obstacle.cpp index 99b4a7f5b..5f8cbcc3e 100644 --- a/lib/spells/effects/Obstacle.cpp +++ b/lib/spells/effects/Obstacle.cpp @@ -19,6 +19,8 @@ #include "../../battle/CBattleInfoCallback.h" #include "../../serializer/JsonSerializeFormat.h" +VCMI_LIB_NAMESPACE_BEGIN + static const std::string EFFECT_NAME = "core:obstacle"; namespace spells @@ -340,3 +342,5 @@ void Obstacle::placeObstacles(ServerCallback * server, const Mechanics * m, cons } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Obstacle.h b/lib/spells/effects/Obstacle.h index bea14ee1c..5cc1fd215 100644 --- a/lib/spells/effects/Obstacle.h +++ b/lib/spells/effects/Obstacle.h @@ -14,6 +14,8 @@ #include "../../battle/BattleHex.h" #include "../../battle/CObstacleInstance.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { namespace effects @@ -77,3 +79,5 @@ private: } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Registry.cpp b/lib/spells/effects/Registry.cpp index 5d12c2283..09cecd826 100644 --- a/lib/spells/effects/Registry.cpp +++ b/lib/spells/effects/Registry.cpp @@ -11,6 +11,8 @@ #include "Registry.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { namespace effects @@ -56,3 +58,5 @@ Registry * GlobalRegistry::get() } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Registry.h b/lib/spells/effects/Registry.h index 8e0eeac17..2f4ae202b 100644 --- a/lib/spells/effects/Registry.h +++ b/lib/spells/effects/Registry.h @@ -19,6 +19,8 @@ RegisterEffect register ## Type(Name);\ }\ \ +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { namespace effects @@ -78,3 +80,5 @@ public: } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/RemoveObstacle.cpp b/lib/spells/effects/RemoveObstacle.cpp index 7e12568ba..1953668d3 100644 --- a/lib/spells/effects/RemoveObstacle.cpp +++ b/lib/spells/effects/RemoveObstacle.cpp @@ -20,6 +20,8 @@ #include "../../battle/CObstacleInstance.h" #include "../../serializer/JsonSerializeFormat.h" +VCMI_LIB_NAMESPACE_BEGIN + static const std::string EFFECT_NAME = "core:removeObstacle"; namespace spells @@ -112,3 +114,5 @@ std::set RemoveObstacle::getTargets(const Mechanics * } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/RemoveObstacle.h b/lib/spells/effects/RemoveObstacle.h index bdbc2dd31..3e159c6b3 100644 --- a/lib/spells/effects/RemoveObstacle.h +++ b/lib/spells/effects/RemoveObstacle.h @@ -14,6 +14,8 @@ #include "../../GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + struct CObstacleInstance; struct BattleObstaclesChanged; @@ -50,3 +52,5 @@ private: } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Sacrifice.cpp b/lib/spells/effects/Sacrifice.cpp index 52e60920d..5ec826006 100644 --- a/lib/spells/effects/Sacrifice.cpp +++ b/lib/spells/effects/Sacrifice.cpp @@ -19,6 +19,8 @@ #include "../../battle/Unit.h" #include "../../serializer/JsonSerializeFormat.h" +VCMI_LIB_NAMESPACE_BEGIN + static const std::string EFFECT_NAME = "core:sacrifice"; @@ -174,3 +176,5 @@ int64_t Sacrifice::calculateHealEffectValue(const Mechanics * m, const battle::U } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Sacrifice.h b/lib/spells/effects/Sacrifice.h index e89ef0c48..b449bbc7d 100644 --- a/lib/spells/effects/Sacrifice.h +++ b/lib/spells/effects/Sacrifice.h @@ -12,6 +12,8 @@ #include "Heal.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { namespace effects @@ -41,3 +43,5 @@ private: } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Summon.cpp b/lib/spells/effects/Summon.cpp index 2601f7d52..83082b012 100644 --- a/lib/spells/effects/Summon.cpp +++ b/lib/spells/effects/Summon.cpp @@ -22,6 +22,8 @@ #include "../../CHeroHandler.h" #include "../../mapObjects/CGHeroInstance.h" +VCMI_LIB_NAMESPACE_BEGIN + static const std::string EFFECT_NAME = "core:summon"; @@ -197,3 +199,5 @@ EffectTarget Summon::transformTarget(const Mechanics * m, const Target & aimPoin } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Summon.h b/lib/spells/effects/Summon.h index d12d5373b..97991c612 100644 --- a/lib/spells/effects/Summon.h +++ b/lib/spells/effects/Summon.h @@ -13,6 +13,8 @@ #include "Effect.h" #include "../../GameConstants.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { namespace effects @@ -49,3 +51,5 @@ private: } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Teleport.cpp b/lib/spells/effects/Teleport.cpp index 5501a189e..6df50f0aa 100644 --- a/lib/spells/effects/Teleport.cpp +++ b/lib/spells/effects/Teleport.cpp @@ -17,6 +17,8 @@ #include "../../battle/CBattleInfoCallback.h" #include "../../battle/Unit.h" +VCMI_LIB_NAMESPACE_BEGIN + //TODO: Teleport effect static const std::string EFFECT_NAME = "core:teleport"; @@ -122,3 +124,5 @@ EffectTarget Teleport::transformTarget(const Mechanics * m, const Target & aimPo } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Teleport.h b/lib/spells/effects/Teleport.h index b547bf7f6..04707400e 100644 --- a/lib/spells/effects/Teleport.h +++ b/lib/spells/effects/Teleport.h @@ -12,6 +12,8 @@ #include "UnitEffect.h" +VCMI_LIB_NAMESPACE_BEGIN + struct BattleStackMoved; namespace spells @@ -39,3 +41,5 @@ protected: } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Timed.cpp b/lib/spells/effects/Timed.cpp index 300fbedce..c9d6322f3 100644 --- a/lib/spells/effects/Timed.cpp +++ b/lib/spells/effects/Timed.cpp @@ -18,6 +18,8 @@ #include "../../battle/Unit.h" #include "../../serializer/JsonSerializeFormat.h" +VCMI_LIB_NAMESPACE_BEGIN + static const std::string EFFECT_NAME = "core:timed"; namespace spells @@ -276,3 +278,5 @@ void Timed::serializeJsonUnitEffect(JsonSerializeFormat & handler) } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/Timed.h b/lib/spells/effects/Timed.h index 34bbde91c..3867692f6 100644 --- a/lib/spells/effects/Timed.h +++ b/lib/spells/effects/Timed.h @@ -12,6 +12,8 @@ #include "UnitEffect.h" +VCMI_LIB_NAMESPACE_BEGIN + struct Bonus; struct SetStackEffect; struct MetaString; @@ -43,3 +45,5 @@ private: } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/UnitEffect.cpp b/lib/spells/effects/UnitEffect.cpp index 583d86b24..665842750 100644 --- a/lib/spells/effects/UnitEffect.cpp +++ b/lib/spells/effects/UnitEffect.cpp @@ -18,6 +18,8 @@ #include "../../battle/Unit.h" #include "../../serializer/JsonSerializeFormat.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { namespace effects @@ -291,3 +293,5 @@ void UnitEffect::serializeJsonEffect(JsonSerializeFormat & handler) } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/spells/effects/UnitEffect.h b/lib/spells/effects/UnitEffect.h index 1b076c660..81456e2e6 100644 --- a/lib/spells/effects/UnitEffect.h +++ b/lib/spells/effects/UnitEffect.h @@ -12,6 +12,8 @@ #include "Effect.h" +VCMI_LIB_NAMESPACE_BEGIN + namespace spells { namespace effects @@ -58,3 +60,5 @@ private: } } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/vcmi_endian.h b/lib/vcmi_endian.h index 865be44be..45db01bfb 100644 --- a/lib/vcmi_endian.h +++ b/lib/vcmi_endian.h @@ -12,6 +12,8 @@ //FIXME:library file depends on SDL - make cause troubles #include +VCMI_LIB_NAMESPACE_BEGIN + /* Reading values from memory. * * read_le_u16, read_le_u32 : read a little endian value from @@ -68,3 +70,5 @@ static inline std::string readString(const ui8 * buffer, int & i) } return ret; } + +VCMI_LIB_NAMESPACE_END diff --git a/lib/vstd/StringUtils.cpp b/lib/vstd/StringUtils.cpp index e46779026..51499078c 100644 --- a/lib/vstd/StringUtils.cpp +++ b/lib/vstd/StringUtils.cpp @@ -1,6 +1,8 @@ #include "StdInc.h" #include +VCMI_LIB_NAMESPACE_BEGIN + namespace vstd { @@ -30,3 +32,5 @@ namespace vstd } } + +VCMI_LIB_NAMESPACE_END diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index 0604c48e8..9174f80a7 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -91,6 +91,7 @@ private: CGameHandler * gh; }; +VCMI_LIB_NAMESPACE_BEGIN namespace spells { @@ -185,6 +186,7 @@ private: }; }// +VCMI_LIB_NAMESPACE_END CondSh battleMadeAction(false); CondSh battleResult(nullptr); diff --git a/server/CGameHandler.h b/server/CGameHandler.h index 279fca93e..bcb69f2e8 100644 --- a/server/CGameHandler.h +++ b/server/CGameHandler.h @@ -18,8 +18,8 @@ #include "../lib/ScriptHandler.h" #include "CQuery.h" -class CGameHandler; -class CVCMIServer; +VCMI_LIB_NAMESPACE_BEGIN + class CGameState; struct StartInfo; struct BattleResult; @@ -43,6 +43,11 @@ namespace scripting template class CApplier; + +VCMI_LIB_NAMESPACE_END + +class CGameHandler; +class CVCMIServer; class CBaseForGHApply; struct PlayerStatus diff --git a/server/CQuery.h b/server/CQuery.h index 45f6c11f3..aa5446f3c 100644 --- a/server/CQuery.h +++ b/server/CQuery.h @@ -12,9 +12,14 @@ #include "../lib/int3.h" #include "../lib/NetPacks.h" +VCMI_LIB_NAMESPACE_BEGIN + class CGObjectInstance; class CGHeroInstance; class CArmedInstance; + +VCMI_LIB_NAMESPACE_END + class CGameHandler; class CObjectVisitQuery; class CQuery; diff --git a/server/CVCMIServer.h b/server/CVCMIServer.h index 7cd84eb46..1ec212581 100644 --- a/server/CVCMIServer.h +++ b/server/CVCMIServer.h @@ -14,10 +14,11 @@ #include +VCMI_LIB_NAMESPACE_BEGIN + class CMapInfo; struct CPackForLobby; -class CGameHandler; struct SharedMemory; struct StartInfo; @@ -26,6 +27,10 @@ struct PlayerSettings; class PlayerColor; template class CApplier; + +VCMI_LIB_NAMESPACE_END + +class CGameHandler; class CBaseForServerApply; class CBaseForGHApply; diff --git a/server/StdInc.h b/server/StdInc.h index 9cc0f48e0..fbf8bbce5 100644 --- a/server/StdInc.h +++ b/server/StdInc.h @@ -18,3 +18,4 @@ #include #include +VCMI_LIB_USING_NAMESPACE