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

Removed includes of CGameState from headers

This commit is contained in:
Ivan Savenko 2015-12-02 21:39:53 +02:00
parent c3ce4b25df
commit 7b5a7f43ad
27 changed files with 165 additions and 142 deletions

View File

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

View File

@ -6,7 +6,7 @@
#include "../../lib/CTownHandler.h"
#include "../../lib/spells/CSpellHandler.h"
#include "../../lib/Connection.h"
#include "../../lib/CGameState.h"
//#include "../../lib/CGameState.h"
#include "../../lib/NetPacks.h"
#include "../../lib/CStopWatch.h"
@ -20,6 +20,8 @@
*
*/
class CCallback;
typedef const int3& crint3;
typedef const std::string& crstring;

View File

@ -5,6 +5,8 @@
#include "../../lib/mapObjects/MapObjects.h"
#include "../../lib/mapObjects/CommonConstructors.h"
#include "../../lib/CCreatureHandler.h"
#include "../../lib/CPathfinder.h"
#include "../../lib/CGameStateFwd.h"
#include "../../lib/VCMI_Lib.h"
#include "../../CCallback.h"
#include "VCAI.h"

View File

@ -3,6 +3,7 @@
#include "VCAI.h"
#include "Fuzzy.h"
#include "../../lib/mapping/CMap.h" //for victory conditions
#include "../../lib/CPathfinder.h"
/*
* Goals.cpp, part of VCMI engine

View File

@ -8,6 +8,7 @@
#include "../../lib/CConfigHandler.h"
#include "../../lib/CHeroHandler.h"
#include "../../lib/CModHandler.h"
#include "../../lib/CGameState.h"
/*

View File

@ -15,7 +15,7 @@
#include "../../lib/mapObjects/MiscObjects.h"
#include "../../lib/spells/CSpellHandler.h"
#include "../../lib/Connection.h"
#include "../../lib/CGameState.h"
//#include "../../lib/CGameState.h"
#include "../../lib/NetPacks.h"
#include "../../lib/CondSh.h"

View File

@ -18,12 +18,7 @@
#include "lib/spells/CSpellHandler.h"
#include "lib/CArtHandler.h"
#include "lib/GameConstants.h"
#ifdef min
#undef min
#endif
#ifdef max
#undef max
#endif
#include "lib/CPlayerState.h"
#include "lib/UnlockGuard.h"
/*

View File

@ -37,6 +37,7 @@
#include "../lib/CStopWatch.h"
#include "../lib/StartInfo.h"
#include "../lib/CGameState.h"
#include "../lib/CPlayerState.h"
#include "../lib/GameConstants.h"
#include "gui/CGuiHandler.h"
#include "windows/InfoWindows.h"

View File

@ -5,7 +5,6 @@
#include "../lib/CGameInterface.h"
#include "../lib/NetPacksBase.h"
#include "gui/CIntObject.h"
//#include "../lib/CGameState.h"
#ifdef __GNUC__
#define sprintf_s snprintf

View File

@ -25,6 +25,7 @@
#include "../lib/CGameState.h"
#include "../lib/BattleState.h"
#include "../lib/GameConstants.h"
#include "../lib/CPlayerState.h"
#include "gui/CGuiHandler.h"
#include "widgets/MiscWidgets.h"
#include "widgets/AdventureMapClasses.h"

View File

@ -13,13 +13,6 @@
*
*/
#ifdef max
#undef max
#endif
#ifdef min
#undef min
#endif
struct SDL_MouseMotionEvent;
// A point with x/y coordinate, used mostly for graphic rendering

View File

@ -19,6 +19,7 @@
#include "CModHandler.h"
#include "spells/CSpellHandler.h"
#include "mapping/CMap.h"
#include "CPlayerState.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

@ -62,79 +62,6 @@ namespace boost
class shared_mutex;
}
//numbers of creatures are exact numbers if detailed else they are quantity ids (1 - a few, 2 - several and so on; additionally 0 - unknown)
struct ArmyDescriptor : public std::map<SlotID, CStackBasicDescriptor>
{
bool isDetailed;
DLL_LINKAGE ArmyDescriptor(const CArmedInstance *army, bool detailed); //not detailed -> quantity ids as count
DLL_LINKAGE ArmyDescriptor();
DLL_LINKAGE int getStrength() const;
};
struct DLL_LINKAGE InfoAboutArmy
{
PlayerColor owner;
std::string name;
ArmyDescriptor army;
InfoAboutArmy();
InfoAboutArmy(const CArmedInstance *Army, bool detailed);
void initFromArmy(const CArmedInstance *Army, bool detailed);
};
struct DLL_LINKAGE InfoAboutHero : public InfoAboutArmy
{
private:
void assign(const InfoAboutHero & iah);
public:
struct DLL_LINKAGE Details
{
std::vector<si32> primskills;
si32 mana, luck, morale;
} *details;
const CHeroClass *hclass;
int portrait;
InfoAboutHero();
InfoAboutHero(const InfoAboutHero & iah);
InfoAboutHero(const CGHeroInstance *h, bool detailed);
~InfoAboutHero();
InfoAboutHero & operator=(const InfoAboutHero & iah);
void initFromHero(const CGHeroInstance *h, bool detailed);
};
/// Struct which holds a int information about a town
struct DLL_LINKAGE InfoAboutTown : public InfoAboutArmy
{
struct DLL_LINKAGE Details
{
si32 hallLevel, goldIncome;
bool customRes;
bool garrisonedHero;
} *details;
const CTown *tType;
si32 built;
si32 fortLevel; //0 - none
InfoAboutTown();
InfoAboutTown(const CGTownInstance *t, bool detailed);
~InfoAboutTown();
void initFromTown(const CGTownInstance *t, bool detailed);
};
// typedef si32 TResourceUnit;
// typedef std::vector<si32> TResourceVector;
// typedef std::set<si32> TResourceSet;
struct DLL_LINKAGE SThievesGuildInfo
{
std::vector<PlayerColor> playerColors; //colors of players that are in-game
@ -154,55 +81,6 @@ struct DLL_LINKAGE SThievesGuildInfo
};
struct DLL_LINKAGE PlayerState : public CBonusSystemNode
{
public:
PlayerColor color;
bool human; //true if human controlled player, false for AI
TeamID team;
TResources resources;
std::set<ObjectInstanceID> visitedObjects; // as a std::set, since most accesses here will be from visited status checks
std::vector<ConstTransitivePtr<CGHeroInstance> > heroes;
std::vector<ConstTransitivePtr<CGTownInstance> > towns;
std::vector<ConstTransitivePtr<CGHeroInstance> > availableHeroes; //heroes available in taverns
std::vector<ConstTransitivePtr<CGDwelling> > dwellings; //used for town growth
std::vector<QuestInfo> quests; //store info about all received quests
bool enteredWinningCheatCode, enteredLosingCheatCode; //if true, this player has entered cheat codes for loss / victory
EPlayerStatus::EStatus status;
boost::optional<ui8> daysWithoutCastle;
PlayerState();
std::string nodeName() const override;
template <typename Handler> void serialize(Handler &h, const int version)
{
h & color & human & team & resources & status;
h & heroes & towns & availableHeroes & dwellings & quests & visitedObjects;
h & getBonusList(); //FIXME FIXME FIXME
h & status & daysWithoutCastle;
h & enteredLosingCheatCode & enteredWinningCheatCode;
h & static_cast<CBonusSystemNode&>(*this);
}
};
struct DLL_LINKAGE TeamState : public CBonusSystemNode
{
public:
TeamID id; //position in gameState::teams
std::set<PlayerColor> players; // members of this team
std::vector<std::vector<std::vector<ui8> > > fogOfWarMap; //true - visible, false - hidden
TeamState();
template <typename Handler> void serialize(Handler &h, const int version)
{
h & id & players & fogOfWarMap;
h & static_cast<CBonusSystemNode&>(*this);
}
};
struct UpgradeInfo
{
CreatureID oldID; //creature to be upgraded
@ -271,7 +149,6 @@ struct DLL_EXPORT DuelParameters
}
};
struct BattleInfo;
DLL_LINKAGE std::ostream & operator<<(std::ostream & os, const EVictoryLossCheckResult & victoryLossCheckResult);

View File

@ -10,8 +10,81 @@
*
*/
#include "CCreatureSet.h"
class CQuest;
class CGObjectInstance;
class CHeroClass;
class CTown;
//numbers of creatures are exact numbers if detailed else they are quantity ids (1 - a few, 2 - several and so on; additionally 0 - unknown)
struct ArmyDescriptor : public std::map<SlotID, CStackBasicDescriptor>
{
bool isDetailed;
DLL_LINKAGE ArmyDescriptor(const CArmedInstance *army, bool detailed); //not detailed -> quantity ids as count
DLL_LINKAGE ArmyDescriptor();
DLL_LINKAGE int getStrength() const;
};
struct DLL_LINKAGE InfoAboutArmy
{
PlayerColor owner;
std::string name;
ArmyDescriptor army;
InfoAboutArmy();
InfoAboutArmy(const CArmedInstance *Army, bool detailed);
void initFromArmy(const CArmedInstance *Army, bool detailed);
};
struct DLL_LINKAGE InfoAboutHero : public InfoAboutArmy
{
private:
void assign(const InfoAboutHero & iah);
public:
struct DLL_LINKAGE Details
{
std::vector<si32> primskills;
si32 mana, luck, morale;
} *details;
const CHeroClass *hclass;
int portrait;
InfoAboutHero();
InfoAboutHero(const InfoAboutHero & iah);
InfoAboutHero(const CGHeroInstance *h, bool detailed);
~InfoAboutHero();
InfoAboutHero & operator=(const InfoAboutHero & iah);
void initFromHero(const CGHeroInstance *h, bool detailed);
};
/// Struct which holds a int information about a town
struct DLL_LINKAGE InfoAboutTown : public InfoAboutArmy
{
struct DLL_LINKAGE Details
{
si32 hallLevel, goldIncome;
bool customRes;
bool garrisonedHero;
} *details;
const CTown *tType;
si32 built;
si32 fortLevel; //0 - none
InfoAboutTown();
InfoAboutTown(const CGTownInstance *t, bool detailed);
~InfoAboutTown();
void initFromTown(const CGTownInstance *t, bool detailed);
};
class DLL_LINKAGE EVictoryLossCheckResult
{

View File

@ -132,6 +132,7 @@ set(lib_HEADERS
IGameEventsReceiver.h
int3.h
CGameStateFwd.h
CPlayerState.h
Interprocess.h
NetPacks.h
NetPacksBase.h

View File

@ -8,6 +8,7 @@
#include "GameConstants.h"
#include "CStopWatch.h"
#include "CConfigHandler.h"
#include "../lib/CPlayerState.h"
/*
* CPathfinder.cpp, part of VCMI engine

66
lib/CPlayerState.h Normal file
View File

@ -0,0 +1,66 @@
#pragma once
/*
* CPlayerState.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
*
*/
#include "HeroBonus.h"
class CGHeroInstance;
class CGTownInstance;
class CGDwelling;
struct DLL_LINKAGE PlayerState : public CBonusSystemNode
{
public:
PlayerColor color;
bool human; //true if human controlled player, false for AI
TeamID team;
TResources resources;
std::set<ObjectInstanceID> visitedObjects; // as a std::set, since most accesses here will be from visited status checks
std::vector<ConstTransitivePtr<CGHeroInstance> > heroes;
std::vector<ConstTransitivePtr<CGTownInstance> > towns;
std::vector<ConstTransitivePtr<CGHeroInstance> > availableHeroes; //heroes available in taverns
std::vector<ConstTransitivePtr<CGDwelling> > dwellings; //used for town growth
std::vector<QuestInfo> quests; //store info about all received quests
bool enteredWinningCheatCode, enteredLosingCheatCode; //if true, this player has entered cheat codes for loss / victory
EPlayerStatus::EStatus status;
boost::optional<ui8> daysWithoutCastle;
PlayerState();
std::string nodeName() const override;
template <typename Handler> void serialize(Handler &h, const int version)
{
h & color & human & team & resources & status;
h & heroes & towns & availableHeroes & dwellings & quests & visitedObjects;
h & getBonusList(); //FIXME FIXME FIXME
h & status & daysWithoutCastle;
h & enteredLosingCheatCode & enteredWinningCheatCode;
h & static_cast<CBonusSystemNode&>(*this);
}
};
struct DLL_LINKAGE TeamState : public CBonusSystemNode
{
public:
TeamID id; //position in gameState::teams
std::set<PlayerColor> players; // members of this team
std::vector<std::vector<std::vector<ui8> > > fogOfWarMap; //true - visible, false - hidden
TeamState();
template <typename Handler> void serialize(Handler &h, const int version)
{
h & id & players & fogOfWarMap;
h & static_cast<CBonusSystemNode&>(*this);
}
};

View File

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

View File

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

View File

@ -16,6 +16,7 @@
#include "CTownHandler.h"
#include "mapping/CMapInfo.h"
#include "StartInfo.h"
#include "CPlayerState.h"
/*
* NetPacksLib.cpp, part of VCMI engine

View File

@ -1,4 +1,4 @@
/*
/*
* CArmedInstance.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
@ -15,6 +15,7 @@
#include "../CCreatureHandler.h"
#include "../CGeneralTextHandler.h"
#include "../CGameState.h"
#include "../CPlayerState.h"
void CArmedInstance::randomizeArmy(int type)
{

View File

@ -18,6 +18,7 @@
#include "../IGameCallback.h"
#include "../CGameState.h"
#include "../mapping/CMapDefines.h"
#include "../CPlayerState.h"
std::vector<const CArtifact *> CGTownInstance::merchantArtifacts;
std::vector<int> CGTownInstance::universitySkills;

View File

@ -17,6 +17,7 @@
#include "../NetPacks.h"
#include "../IGameCallback.h"
#include "../CGameState.h"
#include "../CPlayerState.h"
#include "CObjectClassesHandler.h"

View File

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

View File

@ -4,7 +4,7 @@
#include "../NetPacks.h"
#include "../VCMI_Lib.h"
#include "../CArtHandler.h"
#include "../CGameState.h"
#include "../CPlayerState.h"
#include "../CHeroHandler.h"
#include "../CTownHandler.h"
#include "../CModHandler.h" //needed?

View File

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

View File

@ -2,7 +2,7 @@
#include "../lib/FunctionList.h"
#include "../lib/CGameState.h"
//#include "../lib/CGameState.h"
#include "../lib/Connection.h"
#include "../lib/IGameCallback.h"
#include "../lib/BattleAction.h"