Explorar el Código

Reduced number of #include's in headers. May break compilation on Win
since some net packs now need DLL_LINKAGE

Ivan Savenko hace 11 años
padre
commit
32240da34e

+ 1 - 0
AI/VCAI/VCAI.cpp

@@ -5,6 +5,7 @@
 #include "../../lib/mapObjects/MapObjects.h"
 #include "../../lib/CConfigHandler.h"
 #include "../../lib/CHeroHandler.h"
+#include "../../lib/CModHandler.h"
 
 
 /*

+ 1 - 0
client/NetPacksClient.cpp

@@ -15,6 +15,7 @@
 #include "../lib/VCMIDirs.h"
 #include "../lib/CSpellHandler.h"
 #include "../lib/CSoundBase.h"
+#include "../lib/StartInfo.h"
 #include "mapHandler.h"
 #include "GUIClasses.h"
 #include "../lib/CConfigHandler.h"

+ 1 - 0
client/battle/CBattleInterfaceClasses.cpp

@@ -17,6 +17,7 @@
 #include "../../lib/NetPacks.h"
 #include "../../lib/CCreatureHandler.h"
 #include "../../lib/BattleState.h"
+#include "../../lib/StartInfo.h"
 #include "../CMusicHandler.h"
 #include "../CVideoHandler.h"
 #include "../../lib/CTownHandler.h"

+ 2 - 4
lib/BattleState.cpp

@@ -365,13 +365,11 @@ BattleInfo * BattleInfo::setupBattle( int3 tile, ETerrainType terrain, BFieldTyp
 	if(town)
 	{
 		curB->town = town;
-		curB->siege = town->fortLevel();
 		curB->terrainType = VLC->townh->factions[town->subID]->nativeTerrain;
 	}
 	else
 	{
 		curB->town = nullptr;
-		curB->siege = CGTownInstance::NONE;
 		curB->terrainType = terrain;
 	}
 
@@ -574,13 +572,13 @@ BattleInfo * BattleInfo::setupBattle( int3 tile, ETerrainType terrain, BFieldTyp
 
 	}
 
-	if (curB->siege == CGTownInstance::CITADEL || curB->siege == CGTownInstance::CASTLE)
+	if (curB->town && curB->town->fortLevel() >= CGTownInstance::CITADEL)
 	{
 		// keep tower
 		CStack * stack = curB->generateNewStack(CStackBasicDescriptor(CreatureID::ARROW_TOWERS, 1), false, SlotID(255), -2);
 		stacks.push_back(stack);
 
-		if (curB->siege == CGTownInstance::CASTLE)
+		if (curB->town->fortLevel() >= CGTownInstance::CASTLE)
 		{
 			// lower tower + upper tower
 			CStack * stack = curB->generateNewStack(CStackBasicDescriptor(CreatureID::ARROW_TOWERS, 1), false, SlotID(255), -4);

+ 4 - 5
lib/BattleState.h

@@ -4,8 +4,8 @@
 #include "BattleHex.h"
 #include "HeroBonus.h"
 #include "CCreatureSet.h"
-#include "mapObjects/CGTownInstance.h"
-#include "mapObjects/CGHeroInstance.h"
+#include "mapObjects/CArmedInstance.h" // for army serialization
+#include "mapObjects/CGHeroInstance.h" // for commander serialization
 #include "CCreatureHandler.h"
 #include "CObstacleInstance.h"
 #include "ConstTransitivePtr.h"
@@ -83,8 +83,7 @@ struct DLL_LINKAGE BattleInfo : public CBonusSystemNode, public CBattleInfoCallb
 {
 	std::array<SideInBattle, 2> sides; //sides[0] - attacker, sides[1] - defender
 	si32 round, activeStack, selectedStack;
-	CGTownInstance::EFortLevel siege;
-	const CGTownInstance * town; //used during town siege - id of attacked town; -1 if not town defence
+	const CGTownInstance * town; //used during town siege, nullptr if this is not a siege (note that fortless town IS also a siege)
 	int3 tile; //for background and bonuses
 	std::vector<CStack*> stacks;
 	std::vector<shared_ptr<CObstacleInstance> > obstacles;
@@ -99,7 +98,7 @@ struct DLL_LINKAGE BattleInfo : public CBonusSystemNode, public CBattleInfoCallb
 	template <typename Handler> void serialize(Handler &h, const int version)
 	{
 		h & sides;
-		h & round & activeStack & selectedStack & siege & town & tile & stacks & obstacles
+		h & round & activeStack & selectedStack & town & tile & stacks & obstacles
 			& si & battlefieldType & terrainType;
 		h & tacticsSide & tacticDistance;
 		h & static_cast<CBonusSystemNode&>(*this);

+ 2 - 2
lib/CArtHandler.h

@@ -2,8 +2,8 @@
 
 
 #include "../lib/HeroBonus.h"
-#include "../lib/ConstTransitivePtr.h"
-#include "JsonNode.h"
+//#include "../lib/ConstTransitivePtr.h"
+//#include "JsonNode.h"
 #include "GameConstants.h"
 #include "IHandlerBase.h"
 

+ 2 - 2
lib/CBattleCallback.cpp

@@ -409,7 +409,7 @@ ui8 CBattleInfoEssentials::playerToSide(PlayerColor player) const
 ui8 CBattleInfoEssentials::battleGetSiegeLevel() const
 {
 	RETURN_IF_NOT_BATTLE(0);
-	return getBattle()->siege;
+	return getBattle()->town ? getBattle()->town->fortLevel() : CGTownInstance::NONE;
 }
 
 bool CBattleInfoEssentials::battleCanSurrender(PlayerColor player) const
@@ -429,7 +429,7 @@ bool CBattleInfoEssentials::battleHasHero(ui8 side) const
 si8 CBattleInfoEssentials::battleGetWallState(int partOfWall) const
 {
 	RETURN_IF_NOT_BATTLE(0);
-	if(getBattle()->siege == CGTownInstance::NONE)
+	if(getBattle()->town == nullptr || getBattle()->town->fortLevel() == CGTownInstance::NONE)
 		return EWallState::NONE;
 
 	assert(partOfWall >= 0 && partOfWall < EWallPart::PARTS_COUNT);

+ 1 - 0
lib/CGameInfoCallback.cpp

@@ -16,6 +16,7 @@
 #include "StartInfo.h" // for StartInfo
 #include "BattleState.h" // for BattleInfo
 #include "NetPacks.h" // for InfoWindow
+#include "CModHandler.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 - 53
lib/CGameState.cpp

@@ -3509,59 +3509,6 @@ CPathfinder::CPathfinder(CPathsInfo &_out, CGameState *_gs, const CGHeroInstance
 	allowEmbarkAndDisembark = true;
 }
 
-EVictoryLossCheckResult::EVictoryLossCheckResult() :
-	intValue(0)
-{
-}
-
-EVictoryLossCheckResult::EVictoryLossCheckResult(si32 intValue, std::string toSelf, std::string toOthers) :
-	messageToSelf(toSelf),
-	messageToOthers(toOthers),
-	intValue(intValue)
-{
-}
-
-bool EVictoryLossCheckResult::operator==(EVictoryLossCheckResult const & other) const
-{
-	return intValue == other.intValue;
-}
-
-bool EVictoryLossCheckResult::operator!=(EVictoryLossCheckResult const & other) const
-{
-	return intValue != other.intValue;
-}
-
-bool EVictoryLossCheckResult::victory() const
-{
-	return intValue == VICTORY;
-}
-
-bool EVictoryLossCheckResult::loss() const
-{
-	return intValue == DEFEAT;
-}
-
-EVictoryLossCheckResult EVictoryLossCheckResult::invert()
-{
-	return EVictoryLossCheckResult(-intValue, messageToOthers, messageToSelf);
-}
-
-EVictoryLossCheckResult EVictoryLossCheckResult::victory(std::string toSelf, std::string toOthers)
-{
-	return EVictoryLossCheckResult(VICTORY, toSelf, toOthers);
-}
-
-EVictoryLossCheckResult EVictoryLossCheckResult::defeat(std::string toSelf, std::string toOthers)
-{
-	return EVictoryLossCheckResult(DEFEAT, toSelf, toOthers);
-}
-
-std::ostream & operator<<(std::ostream & os, const EVictoryLossCheckResult & victoryLossCheckResult)
-{
-	os << victoryLossCheckResult.messageToSelf;
-	return os;
-}
-
 CRandomGenerator & CGameState::getRandomGenerator()
 {
 	return rand;

+ 1 - 65
lib/CGameState.h

@@ -15,6 +15,7 @@
 #include "ResourceSet.h"
 #include "int3.h"
 #include "CRandomGenerator.h"
+#include "CGameStateFwd.h"
 
 /*
  * CGameState.h, part of VCMI engine
@@ -355,39 +356,6 @@ public:
 
 struct BattleInfo;
 
-class DLL_LINKAGE EVictoryLossCheckResult
-{
-public:
-	static EVictoryLossCheckResult victory(std::string toSelf, std::string toOthers);
-	static EVictoryLossCheckResult defeat(std::string toSelf, std::string toOthers);
-
-	EVictoryLossCheckResult();
-	bool operator==(EVictoryLossCheckResult const & other) const;
-	bool operator!=(EVictoryLossCheckResult const & other) const;
-	bool victory() const;
-	bool loss() const;
-
-	EVictoryLossCheckResult invert();
-
-	std::string messageToSelf;
-	std::string messageToOthers;
-
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & intValue & messageToSelf & messageToOthers;
-	}
-private:
-	enum EResult
-	{
-		DEFEAT = -1,
-		INGAME =  0,
-		VICTORY= +1
-	};
-
-	EVictoryLossCheckResult(si32 intValue, std::string toSelf, std::string toOthers);
-	si32 intValue; // uses EResult
-};
-
 DLL_LINKAGE std::ostream & operator<<(std::ostream & os, const EVictoryLossCheckResult & victoryLossCheckResult);
 
 class DLL_LINKAGE CGameState : public CNonConstInfoCallback
@@ -533,35 +501,3 @@ private:
 	friend class CMapHandler;
 	friend class CGameHandler;
 };
-
-struct DLL_LINKAGE QuestInfo //universal interface for human and AI
-{
-	const CQuest * quest;
-	const CGObjectInstance * obj; //related object, most likely Seer Hut
-	int3 tile;
-
-	QuestInfo(){};
-	QuestInfo (const CQuest * Quest, const CGObjectInstance * Obj, int3 Tile) :
-		quest (Quest), obj (Obj), tile (Tile){};
-
-	//FIXME: assignment operator should return QuestInfo &
-	bool operator= (const QuestInfo &qi)
-	{
-		quest = qi.quest;
-		obj = qi.obj;
-		tile = qi.tile;
-		return true;
-	}
-
-	bool operator== (const QuestInfo & qi) const
-	{
-		return (quest == qi.quest && obj == qi.obj);
-	}
-
-	//std::vector<std::string> > texts //allow additional info for quest log?
-
-	template <typename Handler> void serialize(Handler &h, const int version)
-	{
-		h & quest & obj & tile;
-	}
-};

+ 120 - 0
lib/CGameStateFwd.h

@@ -0,0 +1,120 @@
+#pragma once
+
+/*
+ * CGameStateFwd.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
+ *
+ */
+
+class CQuest;
+class CGObjectInstance;
+
+class DLL_LINKAGE EVictoryLossCheckResult
+{
+public:
+	static EVictoryLossCheckResult victory(std::string toSelf, std::string toOthers)
+	{
+		return EVictoryLossCheckResult(VICTORY, toSelf, toOthers);
+	}
+
+	static EVictoryLossCheckResult defeat(std::string toSelf, std::string toOthers)
+	{
+		return EVictoryLossCheckResult(DEFEAT, toSelf, toOthers);
+	}
+
+	EVictoryLossCheckResult():
+	intValue(0)
+	{
+	}
+
+	bool operator==(EVictoryLossCheckResult const & other) const
+	{
+		return intValue == other.intValue;
+	}
+
+	bool operator!=(EVictoryLossCheckResult const & other) const
+	{
+		return intValue != other.intValue;
+	}
+
+	bool victory() const
+	{
+		return intValue == VICTORY;
+	}
+	bool loss() const
+	{
+		return intValue == DEFEAT;
+	}
+
+	EVictoryLossCheckResult invert()
+	{
+		return EVictoryLossCheckResult(-intValue, messageToOthers, messageToSelf);
+	}
+
+	std::string messageToSelf;
+	std::string messageToOthers;
+
+	template <typename Handler> void serialize(Handler &h, const int version)
+	{
+		h & intValue & messageToSelf & messageToOthers;
+	}
+private:
+	enum EResult
+	{
+		DEFEAT = -1,
+		INGAME =  0,
+		VICTORY= +1
+	};
+
+	EVictoryLossCheckResult(si32 intValue, std::string toSelf, std::string toOthers):
+		messageToSelf(toSelf),
+		messageToOthers(toOthers),
+		intValue(intValue)
+	{
+	}
+
+	si32 intValue; // uses EResult
+};
+
+/*static std::ostream & operator<<(std::ostream & os, const EVictoryLossCheckResult & victoryLossCheckResult)
+{
+	os << victoryLossCheckResult.messageToSelf;
+	return os;
+}*/
+
+struct DLL_LINKAGE QuestInfo //universal interface for human and AI
+{
+	const CQuest * quest;
+	const CGObjectInstance * obj; //related object, most likely Seer Hut
+	int3 tile;
+
+	QuestInfo(){};
+	QuestInfo (const CQuest * Quest, const CGObjectInstance * Obj, int3 Tile) :
+		quest (Quest), obj (Obj), tile (Tile){};
+
+	//FIXME: assignment operator should return QuestInfo &
+	bool operator= (const QuestInfo &qi)
+	{
+		quest = qi.quest;
+		obj = qi.obj;
+		tile = qi.tile;
+		return true;
+	}
+
+	bool operator== (const QuestInfo & qi) const
+	{
+		return (quest == qi.quest && obj == qi.obj);
+	}
+
+	//std::vector<std::string> > texts //allow additional info for quest log?
+
+	template <typename Handler> void serialize(Handler &h, const int version)
+	{
+		h & quest & obj & tile;
+	}
+};
+

+ 2 - 1
lib/CMakeLists.txt

@@ -82,6 +82,7 @@ set(lib_SRCS
 		ResourceSet.cpp
 		VCMI_Lib.cpp
 		VCMIDirs.cpp
+		IHandlerBase.cpp
 
 		IGameCallback.cpp
 		CGameInfoCallback.cpp
@@ -118,8 +119,8 @@ set(lib_HEADERS
 		GameConstants.h
 		StringConstants.h
 		IGameEventsReceiver.h
-		IHandlerBase.h
 		int3.h
+		CGameStateFwd.h
 		Interprocess.h
 		NetPacks.h
 		NetPacksBase.h

+ 3 - 0
lib/IGameCallback.cpp

@@ -15,9 +15,12 @@
 #include "CSpellHandler.h" // for CSpell
 #include "NetPacks.h"
 #include "CBonusTypeHandler.h"
+#include "CModHandler.h"
 
 #include "Connection.h" // for SAVEGAME_MAGIC
 #include "mapObjects/CObjectClassesHandler.h"
+#include "StartInfo.h"
+#include "CGameState.h"
 
 void CPrivilagedInfoCallback::getFreeTiles (std::vector<int3> &tiles) const
 {

+ 19 - 0
lib/IHandlerBase.cpp

@@ -0,0 +1,19 @@
+/*
+ * IHandlerBase.cpp, part of VCMI engine
+ *
+ * Authors: listed in file AUTHORS in main folder
+ *
+ * License: GNU General Public License v2.0 or later
+ * Full text of license available in license.txt file, in main folder
+ *
+ */
+
+#include "StdInc.h"
+#include "IHandlerBase.h"
+#include "CModHandler.h"
+
+
+void IHandlerBase::registerObject(std::string scope, std::string type_name, std::string name, si32 index)
+{
+	return VLC->modh->identifiers.registerObject(scope, type_name, name, index);
+}

+ 6 - 4
lib/IHandlerBase.h

@@ -11,7 +11,7 @@
  */
  #include "../lib/ConstTransitivePtr.h"
  #include "VCMI_Lib.h"
- #include "CModHandler.h"
+ //#include "CModHandler.h"
 
 class JsonNode;
 
@@ -22,6 +22,9 @@ class DLL_LINKAGE IHandlerBase
 	// Object * loadFromJson(const JsonNode & json);
 	// where Object is type of data loaded by handler
 	// primary used in loadObject methods
+protected:
+	/// Calls modhandler. Mostly needed to avoid large number of includes in headers
+	void registerObject(std::string scope, std::string type_name, std::string name, si32 index);
 
 public:
 	/// loads all original game data in vector of json nodes
@@ -48,7 +51,6 @@ public:
 	virtual ~IHandlerBase(){}
 };
 
-
 template <class _ObjectID, class _Object> class CHandlerBase: public IHandlerBase
 {
 public:
@@ -68,7 +70,7 @@ public:
 
 		objects.push_back(object);
 
-		VLC->modh->identifiers.registerObject(scope, type_name, name, object->id);
+		registerObject(scope, type_name, name, object->id);
 	}
 	void loadObject(std::string scope, std::string name, const JsonNode & data, size_t index) override
 	{
@@ -80,7 +82,7 @@ public:
 		assert(objects[index] == nullptr); // ensure that this id was not loaded before
 		objects[index] = object;
 
-		VLC->modh->identifiers.registerObject(scope,type_name, name, object->id);
+		registerObject(scope,type_name, name, object->id);
 
 	}
 

+ 13 - 18
lib/NetPacks.h

@@ -3,16 +3,18 @@
 #include "NetPacksBase.h"
 
 #include "BattleAction.h"
-#include "HeroBonus.h"
+//#include "HeroBonus.h"
 #include "mapObjects/CGHeroInstance.h"
-#include "CCreatureSet.h"
-#include "mapping/CMapInfo.h"
-#include "StartInfo.h"
+//#include "CCreatureSet.h"
+//#include "mapping/CMapInfo.h"
+//#include "StartInfo.h"
 #include "ConstTransitivePtr.h"
 #include "int3.h"
 #include "ResourceSet.h"
+//#include "CObstacleInstance.h"
+#include "CGameStateFwd.h"
+#include "mapping/CMap.h"
 #include "CObstacleInstance.h"
-#include "CGameState.h"
 
 /*
  * NetPacks.h, part of VCMI engine
@@ -37,7 +39,8 @@ class CArtifactInstance;
 struct StackLocation;
 struct ArtSlotInfo;
 struct QuestInfo;
-
+class CMapInfo;
+class StartInfo;
 
 
 struct CPackForClient : public CPack
@@ -2127,7 +2130,7 @@ struct PlayerJoined : public CPregamePackToHost
 	}
 };
 
-struct SelectMap : public CPregamePackToPropagate
+struct DLL_LINKAGE SelectMap : public CPregamePackToPropagate
 {
 	const CMapInfo *mapInfo;
 	bool free;
@@ -2142,11 +2145,7 @@ struct SelectMap : public CPregamePackToPropagate
 		mapInfo = nullptr;
 		free = true;
 	}
-	~SelectMap()
-	{
-		if(free)
-			delete mapInfo;
-	}
+	DLL_LINKAGE ~SelectMap();
 
 	void apply(CSelectionScreen *selScreen); //that functions are implemented in CPreGame.cpp
 
@@ -2157,7 +2156,7 @@ struct SelectMap : public CPregamePackToPropagate
 
 };
 
-struct UpdateStartOptions : public CPregamePackToPropagate
+struct DLL_LINKAGE UpdateStartOptions : public CPregamePackToPropagate
 {
 	StartInfo *options;
 	bool free;
@@ -2174,11 +2173,7 @@ struct UpdateStartOptions : public CPregamePackToPropagate
 		options = nullptr;
 		free = true;
 	}
-	~UpdateStartOptions()
-	{
-		if(free)
-			delete options;
-	}
+	DLL_LINKAGE ~UpdateStartOptions();
 
 	template <typename Handler> void serialize(Handler &h, const int version)
 	{

+ 15 - 1
lib/NetPacksLib.cpp

@@ -14,6 +14,8 @@
 #include "CGameState.h"
 #include "BattleState.h"
 #include "CTownHandler.h"
+#include "mapping/CMapInfo.h"
+#include "StartInfo.h"
 
 /*
  * NetPacksLib.cpp, part of VCMI engine
@@ -60,6 +62,18 @@ DLL_LINKAGE void SetSecSkill::applyGs( CGameState *gs )
 	hero->setSecSkillLevel(which, val, abs);
 }
 
+DLL_LINKAGE SelectMap::~SelectMap()
+{
+	if(free)
+		delete mapInfo;
+}
+
+DLL_LINKAGE UpdateStartOptions::~UpdateStartOptions()
+{
+	if(free)
+		delete options;
+}
+
 DLL_LINKAGE void SetCommanderProperty::applyGs(CGameState *gs)
 {
 	CCommanderInstance * commander = gs->getHero(heroid)->commander;
@@ -1501,7 +1515,7 @@ DLL_LINKAGE CatapultAttack::~CatapultAttack()
 
 DLL_LINKAGE void CatapultAttack::applyGs( CGameState *gs )
 {
-	if(gs->curB && gs->curB->siege != CGTownInstance::NONE) //if there is a battle and it's a siege
+	if(gs->curB && gs->curB->town && gs->curB->town->fortLevel() != CGTownInstance::NONE) //if there is a battle and it's a siege
 	{
 		for(const auto &it :attackedParts)
 		{

+ 3 - 0
lib/mapObjects/CArmedInstance.h

@@ -13,6 +13,9 @@
  *
  */
 
+class BattleInfo;
+class CGameState;
+
 class DLL_LINKAGE CArmedInstance: public CGObjectInstance, public CBonusSystemNode, public CCreatureSet
 {
 public:

+ 2 - 0
lib/mapObjects/CBank.cpp

@@ -16,6 +16,8 @@
 #include "../CSoundBase.h"
 #include "CommonConstructors.h"
 #include "../CSpellHandler.h"
+#include "../IGameCallback.h"
+#include "../CGameState.h"
 
 using namespace boost::assign;
 

+ 4 - 1
lib/mapObjects/CGHeroInstance.cpp

@@ -14,10 +14,13 @@
 #include "../NetPacks.h"
 #include "../CGeneralTextHandler.h"
 #include "../CHeroHandler.h"
+#include "../CModHandler.h"
 #include "../CSoundBase.h"
 #include "../CSpellHandler.h"
 #include "CObjectClassesHandler.h"
-
+#include "../IGameCallback.h"
+#include "../CGameState.h"
+#include "../CCreatureHandler.h"
 
 using namespace boost::assign;
 

+ 2 - 0
lib/mapObjects/CGHeroInstance.h

@@ -18,6 +18,8 @@
 
 class CHero;
 class CGBoat;
+class CGTownInstance;
+class TerrainTile;
 
 class CGHeroPlaceholder : public CGObjectInstance
 {

+ 3 - 0
lib/mapObjects/CGMarket.cpp

@@ -14,6 +14,9 @@
 
 #include "../NetPacks.h"
 #include "../CGeneralTextHandler.h"
+#include "../IGameCallback.h"
+#include "../CCreatureHandler.h"
+#include "../CGameState.h"
 
 using namespace boost::assign;
 

+ 2 - 0
lib/mapObjects/CGPandoraBox.cpp

@@ -15,6 +15,8 @@
 #include "../CSoundBase.h"
 
 #include "../CSpellHandler.h"
+#include "../StartInfo.h"
+#include "../IGameCallback.h"
 
 using namespace boost::assign;
 

+ 3 - 0
lib/mapObjects/CGPandoraBox.h

@@ -2,6 +2,7 @@
 
 #include "CObjectHandler.h"
 #include "CArmedInstance.h"
+#include "../ResourceSet.h"
 
 /*
  * CGPandoraBox.h, part of VCMI engine
@@ -13,6 +14,8 @@
  *
  */
 
+class InfoWindow;
+
 class DLL_LINKAGE CGPandoraBox : public CArmedInstance
 {
 public:

+ 3 - 0
lib/mapObjects/CGTownInstance.cpp

@@ -14,6 +14,9 @@
 
 #include "../NetPacks.h"
 #include "../CGeneralTextHandler.h"
+#include "../CModHandler.h"
+#include "../IGameCallback.h"
+#include "../CGameState.h"
 
 using namespace boost::assign;
 

+ 1 - 0
lib/mapObjects/CGTownInstance.h

@@ -17,6 +17,7 @@
  */
 
 class CCastleEvent;
+class CGTownInstance;
 
 class DLL_LINKAGE CSpecObjInfo
 {

+ 1 - 0
lib/mapObjects/CObjectClassesHandler.h

@@ -5,6 +5,7 @@
 #include "../GameConstants.h"
 #include "../ConstTransitivePtr.h"
 #include "../IHandlerBase.h"
+#include "../JsonNode.h"
 
 /*
  * CObjectClassesHandler.h, part of VCMI engine

+ 3 - 0
lib/mapObjects/CObjectHandler.cpp

@@ -15,6 +15,9 @@
 #include "../CGeneralTextHandler.h"
 #include "../CHeroHandler.h"
 #include "../CSoundBase.h"
+#include "../filesystem/ResourceID.h"
+#include "../IGameCallback.h"
+#include "../CGameState.h"
 
 #include "CObjectClassesHandler.h"
 

+ 4 - 1
lib/mapObjects/CObjectHandler.h

@@ -2,7 +2,7 @@
 
 #include "ObjectTemplate.h"
 
-#include "../IGameCallback.h"
+//#include "../IGameCallback.h"
 #include "../int3.h"
 #include "../HeroBonus.h"
 
@@ -17,6 +17,9 @@
  */
 
 class CGHeroInstance;
+class IGameCallback;
+class CGObjectInstance;
+class MetaString;
 struct BattleResult;
 
 class DLL_LINKAGE IObjectInterface

+ 2 - 0
lib/mapObjects/CQuest.cpp

@@ -17,6 +17,8 @@
 #include "../CGeneralTextHandler.h"
 #include "../CHeroHandler.h"
 #include "CObjectClassesHandler.h"
+#include "../IGameCallback.h"
+#include "../CGameState.h"
 
 using namespace boost::assign;
 

+ 2 - 0
lib/mapObjects/CQuest.h

@@ -16,6 +16,8 @@
  *
  */
 
+class CGCreature;
+
 class DLL_LINKAGE CQuest
 {
 public:

+ 1 - 0
lib/mapObjects/CRewardableConstructor.cpp

@@ -5,6 +5,7 @@
 #include "../StringConstants.h"
 #include "../CCreatureHandler.h"
 #include "JsonRandom.h"
+#include "../IGameCallback.h"
 
 /*
  * CRewardableConstructor.cpp, part of VCMI engine

+ 2 - 0
lib/mapObjects/CRewardableObject.cpp

@@ -15,6 +15,8 @@
 #include "../CGeneralTextHandler.h"
 #include "../CSoundBase.h"
 #include "../NetPacks.h"
+#include "../IGameCallback.h"
+#include "../CGameState.h"
 
 #include "CObjectClassesHandler.h"
 

+ 1 - 0
lib/mapObjects/CRewardableObject.h

@@ -4,6 +4,7 @@
 #include "CArmedInstance.h"
 
 #include "../NetPacksBase.h"
+#include "../ResourceSet.h"
 
 /*
  * CRewardableObject.h, part of VCMI engine

+ 2 - 0
lib/mapObjects/CommonConstructors.cpp

@@ -8,6 +8,8 @@
 #include "../CHeroHandler.h"
 #include "../CCreatureHandler.h"
 #include "JsonRandom.h"
+#include "../CModHandler.h"
+#include "../IGameCallback.h"
 
 /*
  * CommonConstructors.cpp, part of VCMI engine

+ 3 - 0
lib/mapObjects/MiscObjects.cpp

@@ -14,9 +14,12 @@
 #include "../NetPacks.h"
 #include "../CGeneralTextHandler.h"
 #include "../CSoundBase.h"
+#include "../CModHandler.h"
 
 #include "CObjectClassesHandler.h"
 #include "../CSpellHandler.h"
+#include "../IGameCallback.h"
+#include "../CGameState.h"
 
 using namespace boost::assign;
 

+ 1 - 0
lib/mapObjects/MiscObjects.h

@@ -2,6 +2,7 @@
 
 #include "CObjectHandler.h"
 #include "CArmedInstance.h"
+#include "../ResourceSet.h"
 
 /*
  * MiscObjects.h, part of VCMI engine

+ 1 - 0
lib/registerTypes/RegisterTypes.h

@@ -12,6 +12,7 @@
 #include "../mapObjects/CRewardableConstructor.h"
 #include "../mapObjects/CommonConstructors.h"
 #include "../mapObjects/MapObjects.h"
+#include "../CObstacleInstance.h"
 
 /*
  * RegisterTypes.h, part of VCMI engine

+ 1 - 1
server/CGameHandler.cpp

@@ -5225,7 +5225,7 @@ void CGameHandler::checkVictoryLossConditionsForPlayer(PlayerColor player)
 	}
 }
 
-void CGameHandler::getVictoryLossMessage(PlayerColor player, EVictoryLossCheckResult victoryLossCheckResult, InfoWindow & out) const
+void CGameHandler::getVictoryLossMessage(PlayerColor player, const EVictoryLossCheckResult & victoryLossCheckResult, InfoWindow & out) const
 {
 	out.player = player;
 	out.text.clear();

+ 1 - 1
server/CGameHandler.h

@@ -290,7 +290,7 @@ public:
 private:
 	std::list<PlayerColor> generatePlayerTurnOrder() const;
 	void makeStackDoNothing(const CStack * next);
-	void getVictoryLossMessage(PlayerColor player, EVictoryLossCheckResult victoryLossCheckResult, InfoWindow & out) const;
+	void getVictoryLossMessage(PlayerColor player, const EVictoryLossCheckResult & victoryLossCheckResult, InfoWindow & out) const;
 
 	// Check for victory and loss conditions
 	void checkVictoryLossConditionsForPlayer(PlayerColor player);