1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

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
This commit is contained in:
Ivan Savenko 2015-12-02 21:05:10 +02:00
parent bef7048460
commit c3ce4b25df
33 changed files with 151 additions and 119 deletions

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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
*

View File

@ -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
{

View File

@ -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

View File

@ -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)

View File

@ -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"

View File

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

View File

@ -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
{

View File

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

View File

@ -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

View File

@ -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
{

View File

@ -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"

View File

@ -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)

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

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

View File

@ -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

View File

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

View File

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

View File

@ -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
lib/mapping/CMapDefines.h Normal file
View File

@ -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;
}
};

View File

@ -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)
{

View File

@ -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

View File

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

View File

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

View File

@ -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

View File

@ -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

View File

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