Browse Source

Removed all #include's of CMap.h from headers.
To all - please, avoid #include's in headers as much as possible
This kills incremental build compile times

Ivan Savenko 10 years ago
parent
commit
c3ce4b25df

+ 2 - 0
AI/VCAI/AIUtility.cpp

@@ -7,6 +7,8 @@
 #include "../../lib/CConfigHandler.h"
 #include "../../lib/CHeroHandler.h"
 #include "../../lib/mapObjects/CBank.h"
+#include "../../lib/mapObjects/CGTownInstance.h"
+#include "../../lib/mapObjects/CQuest.h"
 
 /*
  * AIUtility.cpp, part of VCMI engine

+ 0 - 1
AI/VCAI/AIUtility.h

@@ -7,7 +7,6 @@
 #include "../../lib/spells/CSpellHandler.h"
 #include "../../lib/Connection.h"
 #include "../../lib/CGameState.h"
-#include "../../lib/mapping/CMap.h"
 #include "../../lib/NetPacks.h"
 #include "../../lib/CStopWatch.h"
 

+ 1 - 1
AI/VCAI/VCAI.h

@@ -12,10 +12,10 @@
 #include "../../lib/CBuildingHandler.h"
 #include "../../lib/CCreatureHandler.h"
 #include "../../lib/CTownHandler.h"
+#include "../../lib/mapObjects/MiscObjects.h"
 #include "../../lib/spells/CSpellHandler.h"
 #include "../../lib/Connection.h"
 #include "../../lib/CGameState.h"
-#include "../../lib/mapping/CMap.h"
 #include "../../lib/NetPacks.h"
 #include "../../lib/CondSh.h"
 

+ 1 - 0
client/Graphics.cpp

@@ -22,6 +22,7 @@
 #include "../lib/GameConstants.h"
 #include "../lib/CStopWatch.h"
 #include "../lib/mapObjects/CObjectClassesHandler.h"
+#include "../lib/mapObjects/CObjectHandler.h"
 
 using namespace CSDL_Ext;
 #ifdef min

+ 1 - 0
client/battle/CBattleInterfaceClasses.cpp

@@ -29,6 +29,7 @@
 #include "../../lib/NetPacks.h"
 #include "../../lib/StartInfo.h"
 #include "../../lib/CondSh.h"
+#include "../../lib/mapObjects/CGTownInstance.h"
 
 /*
  * CBattleInterfaceClasses.cpp, part of VCMI engine

+ 1 - 1
client/windows/CQuestLog.cpp

@@ -19,7 +19,7 @@
 #include "../../lib/CGameState.h"
 #include "../../lib/CGeneralTextHandler.h"
 #include "../../lib/NetPacksBase.h"
-
+#include "../../lib/mapObjects/CQuest.h"
 /*
  * CQuestLog.cpp, part of VCMI engine
  *

+ 2 - 1
lib/BattleState.cpp

@@ -1,4 +1,4 @@
-/*
+/*
  * BattleState.cpp, part of VCMI engine
  *
  * Authors: listed in file AUTHORS in main folder
@@ -22,6 +22,7 @@
 #include "JsonNode.h"
 #include "filesystem/Filesystem.h"
 #include "CRandomGenerator.h"
+#include "mapObjects/CGTownInstance.h"
 
 const CStack * BattleInfo::getNextStack() const
 {

+ 1 - 0
lib/CBattleCallback.cpp

@@ -6,6 +6,7 @@
 #include "spells/CSpellHandler.h"
 #include "VCMI_Lib.h"
 #include "CTownHandler.h"
+#include "mapObjects/CGTownInstance.h"
 
 /*
  * CBattleCallback.cpp, part of VCMI engine

+ 1 - 0
lib/CGameInfoCallback.cpp

@@ -18,6 +18,7 @@
 #include "NetPacks.h" // for InfoWindow
 #include "CModHandler.h"
 #include "spells/CSpellHandler.h"
+#include "mapping/CMap.h"
 
 //TODO make clean
 #define ERROR_VERBOSE_OR_NOT_RET_VAL_IF(cond, verbose, txt, retVal) do {if(cond){if(verbose)logGlobal->errorStream() << BOOST_CURRENT_FUNCTION << ": " << txt; return retVal;}} while(0)

+ 0 - 5
lib/CGameState.h

@@ -1,12 +1,7 @@
 #pragma once
 
-
-
-//#ifndef _MSC_VER
 #include "CCreatureHandler.h"
 #include "VCMI_Lib.h"
-#include "mapping/CMap.h"
-//#endif
 
 #include "HeroBonus.h"
 #include "CCreatureSet.h"

+ 1 - 0
lib/CMakeLists.txt

@@ -117,6 +117,7 @@ set(lib_HEADERS
 		filesystem/ISimpleResourceLoader.h
 
 		mapObjects/MapObjects.h
+		mapping/CMapDefines.h
 
 		CSoundBase.h
 		AI_Base.h

+ 3 - 1
lib/CPathfinder.h

@@ -1,8 +1,8 @@
 #pragma once
 
 #include "VCMI_Lib.h"
-#include "mapping/CMap.h"
 #include "IGameCallback.h"
+#include "HeroBonus.h"
 #include "int3.h"
 
 #include <boost/heap/priority_queue.hpp>
@@ -21,6 +21,8 @@ class CGHeroInstance;
 class CGObjectInstance;
 struct TerrainTile;
 class CPathfinderHelper;
+class CMap;
+class CGWhirlpool;
 
 struct DLL_LINKAGE CGPathNode
 {

+ 1 - 0
lib/Connection.cpp

@@ -2,6 +2,7 @@
 #include "Connection.h"
 
 #include "registerTypes/RegisterTypes.h"
+#include "mapping/CMap.h"
 
 #include <boost/asio.hpp>
 

+ 12 - 0
lib/GameConstants.h

@@ -405,6 +405,18 @@ public:
 
 ID_LIKE_OPERATORS(BuildingID, BuildingID::EBuildingID)
 
+namespace EAiTactic
+{
+enum EAiTactic
+{
+	NONE = -1,
+	RANDOM,
+	WARRIOR,
+	BUILDER,
+	EXPLORER
+};
+}
+
 namespace EBuildingState
 {
 	enum EBuildingState

+ 1 - 0
lib/IGameCallback.cpp

@@ -21,6 +21,7 @@
 #include "mapObjects/CObjectClassesHandler.h"
 #include "StartInfo.h"
 #include "CGameState.h"
+#include "mapping/CMap.h"
 
 void CPrivilagedInfoCallback::getFreeTiles (std::vector<int3> &tiles) const
 {

+ 1 - 1
lib/NetPacks.h

@@ -13,7 +13,7 @@
 #include "ResourceSet.h"
 //#include "CObstacleInstance.h"
 #include "CGameStateFwd.h"
-#include "mapping/CMap.h"
+#include "mapping/CMapDefines.h"
 #include "CObstacleInstance.h"
 
 #include "spells/ViewSpellInt.h"

+ 3 - 1
lib/mapObjects/CGHeroInstance.cpp

@@ -1,4 +1,4 @@
-/*
+/*
  * CGHeroInstance.cpp, part of VCMI engine
  *
  * Authors: listed in file AUTHORS in main folder
@@ -22,6 +22,8 @@
 #include "../CGameState.h"
 #include "../CCreatureHandler.h"
 #include "../BattleState.h"
+#include "../CTownHandler.h"
+#include "CGTownInstance.h"
 
 ///helpers
 static void showInfoDialog(const PlayerColor playerID, const ui32 txtID, const ui16 soundID)

+ 2 - 1
lib/mapObjects/CGMarket.cpp

@@ -1,4 +1,4 @@
-/*
+/*
  *
  * CGMarket.cpp, part of VCMI engine
  *
@@ -17,6 +17,7 @@
 #include "../IGameCallback.h"
 #include "../CCreatureHandler.h"
 #include "../CGameState.h"
+#include "CGTownInstance.h"
 
 ///helpers
 static void openWindow(const OpenWindow::EWindow type, const int id1, const int id2 = -1)

+ 2 - 1
lib/mapObjects/CGTownInstance.cpp

@@ -1,4 +1,4 @@
-/*
+/*
  * CGTownInstance.cpp, part of VCMI engine
  *
  * Authors: listed in file AUTHORS in main folder
@@ -17,6 +17,7 @@
 #include "../CModHandler.h"
 #include "../IGameCallback.h"
 #include "../CGameState.h"
+#include "../mapping/CMapDefines.h"
 
 std::vector<const CArtifact *> CGTownInstance::merchantArtifacts;
 std::vector<int> CGTownInstance::universitySkills;

+ 3 - 1
lib/mapObjects/CObjectHandler.cpp

@@ -1,4 +1,4 @@
-/*
+/*
  * CObjectHandler.cpp, part of VCMI engine
  *
  * Authors: listed in file AUTHORS in main folder
@@ -18,8 +18,10 @@
 #include "../filesystem/ResourceID.h"
 #include "../IGameCallback.h"
 #include "../CGameState.h"
+#include "../mapping/CMap.h"
 
 #include "CObjectClassesHandler.h"
+#include "CGTownInstance.h"
 
 IGameCallback * IObjectInterface::cb = nullptr;
 

+ 1 - 0
lib/mapObjects/CQuest.cpp

@@ -17,6 +17,7 @@
 #include "../CGeneralTextHandler.h"
 #include "../CHeroHandler.h"
 #include "CObjectClassesHandler.h"
+#include "MiscObjects.h"
 #include "../IGameCallback.h"
 #include "../CGameState.h"
 

+ 1 - 0
lib/mapObjects/MiscObjects.cpp

@@ -20,6 +20,7 @@
 #include "../spells/CSpellHandler.h"
 #include "../IGameCallback.h"
 #include "../CGameState.h"
+#include "../mapping/CMap.h"
 
 std::map <si32, std::vector<ObjectInstanceID> > CGMagi::eyelist;
 ui8 CGObelisk::obeliskCount; //how many obelisks are on map

+ 1 - 0
lib/mapping/CDrawRoadsOperation.cpp

@@ -10,6 +10,7 @@
 
 #include "StdInc.h"
 #include "CDrawRoadsOperation.h"
+#include "CMap.h"
 
 const std::vector<CDrawRoadsOperation::RoadPattern> CDrawRoadsOperation::patterns = 
 {

+ 1 - 1
lib/mapping/CDrawRoadsOperation.h

@@ -11,9 +11,9 @@
 #pragma once
  
 #include "../CRandomGenerator.h"
-#include "CMap.h"
 #include "CMapEditManager.h"
 
+struct TerrainTile;
 
 class CDrawRoadsOperation : public CMapOperation
 {

+ 1 - 100
lib/mapping/CMap.h

@@ -19,6 +19,7 @@
 #include "../int3.h"
 #include "../GameConstants.h"
 #include "../LogicalExpression.h"
+#include "CMapDefines.h"
 
 class CArtifactInstance;
 class CGObjectInstance;
@@ -47,18 +48,6 @@ struct DLL_LINKAGE SHeroName
 	}
 };
 
-namespace EAiTactic
-{
-enum EAiTactic
-{
-	NONE = -1,
-	RANDOM,
-	WARRIOR,
-	BUILDER,
-	EXPLORER
-};
-}
-
 /// The player info constains data about which factions are allowed, AI tactical settings,
 /// the main hero name, where to generate the hero, whether the faction should be selected randomly,...
 struct DLL_LINKAGE PlayerInfo
@@ -216,94 +205,6 @@ struct DLL_LINKAGE DisposedHero
 	}
 };
 
-/// 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
-{
-public:
-	CMapEvent();
-
-	bool earlierThan(const CMapEvent & other) const;
-	bool earlierThanOrEqual(const CMapEvent & other) const;
-
-	std::string name;
-	std::string message;
-	TResources resources;
-	ui8 players; // affected players, bit field?
-	ui8 humanAffected;
-	ui8 computerAffected;
-	ui32 firstOccurence;
-	ui32 nextOccurence; /// specifies after how many days the event will occur the next time; 0 if event occurs only one time
-
-	template <typename Handler>
-	void serialize(Handler & h, const int version)
-	{
-		h & name & message & resources
-				& players & humanAffected & computerAffected & firstOccurence & nextOccurence;
-	}
-};
-
-/// The castle event builds/adds buildings/creatures for a specific town.
-class DLL_LINKAGE CCastleEvent: public CMapEvent
-{
-public:
-	CCastleEvent();
-
-	std::set<BuildingID> buildings;
-	std::vector<si32> creatures;
-	CGTownInstance * town;
-
-	template <typename Handler>
-	void serialize(Handler & h, const int version)
-	{
-		h & static_cast<CMapEvent &>(*this);
-		h & buildings & creatures;
-	}
-};
-
-/// The terrain tile describes the terrain type and the visual representation of the terrain.
-/// Furthermore the struct defines whether the tile is visitable or/and blocked and which objects reside in it.
-struct DLL_LINKAGE TerrainTile
-{
-	TerrainTile();
-
-	/// Gets true if the terrain is not a rock. If from is water/land, same type is also required.
-	bool entrableTerrain(const TerrainTile * from = nullptr) const;
-	bool entrableTerrain(bool allowLand, bool allowSea) const;
-	/// Checks for blocking objects and terraint type (water / land).
-	bool isClear(const TerrainTile * from = nullptr) const;
-	/// Gets the ID of the top visitable object or -1 if there is none.
-	Obj topVisitableId(bool excludeTop = false) const;
-	CGObjectInstance * topVisitableObj(bool excludeTop = false) const;
-	bool isWater() const;
-	bool isCoastal() const;
-	EDiggingStatus getDiggingStatus(const bool excludeTop = true) const;
-	bool hasFavourableWinds() const;
-
-	ETerrainType terType;
-	ui8 terView;
-	ERiverType::ERiverType riverType;
-	ui8 riverDir;
-	ERoadType::ERoadType roadType;
-	ui8 roadDir;
-	/// first two bits - how to rotate terrain graphic (next two - river graphic, next two - road);
-	///	7th bit - whether tile is coastal (allows disembarking if land or block movement if water); 8th bit - Favourable Winds effect
-	ui8 extTileFlags;
-	bool visitable;
-	bool blocked;
-
-	std::vector<CGObjectInstance *> visitableObjects;
-	std::vector<CGObjectInstance *> blockingObjects;
-
-	template <typename Handler>
-	void serialize(Handler & h, const int version)
-	{
-		h & terType & terView & riverType & riverDir & roadType &roadDir & extTileFlags;
-		h & visitable & blocked;
-		h & visitableObjects & blockingObjects;
-	}
-};
-
 namespace EMapFormat
 {
 enum EMapFormat

+ 99 - 0
lib/mapping/CMapDefines.h

@@ -0,0 +1,99 @@
+/*
+ * CMapDefines.h, part of VCMI engine
+ *
+ * Authors: listed in file AUTHORS in main folder
+ *
+ * License: GNU General Public License v2.0 or later
+ * Full text of license available in license.txt file, in main folder
+ *
+ */
+
+#pragma once
+
+/// 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
+{
+public:
+	CMapEvent();
+
+	bool earlierThan(const CMapEvent & other) const;
+	bool earlierThanOrEqual(const CMapEvent & other) const;
+
+	std::string name;
+	std::string message;
+	TResources resources;
+	ui8 players; // affected players, bit field?
+	ui8 humanAffected;
+	ui8 computerAffected;
+	ui32 firstOccurence;
+	ui32 nextOccurence; /// specifies after how many days the event will occur the next time; 0 if event occurs only one time
+
+	template <typename Handler>
+	void serialize(Handler & h, const int version)
+	{
+		h & name & message & resources
+				& players & humanAffected & computerAffected & firstOccurence & nextOccurence;
+	}
+};
+
+/// The castle event builds/adds buildings/creatures for a specific town.
+class DLL_LINKAGE CCastleEvent: public CMapEvent
+{
+public:
+	CCastleEvent();
+
+	std::set<BuildingID> buildings;
+	std::vector<si32> creatures;
+	CGTownInstance * town;
+
+	template <typename Handler>
+	void serialize(Handler & h, const int version)
+	{
+		h & static_cast<CMapEvent &>(*this);
+		h & buildings & creatures;
+	}
+};
+
+/// The terrain tile describes the terrain type and the visual representation of the terrain.
+/// Furthermore the struct defines whether the tile is visitable or/and blocked and which objects reside in it.
+struct DLL_LINKAGE TerrainTile
+{
+	TerrainTile();
+
+	/// Gets true if the terrain is not a rock. If from is water/land, same type is also required.
+	bool entrableTerrain(const TerrainTile * from = nullptr) const;
+	bool entrableTerrain(bool allowLand, bool allowSea) const;
+	/// Checks for blocking objects and terraint type (water / land).
+	bool isClear(const TerrainTile * from = nullptr) const;
+	/// Gets the ID of the top visitable object or -1 if there is none.
+	Obj topVisitableId(bool excludeTop = false) const;
+	CGObjectInstance * topVisitableObj(bool excludeTop = false) const;
+	bool isWater() const;
+	bool isCoastal() const;
+	EDiggingStatus getDiggingStatus(const bool excludeTop = true) const;
+	bool hasFavourableWinds() const;
+
+	ETerrainType terType;
+	ui8 terView;
+	ERiverType::ERiverType riverType;
+	ui8 riverDir;
+	ERoadType::ERoadType roadType;
+	ui8 roadDir;
+	/// first two bits - how to rotate terrain graphic (next two - river graphic, next two - road);
+	///	7th bit - whether tile is coastal (allows disembarking if land or block movement if water); 8th bit - Favourable Winds effect
+	ui8 extTileFlags;
+	bool visitable;
+	bool blocked;
+
+	std::vector<CGObjectInstance *> visitableObjects;
+	std::vector<CGObjectInstance *> blockingObjects;
+
+	template <typename Handler>
+	void serialize(Handler & h, const int version)
+	{
+		h & terType & terView & riverType & riverDir & roadType &roadDir & extTileFlags;
+		h & visitable & blocked;
+		h & visitableObjects & blockingObjects;
+	}
+};

+ 1 - 0
lib/mapping/CMapEditManager.cpp

@@ -7,6 +7,7 @@
 #include "../mapObjects/CGHeroInstance.h"
 #include "../VCMI_Lib.h"
 #include "CDrawRoadsOperation.h"
+#include "../mapping/CMap.h"
 
 MapRect::MapRect() : x(0), y(0), z(0), width(0), height(0)
 {

+ 3 - 1
lib/mapping/CMapEditManager.h

@@ -12,11 +12,13 @@
 #pragma once
 
 #include "../CRandomGenerator.h"
-#include "CMap.h"
+#include "../int3.h"
+#include "../GameConstants.h"
 
 class CGObjectInstance;
 class CTerrainViewPatternConfig;
 struct TerrainViewPattern;
+class CMap;
 
 /// Represents a map rectangle.
 struct DLL_LINKAGE MapRect

+ 1 - 0
lib/rmg/CZonePlacer.cpp

@@ -13,6 +13,7 @@
 #include "../CRandomGenerator.h"
 #include "CZonePlacer.h"
 #include "CRmgTemplateZone.h"
+#include "../mapping/CMap.h"
 
 #include "CZoneGraphGenerator.h"
 

+ 0 - 2
lib/rmg/CZonePlacer.h

@@ -12,8 +12,6 @@
 #pragma once
 
 #include "CMapGenerator.h"
-#include "../mapping/CMap.h"
-
 #include "float3.h"
 #include "../int3.h"
 

+ 1 - 0
lib/spells/AdventureSpellMechanics.cpp

@@ -18,6 +18,7 @@
 #include "../BattleState.h"
 #include "../CGameState.h"
 #include "../CGameInfoCallback.h"
+#include "../mapping/CMap.h"
 
 ///SummonBoatMechanics
 ESpellCastResult SummonBoatMechanics::applyAdventureEffects(const SpellCastEnvironment * env, AdventureSpellCastParameters & parameters) const

+ 1 - 0
lib/spells/BattleSpellMechanics.cpp

@@ -14,6 +14,7 @@
 #include "../NetPacks.h"
 #include "../BattleState.h"
 #include "../mapObjects/CGHeroInstance.h"
+#include "../mapObjects/CGTownInstance.h"
 
 ///HealingSpellMechanics
 void HealingSpellMechanics::applyBattleEffects(const SpellCastEnvironment * env, const BattleSpellCastParameters & parameters, SpellCastContext & ctx) const

+ 1 - 0
server/CQuery.cpp

@@ -2,6 +2,7 @@
 #include "CQuery.h"
 #include "CGameHandler.h"
 #include "../lib/BattleState.h"
+#include "../lib/mapObjects/MiscObjects.h"
 
 boost::mutex Queries::mx;