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

[refactor] extract often used classes from lib\NetPacks.h to separate header - less dependecies on whole packets class tree

[mingw build] fix linking issues with netpacks. 
Mingw build is finally fixed! 

[c::b] update projects

[config] fix and cleanup spell_info.json
This commit is contained in:
alexvins 2014-01-16 20:24:06 +00:00
parent 47c91e03b5
commit 16d6292be9
15 changed files with 256 additions and 227 deletions

View File

@ -454,7 +454,7 @@ TGoalVec ClearWayTo::getAllPossibleSubgoals()
std::string Explore::completeMessage() const
{
return "Hero " + hero.get()->name + " completed exploration";
};
}
TSubgoal Explore::whatToDoToAchieve()
{
@ -468,7 +468,7 @@ TSubgoal Explore::whatToDoToAchieve()
else
return ret; //other solutions, like buying hero from tavern
}
};
}
TGoalVec Explore::getAllPossibleSubgoals()
{
@ -539,7 +539,7 @@ TGoalVec Explore::getAllPossibleSubgoals()
//throw cannotFulfillGoalException("Cannot explore - no possible ways found!");
return ret;
};
}
bool Explore::fulfillsMe (TSubgoal goal)
{
@ -825,7 +825,7 @@ TSubgoal Invalid::whatToDoToAchieve()
std::string GatherArmy::completeMessage() const
{
return "Hero " + hero.get()->name + " gathered army of value " + boost::lexical_cast<std::string>(value);
};
}
TSubgoal GatherArmy::whatToDoToAchieve()
{

View File

@ -57,8 +57,12 @@
<Add directory="$(#boost.lib)" />
<Add directory="../.." />
</Linker>
<Unit filename="AIUtility.cpp" />
<Unit filename="AIUtility.h" />
<Unit filename="Fuzzy.cpp" />
<Unit filename="Fuzzy.h" />
<Unit filename="Goals.cpp" />
<Unit filename="Goals.h" />
<Unit filename="StdInc.h">
<Option weight="0" />
</Unit>

View File

@ -10,7 +10,7 @@
#include "../lib/CGameState.h"
#include "../lib/CGeneralTextHandler.h"
#include "../lib/CTownHandler.h"
#include "../lib/NetPacks.h"
#include "../lib/NetPacksBase.h"
#include "../lib/CHeroHandler.h"
#include "../lib/StringConstants.h"
#include "CAdvmapInterface.h"

View File

@ -20,7 +20,7 @@
#include "../lib/BattleState.h"
#include "../lib/CSpellHandler.h"
#include "../lib/CArtHandler.h"
#include "../lib/NetPacks.h" //ArtifactLocation
#include "../lib/NetPacksBase.h" //ArtifactLocation
#include "../lib/CModHandler.h"
#include "../lib/IBonusTypeHandler.h"

View File

@ -21,7 +21,7 @@
#include "../lib/CGeneralTextHandler.h"
#include "../lib/CHeroHandler.h"
#include "../lib/CObjectHandler.h"
#include "../lib/NetPacks.h"
#include "../lib/NetPacksBase.h"
#include "gui/CGuiHandler.h"
#include "gui/CIntObjectClasses.h"

View File

@ -15,7 +15,7 @@
#include "../lib/CGameState.h"
#include "../lib/CArtHandler.h"
#include "../lib/NetPacks.h"
#include "../lib/NetPacksBase.h"
#include "../lib/CObjectHandler.h"
#include "gui/CGuiHandler.h"

View File

@ -31,7 +31,7 @@
#include "../lib/mapping/CMap.h"
#include "mapHandler.h"
#include "../lib/CStopWatch.h"
#include "../lib/NetPacks.h"
#include "../lib/NetPacksBase.h"
#include "CSpellWindow.h"
#include "CHeroWindow.h"
#include "CVideoHandler.h"

View File

@ -108,7 +108,6 @@
<Unit filename="CVideoHandler.h" />
<Unit filename="Client.cpp" />
<Unit filename="Client.h" />
<Unit filename="FunctionList.h" />
<Unit filename="GUIClasses.cpp" />
<Unit filename="GUIClasses.h" />
<Unit filename="Graphics.cpp" />

View File

@ -1,31 +1,32 @@
{
// Additional spell info, not included in original heroes III files
// id: spell ID
// effect: -1 -> spell is negative for influenced creatures,
// http://wiki.vcmi.eu/index.php?title=Spell_Format
// Additional spell info, not included in original heroes III files
// id: numeric id of spell
// effect: -1 -> spell is negative for influenced creatures,
// 0 -> spell is indifferent for them
// 1 -> spell is positive for them
// anim: main effect animation (AC format), -1 - none
// anim: main effect animation (AC format), -1 - none
// ranges: spell range description in SRSL ([no magic] [basic] [advanced] [expert])
// counters: array of ids of countering spells
//
// flags: string array of
// damage - ATM used only in CBattleInfoCallback::calculateSpellDmg
// offensive
// rising
// summoning //todo:
//
//effects: array of structure for bonuses for permanent effects
// {bonus format} - effect //todo
// + values: [4 int values] (OPTIONAL default from sptraits) values for levels
// + ainfos: [4 int values] (optional) additional infos for levels (atm only CURSE)
//
//immunity - name of bonus granting immunity to this spell
//
// immunity: array any of these bonus grants immunity
// limit: array required bonus to be affected, all required
//graphics - OPTIONAL; object;
//
// immunity: string array of bonus names, any one of these bonus grants immunity
// limit: string array of bonus names, presence of all bonuses required to be affected by
//
// graphics - OPTIONAL; object;
// iconImmune - OPTIONAL; string; resourse path of icon for SPELL_IMMUNITY bonus (relative to DATA or SPRITES)
"spells":
@ -114,7 +115,7 @@
"anim": -1,
"ranges": [ "X", "X", "X", "X" ],
"flags" : ["damage"],
"immunities" : ["DIRECT_DAMAGE_IMMUNITY"]
"immunity" : ["DIRECT_DAMAGE_IMMUNITY"]
},
"forceField" :
@ -131,7 +132,7 @@
"anim": -1,
"ranges": [ "0", "0", "0", "0" ],
"flags" : ["damage"],
"immunities" : ["DIRECT_DAMAGE_IMMUNITY"]
"immunity" : ["DIRECT_DAMAGE_IMMUNITY"]
},
"earthquake" :
{
@ -147,7 +148,7 @@
"anim": 64,
"ranges": [ "0", "0", "0", "0" ],
"flags" : ["damage", "offensive"],
"immunities" : ["DIRECT_DAMAGE_IMMUNITY"]
"immunity" : ["DIRECT_DAMAGE_IMMUNITY"]
},
"iceBolt" :
{
@ -156,7 +157,7 @@
"anim": 46,
"ranges": [ "0", "0", "0", "0" ],
"flags" : ["damage", "offensive"],
"immunities" : ["DIRECT_DAMAGE_IMMUNITY"]
"immunity" : ["DIRECT_DAMAGE_IMMUNITY"]
},
"lightningBolt" :
{
@ -165,7 +166,7 @@
"anim": 38,
"ranges": [ "0", "0", "0", "0" ],
"flags" : ["damage", "offensive"],
"immunities" : ["DIRECT_DAMAGE_IMMUNITY"]
"immunity" : ["DIRECT_DAMAGE_IMMUNITY"]
},
"implosion" :
{
@ -177,7 +178,7 @@
"iconImmune":"ZVS/LIB1.RES/E_SPIMP"
},
"flags" : ["damage", "offensive"],
"immunities" : ["DIRECT_DAMAGE_IMMUNITY"]
"immunity" : ["DIRECT_DAMAGE_IMMUNITY"]
},
"chainLightning" :
{
@ -194,7 +195,7 @@
"anim": 45,
"ranges": [ "1", "1", "1", "1" ],
"flags" : ["damage", "offensive"],
"immunities" : ["DIRECT_DAMAGE_IMMUNITY"]
"immunity" : ["DIRECT_DAMAGE_IMMUNITY"]
},
"fireball" :
{
@ -203,7 +204,7 @@
"anim": 53,
"ranges": [ "0,1", "0,1", "0,1", "0,1" ],
"flags" : ["damage", "offensive"],
"immunities" : ["DIRECT_DAMAGE_IMMUNITY"]
"immunity" : ["DIRECT_DAMAGE_IMMUNITY"]
},
"inferno" :
{
@ -212,7 +213,7 @@
"anim": 9,
"ranges": [ "0-2", "0-2", "0-2", "0-2" ],
"flags" : ["damage", "offensive"],
"immunities" : ["DIRECT_DAMAGE_IMMUNITY"]
"immunity" : ["DIRECT_DAMAGE_IMMUNITY"]
},
"meteorShower" :
{
@ -224,7 +225,7 @@
"iconImmune":"ZVS/LIB1.RES/E_SPMET"
},
"flags" : ["damage", "offensive"],
"immunities" : ["DIRECT_DAMAGE_IMMUNITY"]
"immunity" : ["DIRECT_DAMAGE_IMMUNITY"]
},
"deathRipple" :
{
@ -233,8 +234,7 @@
"anim": 8,
"ranges": [ "X", "X", "X", "X" ],
"flags" : ["damage", "offensive"],
"immunity": ["SIEGE_WEAPON","UNDEAD"],
"immunities" : ["DIRECT_DAMAGE_IMMUNITY"]
"immunity": ["SIEGE_WEAPON","UNDEAD","DIRECT_DAMAGE_IMMUNITY"]
},
"destroyUndead" :
{
@ -244,7 +244,7 @@
"ranges": [ "X", "X", "X", "X" ],
"flags" : ["damage", "offensive"],
"limit":["UNDEAD"],
"immunities" : ["DIRECT_DAMAGE_IMMUNITY"]
"immunity" : ["DIRECT_DAMAGE_IMMUNITY"]
},
"armageddon" :
@ -257,7 +257,7 @@
"iconImmune":"ZVS/LIB1.RES/E_SPARM"
},
"flags" : ["damage", "offensive"],
"immunities" : ["DIRECT_DAMAGE_IMMUNITY"]
"immunity" : ["DIRECT_DAMAGE_IMMUNITY"]
},
"shield" :
{
@ -1068,7 +1068,7 @@
"anim": 81,
"ranges": [ "0", "0", "0", "0" ],
"flags" : ["damage"],
"immunities" : ["DIRECT_DAMAGE_IMMUNITY"]
"immunity" : ["DIRECT_DAMAGE_IMMUNITY"]
}
}

View File

@ -7,7 +7,7 @@
#include "CModHandler.h"
#include "CSpellHandler.h"
#include "CObjectHandler.h"
#include "NetPacks.h"
#include "NetPacksBase.h"
#include "GameConstants.h"
using namespace boost::assign;

View File

@ -2,6 +2,8 @@
#include <boost/variant.hpp>
#include "NetPacksBase.h"
#include "BattleAction.h"
#include "HeroBonus.h"
#include "CCreatureSet.h"
@ -37,22 +39,7 @@ struct StackLocation;
struct ArtSlotInfo;
struct QuestInfo;
struct CPack
{
ui16 type;
CPack(){};
virtual ~CPack(){};
ui16 getType() const{return type;}
template <typename Handler> void serialize(Handler &h, const int version)
{
logNetwork->errorStream() << "CPack serialized... this should not happen!";
}
void applyGs(CGameState *gs) { }
virtual std::string toString() const { return boost::str(boost::format("{CPack: type '%d'}") % type); }
};
std::ostream & operator<<(std::ostream & out, const CPack * pack);
struct CPackForClient : public CPack
{
@ -91,86 +78,6 @@ struct Query : public CPackForClient
};
struct MetaString : public CPack //2001 helper for object scrips
{
private:
enum EMessage {TEXACT_STRING, TLOCAL_STRING, TNUMBER, TREPLACE_ESTRING, TREPLACE_LSTRING, TREPLACE_NUMBER, TREPLACE_PLUSNUMBER};
public:
enum {GENERAL_TXT=1, XTRAINFO_TXT, OBJ_NAMES, RES_NAMES, ART_NAMES, ARRAY_TXT, CRE_PL_NAMES, CREGENS, MINE_NAMES,
MINE_EVNTS, ADVOB_TXT, ART_EVNTS, SPELL_NAME, SEC_SKILL_NAME, CRE_SING_NAMES, CREGENS4, COLOR, ART_DESCR};
std::vector<ui8> message; //vector of EMessage
std::vector<std::pair<ui8,ui32> > localStrings; //pairs<text handler type, text number>; types: 1 - generaltexthandler->all; 2 - objh->xtrainfo; 3 - objh->names; 4 - objh->restypes; 5 - arth->artifacts[id].name; 6 - generaltexth->arraytxt; 7 - creh->creatures[os->subID].namePl; 8 - objh->creGens; 9 - objh->mines[ID]->first; 10 - objh->mines[ID]->second; 11 - objh->advobtxt
std::vector<std::string> exactStrings;
std::vector<si32> numbers;
template <typename Handler> void serialize(Handler &h, const int version)
{
h & exactStrings & localStrings & message & numbers;
}
void addTxt(ui8 type, ui32 serial)
{
message.push_back(TLOCAL_STRING);
localStrings.push_back(std::pair<ui8,ui32>(type, serial));
}
MetaString& operator<<(const std::pair<ui8,ui32> &txt)
{
message.push_back(TLOCAL_STRING);
localStrings.push_back(txt);
return *this;
}
MetaString& operator<<(const std::string &txt)
{
message.push_back(TEXACT_STRING);
exactStrings.push_back(txt);
return *this;
}
MetaString& operator<<(int txt)
{
message.push_back(TNUMBER);
numbers.push_back(txt);
return *this;
}
void addReplacement(ui8 type, ui32 serial)
{
message.push_back(TREPLACE_LSTRING);
localStrings.push_back(std::pair<ui8,ui32>(type, serial));
}
void addReplacement(const std::string &txt)
{
message.push_back(TREPLACE_ESTRING);
exactStrings.push_back(txt);
}
void addReplacement(int txt)
{
message.push_back(TREPLACE_NUMBER);
numbers.push_back(txt);
}
void addReplacement2(int txt)
{
message.push_back(TREPLACE_PLUSNUMBER);
numbers.push_back(txt);
}
DLL_LINKAGE void addCreReplacement(CreatureID id, TQuantity count); //adds sing or plural name;
DLL_LINKAGE void addReplacement(const CStackBasicDescriptor &stack); //adds sing or plural name;
DLL_LINKAGE std::string buildList () const;
void clear()
{
exactStrings.clear();
localStrings.clear();
message.clear();
numbers.clear();
}
DLL_LINKAGE void toString(std::string &dst) const;
DLL_LINKAGE std::string toString() const;
void getLocalString(const std::pair<ui8,ui32> &txt, std::string &dst) const;
MetaString()
{
type = 2001;
}
};
struct StackLocation
{
@ -944,7 +851,7 @@ struct RebalanceStacks : CGarrisonOperationPack //526
}
};
typedef boost::variant<ConstTransitivePtr<CGHeroInstance>, ConstTransitivePtr<CStackInstance> > TArtHolder;
struct GetEngagedHeroIds : boost::static_visitor<boost::optional<ObjectInstanceID>>
@ -961,66 +868,6 @@ struct GetEngagedHeroIds : boost::static_visitor<boost::optional<ObjectInstanceI
}
};
//struct GetArtifactSet : boost::static_visitor<>
//{
// void operator()(const ConstTransitivePtr<CGHeroInstance> &h) const {}
// void operator()(const ConstTransitivePtr<CStackInstance> &s) const {}
//};
//struct GetArtifactSetPtr : boost::static_visitor<>
//{
// ConstTransitivePtr<CGHeroInstance> operator()(const ConstTransitivePtr<CGHeroInstance> &h) const { return h;}
// ConstTransitivePtr<CStackInstance> operator()(const ConstTransitivePtr<CStackInstance> &s) const { return s;}
//};
struct ArtifactLocation
{
TArtHolder artHolder;
ArtifactPosition slot;
ArtifactLocation()
{
artHolder = ConstTransitivePtr<CGHeroInstance>();
slot = ArtifactPosition::PRE_FIRST;
}
template <typename T>
ArtifactLocation(const T *ArtHolder, ArtifactPosition Slot)
{
artHolder = const_cast<T*>(ArtHolder); //we are allowed here to const cast -> change will go through one of our packages... do not abuse!
slot = Slot;
}
ArtifactLocation(TArtHolder ArtHolder, ArtifactPosition Slot)
{
artHolder = ArtHolder;
slot = Slot;
}
template <typename T>
bool isHolder(const T *t) const
{
if(auto ptrToT = boost::get<ConstTransitivePtr<T> >(&artHolder))
{
return ptrToT->get() == t;
}
return false;
}
DLL_LINKAGE const CArmedInstance *relatedObj() const; //hero or the stack owner
DLL_LINKAGE PlayerColor owningPlayer() const;
DLL_LINKAGE CArtifactSet *getHolderArtSet();
DLL_LINKAGE CBonusSystemNode *getHolderNode();
DLL_LINKAGE const CArtifactSet *getHolderArtSet() const;
DLL_LINKAGE const CBonusSystemNode *getHolderNode() const;
DLL_LINKAGE const CArtifactInstance *getArt() const;
DLL_LINKAGE CArtifactInstance *getArt();
DLL_LINKAGE const ArtSlotInfo *getSlot() const;
template <typename Handler> void serialize(Handler &h, const int version)
{
h & artHolder & slot;
}
};
struct PutArtifact : CArtifactOperationPack //526
{
ArtifactLocation al;
@ -1141,29 +988,6 @@ struct NewTurn : public CPackForClient //101
}
};
struct Component : public CPack //2002 helper for object scrips informations
{
enum EComponentType {PRIM_SKILL, SEC_SKILL, RESOURCE, CREATURE, ARTIFACT, EXPERIENCE, SPELL, MORALE, LUCK, BUILDING, HERO_PORTRAIT, FLAG};
ui16 id, subtype; //id uses ^^^ enums, when id==EXPPERIENCE subtype==0 means exp points and subtype==1 levels)
si32 val; // + give; - take
si16 when; // 0 - now; +x - within x days; -x - per x days
template <typename Handler> void serialize(Handler &h, const int version)
{
h & id & subtype & val & when;
}
Component()
{
type = 2002;
}
DLL_LINKAGE explicit Component(const CStackBasicDescriptor &stack);
Component(Component::EComponentType Type, ui16 Subtype, si32 Val, si16 When)
:id(Type),subtype(Subtype),val(Val),when(When)
{
type = 2002;
}
};
struct InfoWindow : public CPackForClient //103 - displays simple info window
{
void applyCl(CClient *cl);
@ -1688,7 +1512,8 @@ struct CatapultAttack : public CPackForClient //3015
}
};
CatapultAttack(){type = 3015;}
DLL_LINKAGE CatapultAttack();
DLL_LINKAGE ~CatapultAttack();
DLL_LINKAGE void applyGs(CGameState *gs);
void applyCl(CClient *cl);

198
lib/NetPacksBase.h Normal file
View File

@ -0,0 +1,198 @@
#pragma once
/*
* NetPacksBase.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 CGameState;
class CStackBasicDescriptor;
class CGHeroInstance;
class CStackInstance;
class CArmedInstance;
class CArtifactSet;
class CBonusSystemNode;
class ArtSlotInfo;
#include "ConstTransitivePtr.h"
#include "GameConstants.h"
struct CPack
{
ui16 type;
CPack(){};
virtual ~CPack(){};
ui16 getType() const{return type;}
template <typename Handler> void serialize(Handler &h, const int version)
{
logNetwork->errorStream() << "CPack serialized... this should not happen!";
}
void applyGs(CGameState *gs) { }
virtual std::string toString() const { return boost::str(boost::format("{CPack: type '%d'}") % type); }
};
std::ostream & operator<<(std::ostream & out, const CPack * pack);
struct DLL_LINKAGE MetaString : public CPack //2001 helper for object scrips
{
private:
enum EMessage {TEXACT_STRING, TLOCAL_STRING, TNUMBER, TREPLACE_ESTRING, TREPLACE_LSTRING, TREPLACE_NUMBER, TREPLACE_PLUSNUMBER};
public:
enum {GENERAL_TXT=1, XTRAINFO_TXT, OBJ_NAMES, RES_NAMES, ART_NAMES, ARRAY_TXT, CRE_PL_NAMES, CREGENS, MINE_NAMES,
MINE_EVNTS, ADVOB_TXT, ART_EVNTS, SPELL_NAME, SEC_SKILL_NAME, CRE_SING_NAMES, CREGENS4, COLOR, ART_DESCR};
std::vector<ui8> message; //vector of EMessage
std::vector<std::pair<ui8,ui32> > localStrings; //pairs<text handler type, text number>; types: 1 - generaltexthandler->all; 2 - objh->xtrainfo; 3 - objh->names; 4 - objh->restypes; 5 - arth->artifacts[id].name; 6 - generaltexth->arraytxt; 7 - creh->creatures[os->subID].namePl; 8 - objh->creGens; 9 - objh->mines[ID]->first; 10 - objh->mines[ID]->second; 11 - objh->advobtxt
std::vector<std::string> exactStrings;
std::vector<si32> numbers;
template <typename Handler> void serialize(Handler &h, const int version)
{
h & exactStrings & localStrings & message & numbers;
}
void addTxt(ui8 type, ui32 serial)
{
message.push_back(TLOCAL_STRING);
localStrings.push_back(std::pair<ui8,ui32>(type, serial));
}
MetaString& operator<<(const std::pair<ui8,ui32> &txt)
{
message.push_back(TLOCAL_STRING);
localStrings.push_back(txt);
return *this;
}
MetaString& operator<<(const std::string &txt)
{
message.push_back(TEXACT_STRING);
exactStrings.push_back(txt);
return *this;
}
MetaString& operator<<(int txt)
{
message.push_back(TNUMBER);
numbers.push_back(txt);
return *this;
}
void addReplacement(ui8 type, ui32 serial)
{
message.push_back(TREPLACE_LSTRING);
localStrings.push_back(std::pair<ui8,ui32>(type, serial));
}
void addReplacement(const std::string &txt)
{
message.push_back(TREPLACE_ESTRING);
exactStrings.push_back(txt);
}
void addReplacement(int txt)
{
message.push_back(TREPLACE_NUMBER);
numbers.push_back(txt);
}
void addReplacement2(int txt)
{
message.push_back(TREPLACE_PLUSNUMBER);
numbers.push_back(txt);
}
DLL_LINKAGE void addCreReplacement(CreatureID id, TQuantity count); //adds sing or plural name;
DLL_LINKAGE void addReplacement(const CStackBasicDescriptor &stack); //adds sing or plural name;
DLL_LINKAGE std::string buildList () const;
void clear()
{
exactStrings.clear();
localStrings.clear();
message.clear();
numbers.clear();
}
DLL_LINKAGE void toString(std::string &dst) const;
DLL_LINKAGE std::string toString() const;
void getLocalString(const std::pair<ui8,ui32> &txt, std::string &dst) const;
MetaString()
{
type = 2001;
}
};
struct Component : public CPack //2002 helper for object scrips informations
{
enum EComponentType {PRIM_SKILL, SEC_SKILL, RESOURCE, CREATURE, ARTIFACT, EXPERIENCE, SPELL, MORALE, LUCK, BUILDING, HERO_PORTRAIT, FLAG};
ui16 id, subtype; //id uses ^^^ enums, when id==EXPPERIENCE subtype==0 means exp points and subtype==1 levels)
si32 val; // + give; - take
si16 when; // 0 - now; +x - within x days; -x - per x days
template <typename Handler> void serialize(Handler &h, const int version)
{
h & id & subtype & val & when;
}
Component()
{
type = 2002;
}
DLL_LINKAGE explicit Component(const CStackBasicDescriptor &stack);
Component(Component::EComponentType Type, ui16 Subtype, si32 Val, si16 When)
:id(Type),subtype(Subtype),val(Val),when(When)
{
type = 2002;
}
};
typedef boost::variant<ConstTransitivePtr<CGHeroInstance>, ConstTransitivePtr<CStackInstance> > TArtHolder;
struct ArtifactLocation
{
TArtHolder artHolder;
ArtifactPosition slot;
ArtifactLocation()
{
artHolder = ConstTransitivePtr<CGHeroInstance>();
slot = ArtifactPosition::PRE_FIRST;
}
template <typename T>
ArtifactLocation(const T *ArtHolder, ArtifactPosition Slot)
{
artHolder = const_cast<T*>(ArtHolder); //we are allowed here to const cast -> change will go through one of our packages... do not abuse!
slot = Slot;
}
ArtifactLocation(TArtHolder ArtHolder, ArtifactPosition Slot)
{
artHolder = ArtHolder;
slot = Slot;
}
template <typename T>
bool isHolder(const T *t) const
{
if(auto ptrToT = boost::get<ConstTransitivePtr<T> >(&artHolder))
{
return ptrToT->get() == t;
}
return false;
}
DLL_LINKAGE const CArmedInstance *relatedObj() const; //hero or the stack owner
DLL_LINKAGE PlayerColor owningPlayer() const;
DLL_LINKAGE CArtifactSet *getHolderArtSet();
DLL_LINKAGE CBonusSystemNode *getHolderNode();
DLL_LINKAGE const CArtifactSet *getHolderArtSet() const;
DLL_LINKAGE const CBonusSystemNode *getHolderNode() const;
DLL_LINKAGE const CArtifactInstance *getArt() const;
DLL_LINKAGE CArtifactInstance *getArt();
DLL_LINKAGE const ArtSlotInfo *getSlot() const;
template <typename Handler> void serialize(Handler &h, const int version)
{
h & artHolder & slot;
}
};

View File

@ -15,9 +15,6 @@
#include "BattleState.h"
#include "CTownHandler.h"
#undef min
#undef max
/*
* NetPacksLib.cpp, part of VCMI engine
*
@ -28,12 +25,9 @@
*
*/
#ifdef min
#undef min
#endif
#ifdef max
#undef max
#endif
std::ostream & operator<<(std::ostream & out, const CPack * pack)
{
@ -1484,6 +1478,16 @@ DLL_LINKAGE void ObstaclesRemoved::applyGs( CGameState *gs )
}
}
DLL_LINKAGE CatapultAttack::CatapultAttack()
{
type = 3015;
}
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

View File

@ -138,6 +138,7 @@
<Unit filename="LogicalExpression.cpp" />
<Unit filename="LogicalExpression.h" />
<Unit filename="NetPacks.h" />
<Unit filename="NetPacksBase.h" />
<Unit filename="NetPacksLib.cpp" />
<Unit filename="RegisterTypes.cpp" />
<Unit filename="RegisterTypes.h" />

View File

@ -6,10 +6,8 @@
class CGObjectInstance;
class CGHeroInstance;
class CArmedInstance;
struct CPack;
class CGameHandler;
class CObjectVisitQuery;
struct TryMoveHero;
class CQuery;
typedef shared_ptr<CQuery> QueryPtr;