From 32240da34eba95cc17f72075d52ff574b4172958 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Wed, 25 Jun 2014 17:11:07 +0300 Subject: [PATCH] Reduced number of #include's in headers. May break compilation on Win since some net packs now need DLL_LINKAGE --- AI/VCAI/VCAI.cpp | 1 + client/NetPacksClient.cpp | 1 + client/battle/CBattleInterfaceClasses.cpp | 1 + lib/BattleState.cpp | 6 +- lib/BattleState.h | 9 +- lib/CArtHandler.h | 4 +- lib/CBattleCallback.cpp | 4 +- lib/CGameInfoCallback.cpp | 1 + lib/CGameState.cpp | 53 ---------- lib/CGameState.h | 66 +----------- lib/CGameStateFwd.h | 120 ++++++++++++++++++++++ lib/CMakeLists.txt | 3 +- lib/IGameCallback.cpp | 3 + lib/IHandlerBase.cpp | 19 ++++ lib/IHandlerBase.h | 10 +- lib/NetPacks.h | 31 +++--- lib/NetPacksLib.cpp | 16 ++- lib/mapObjects/CArmedInstance.h | 3 + lib/mapObjects/CBank.cpp | 2 + lib/mapObjects/CGHeroInstance.cpp | 5 +- lib/mapObjects/CGHeroInstance.h | 2 + lib/mapObjects/CGMarket.cpp | 3 + lib/mapObjects/CGPandoraBox.cpp | 2 + lib/mapObjects/CGPandoraBox.h | 3 + lib/mapObjects/CGTownInstance.cpp | 3 + lib/mapObjects/CGTownInstance.h | 1 + lib/mapObjects/CObjectClassesHandler.h | 1 + lib/mapObjects/CObjectHandler.cpp | 3 + lib/mapObjects/CObjectHandler.h | 5 +- lib/mapObjects/CQuest.cpp | 2 + lib/mapObjects/CQuest.h | 2 + lib/mapObjects/CRewardableConstructor.cpp | 1 + lib/mapObjects/CRewardableObject.cpp | 2 + lib/mapObjects/CRewardableObject.h | 1 + lib/mapObjects/CommonConstructors.cpp | 2 + lib/mapObjects/MiscObjects.cpp | 3 + lib/mapObjects/MiscObjects.h | 1 + lib/registerTypes/RegisterTypes.h | 1 + server/CGameHandler.cpp | 2 +- server/CGameHandler.h | 2 +- 40 files changed, 241 insertions(+), 159 deletions(-) create mode 100644 lib/CGameStateFwd.h create mode 100644 lib/IHandlerBase.cpp diff --git a/AI/VCAI/VCAI.cpp b/AI/VCAI/VCAI.cpp index f850d1996..c18d5ca18 100644 --- a/AI/VCAI/VCAI.cpp +++ b/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" /* diff --git a/client/NetPacksClient.cpp b/client/NetPacksClient.cpp index 7f6f5028c..29d36f43f 100644 --- a/client/NetPacksClient.cpp +++ b/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" diff --git a/client/battle/CBattleInterfaceClasses.cpp b/client/battle/CBattleInterfaceClasses.cpp index fcf3d878e..cbfa489bc 100644 --- a/client/battle/CBattleInterfaceClasses.cpp +++ b/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" diff --git a/lib/BattleState.cpp b/lib/BattleState.cpp index 8b8395157..fb2b1eeff 100644 --- a/lib/BattleState.cpp +++ b/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); diff --git a/lib/BattleState.h b/lib/BattleState.h index 3d8ac4587..4eb774f4d 100644 --- a/lib/BattleState.h +++ b/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 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 stacks; std::vector > obstacles; @@ -99,7 +98,7 @@ struct DLL_LINKAGE BattleInfo : public CBonusSystemNode, public CBattleInfoCallb template 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(*this); diff --git a/lib/CArtHandler.h b/lib/CArtHandler.h index 592e1de58..805cc6aeb 100644 --- a/lib/CArtHandler.h +++ b/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" diff --git a/lib/CBattleCallback.cpp b/lib/CBattleCallback.cpp index 1744ca27a..10692aa8d 100644 --- a/lib/CBattleCallback.cpp +++ b/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); diff --git a/lib/CGameInfoCallback.cpp b/lib/CGameInfoCallback.cpp index 5281bccb1..2f249dec8 100644 --- a/lib/CGameInfoCallback.cpp +++ b/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) diff --git a/lib/CGameState.cpp b/lib/CGameState.cpp index 110521f73..a5fe9923b 100644 --- a/lib/CGameState.cpp +++ b/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; diff --git a/lib/CGameState.h b/lib/CGameState.h index 0d8a8c8f2..222e9ce76 100644 --- a/lib/CGameState.h +++ b/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 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 > texts //allow additional info for quest log? - - template void serialize(Handler &h, const int version) - { - h & quest & obj & tile; - } -}; diff --git a/lib/CGameStateFwd.h b/lib/CGameStateFwd.h new file mode 100644 index 000000000..b284373e3 --- /dev/null +++ b/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 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 > texts //allow additional info for quest log? + + template void serialize(Handler &h, const int version) + { + h & quest & obj & tile; + } +}; + diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index f426a13a6..62764080e 100644 --- a/lib/CMakeLists.txt +++ b/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 diff --git a/lib/IGameCallback.cpp b/lib/IGameCallback.cpp index 98bcf2c4a..7712b192b 100644 --- a/lib/IGameCallback.cpp +++ b/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 &tiles) const { diff --git a/lib/IHandlerBase.cpp b/lib/IHandlerBase.cpp new file mode 100644 index 000000000..bddbae3ba --- /dev/null +++ b/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); +} diff --git a/lib/IHandlerBase.h b/lib/IHandlerBase.h index 2ae74235e..c26b6f944 100644 --- a/lib/IHandlerBase.h +++ b/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 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); } diff --git a/lib/NetPacks.h b/lib/NetPacks.h index 9a6bbf182..f82189e48 100644 --- a/lib/NetPacks.h +++ b/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 void serialize(Handler &h, const int version) { diff --git a/lib/NetPacksLib.cpp b/lib/NetPacksLib.cpp index 2dfe20ef6..7504af7db 100644 --- a/lib/NetPacksLib.cpp +++ b/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) { diff --git a/lib/mapObjects/CArmedInstance.h b/lib/mapObjects/CArmedInstance.h index f85b8a07e..f80b94d76 100644 --- a/lib/mapObjects/CArmedInstance.h +++ b/lib/mapObjects/CArmedInstance.h @@ -13,6 +13,9 @@ * */ +class BattleInfo; +class CGameState; + class DLL_LINKAGE CArmedInstance: public CGObjectInstance, public CBonusSystemNode, public CCreatureSet { public: diff --git a/lib/mapObjects/CBank.cpp b/lib/mapObjects/CBank.cpp index 076b1d131..34c980cf6 100644 --- a/lib/mapObjects/CBank.cpp +++ b/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; diff --git a/lib/mapObjects/CGHeroInstance.cpp b/lib/mapObjects/CGHeroInstance.cpp index 0d62cf0ae..83028ef8f 100644 --- a/lib/mapObjects/CGHeroInstance.cpp +++ b/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; diff --git a/lib/mapObjects/CGHeroInstance.h b/lib/mapObjects/CGHeroInstance.h index a593e40d7..4e762dfa7 100644 --- a/lib/mapObjects/CGHeroInstance.h +++ b/lib/mapObjects/CGHeroInstance.h @@ -18,6 +18,8 @@ class CHero; class CGBoat; +class CGTownInstance; +class TerrainTile; class CGHeroPlaceholder : public CGObjectInstance { diff --git a/lib/mapObjects/CGMarket.cpp b/lib/mapObjects/CGMarket.cpp index 98205974e..e7db026f9 100644 --- a/lib/mapObjects/CGMarket.cpp +++ b/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; diff --git a/lib/mapObjects/CGPandoraBox.cpp b/lib/mapObjects/CGPandoraBox.cpp index 8f102e0a0..2dd5e1db2 100644 --- a/lib/mapObjects/CGPandoraBox.cpp +++ b/lib/mapObjects/CGPandoraBox.cpp @@ -15,6 +15,8 @@ #include "../CSoundBase.h" #include "../CSpellHandler.h" +#include "../StartInfo.h" +#include "../IGameCallback.h" using namespace boost::assign; diff --git a/lib/mapObjects/CGPandoraBox.h b/lib/mapObjects/CGPandoraBox.h index 227615cdf..fb14be309 100644 --- a/lib/mapObjects/CGPandoraBox.h +++ b/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: diff --git a/lib/mapObjects/CGTownInstance.cpp b/lib/mapObjects/CGTownInstance.cpp index ef61d5cd3..6404f1558 100644 --- a/lib/mapObjects/CGTownInstance.cpp +++ b/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; diff --git a/lib/mapObjects/CGTownInstance.h b/lib/mapObjects/CGTownInstance.h index a1102bca1..678d2b2ff 100644 --- a/lib/mapObjects/CGTownInstance.h +++ b/lib/mapObjects/CGTownInstance.h @@ -17,6 +17,7 @@ */ class CCastleEvent; +class CGTownInstance; class DLL_LINKAGE CSpecObjInfo { diff --git a/lib/mapObjects/CObjectClassesHandler.h b/lib/mapObjects/CObjectClassesHandler.h index 95b32fc49..403b18830 100644 --- a/lib/mapObjects/CObjectClassesHandler.h +++ b/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 diff --git a/lib/mapObjects/CObjectHandler.cpp b/lib/mapObjects/CObjectHandler.cpp index 54f73d843..e658cb134 100644 --- a/lib/mapObjects/CObjectHandler.cpp +++ b/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" diff --git a/lib/mapObjects/CObjectHandler.h b/lib/mapObjects/CObjectHandler.h index 4faaa0f92..1469c1395 100644 --- a/lib/mapObjects/CObjectHandler.h +++ b/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 diff --git a/lib/mapObjects/CQuest.cpp b/lib/mapObjects/CQuest.cpp index 368c3493a..ad301eb61 100644 --- a/lib/mapObjects/CQuest.cpp +++ b/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; diff --git a/lib/mapObjects/CQuest.h b/lib/mapObjects/CQuest.h index 788969106..884acb807 100644 --- a/lib/mapObjects/CQuest.h +++ b/lib/mapObjects/CQuest.h @@ -16,6 +16,8 @@ * */ +class CGCreature; + class DLL_LINKAGE CQuest { public: diff --git a/lib/mapObjects/CRewardableConstructor.cpp b/lib/mapObjects/CRewardableConstructor.cpp index e5b02e0c9..3d4c27112 100644 --- a/lib/mapObjects/CRewardableConstructor.cpp +++ b/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 diff --git a/lib/mapObjects/CRewardableObject.cpp b/lib/mapObjects/CRewardableObject.cpp index 94c7b6386..4b8561e48 100644 --- a/lib/mapObjects/CRewardableObject.cpp +++ b/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" diff --git a/lib/mapObjects/CRewardableObject.h b/lib/mapObjects/CRewardableObject.h index a32abcedd..9905ae238 100644 --- a/lib/mapObjects/CRewardableObject.h +++ b/lib/mapObjects/CRewardableObject.h @@ -4,6 +4,7 @@ #include "CArmedInstance.h" #include "../NetPacksBase.h" +#include "../ResourceSet.h" /* * CRewardableObject.h, part of VCMI engine diff --git a/lib/mapObjects/CommonConstructors.cpp b/lib/mapObjects/CommonConstructors.cpp index 14f45fd9c..af259e564 100644 --- a/lib/mapObjects/CommonConstructors.cpp +++ b/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 diff --git a/lib/mapObjects/MiscObjects.cpp b/lib/mapObjects/MiscObjects.cpp index 7e596288e..d5e9fa2d8 100644 --- a/lib/mapObjects/MiscObjects.cpp +++ b/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; diff --git a/lib/mapObjects/MiscObjects.h b/lib/mapObjects/MiscObjects.h index 01d6d813f..ca1601c6a 100644 --- a/lib/mapObjects/MiscObjects.h +++ b/lib/mapObjects/MiscObjects.h @@ -2,6 +2,7 @@ #include "CObjectHandler.h" #include "CArmedInstance.h" +#include "../ResourceSet.h" /* * MiscObjects.h, part of VCMI engine diff --git a/lib/registerTypes/RegisterTypes.h b/lib/registerTypes/RegisterTypes.h index d8de270c7..8bf37da4d 100644 --- a/lib/registerTypes/RegisterTypes.h +++ b/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 diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index 703ac2346..93bcbc02b 100644 --- a/server/CGameHandler.cpp +++ b/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(); diff --git a/server/CGameHandler.h b/server/CGameHandler.h index 1b91ee901..1a3791522 100644 --- a/server/CGameHandler.h +++ b/server/CGameHandler.h @@ -290,7 +290,7 @@ public: private: std::list 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);