diff --git a/AI/VCAI/Goals.cpp b/AI/VCAI/Goals.cpp index c72d00d91..74c22a317 100644 --- a/AI/VCAI/Goals.cpp +++ b/AI/VCAI/Goals.cpp @@ -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(value); -}; +} TSubgoal GatherArmy::whatToDoToAchieve() { diff --git a/AI/VCAI/VCAI.cbp b/AI/VCAI/VCAI.cbp index 8496fd4f1..a7031cf03 100644 --- a/AI/VCAI/VCAI.cbp +++ b/AI/VCAI/VCAI.cbp @@ -57,8 +57,12 @@ + + + + diff --git a/client/AdventureMapClasses.cpp b/client/AdventureMapClasses.cpp index dc273def6..c1c5ae64b 100644 --- a/client/AdventureMapClasses.cpp +++ b/client/AdventureMapClasses.cpp @@ -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" diff --git a/client/CCreatureWindow.cpp b/client/CCreatureWindow.cpp index a87bc7c72..31740191a 100644 --- a/client/CCreatureWindow.cpp +++ b/client/CCreatureWindow.cpp @@ -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" diff --git a/client/CHeroWindow.cpp b/client/CHeroWindow.cpp index 19762394e..721c8da0a 100644 --- a/client/CHeroWindow.cpp +++ b/client/CHeroWindow.cpp @@ -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" diff --git a/client/CQuestLog.cpp b/client/CQuestLog.cpp index 1c3db449a..e573c761a 100644 --- a/client/CQuestLog.cpp +++ b/client/CQuestLog.cpp @@ -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" diff --git a/client/GUIClasses.cpp b/client/GUIClasses.cpp index a0bf73202..2d96bec11 100644 --- a/client/GUIClasses.cpp +++ b/client/GUIClasses.cpp @@ -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" diff --git a/client/VCMI_client.cbp b/client/VCMI_client.cbp index f9d13b365..73067e46d 100644 --- a/client/VCMI_client.cbp +++ b/client/VCMI_client.cbp @@ -108,7 +108,6 @@ - diff --git a/config/spell_info.json b/config/spell_info.json index ca50c3b7e..2d3414735 100644 --- a/config/spell_info.json +++ b/config/spell_info.json @@ -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"] } } diff --git a/lib/CArtHandler.cpp b/lib/CArtHandler.cpp index 9b0bbd15c..7dc40a7f1 100644 --- a/lib/CArtHandler.cpp +++ b/lib/CArtHandler.cpp @@ -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; diff --git a/lib/NetPacks.h b/lib/NetPacks.h index ec9508897..b097aaebe 100644 --- a/lib/NetPacks.h +++ b/lib/NetPacks.h @@ -2,6 +2,8 @@ #include +#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 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 message; //vector of EMessage - - std::vector > localStrings; //pairs; 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 exactStrings; - std::vector numbers; - - template 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(type, serial)); - } - MetaString& operator<<(const std::pair &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(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 &txt, std::string &dst) const; - - MetaString() - { - type = 2001; - } -}; struct StackLocation { @@ -944,7 +851,7 @@ struct RebalanceStacks : CGarrisonOperationPack //526 } }; -typedef boost::variant, ConstTransitivePtr > TArtHolder; + struct GetEngagedHeroIds : boost::static_visitor> @@ -961,66 +868,6 @@ struct GetEngagedHeroIds : boost::static_visitor -//{ -// void operator()(const ConstTransitivePtr &h) const {} -// void operator()(const ConstTransitivePtr &s) const {} -//}; -//struct GetArtifactSetPtr : boost::static_visitor<> -//{ -// ConstTransitivePtr operator()(const ConstTransitivePtr &h) const { return h;} -// ConstTransitivePtr operator()(const ConstTransitivePtr &s) const { return s;} -//}; -struct ArtifactLocation -{ - - - TArtHolder artHolder; - ArtifactPosition slot; - - ArtifactLocation() - { - artHolder = ConstTransitivePtr(); - slot = ArtifactPosition::PRE_FIRST; - } - template - ArtifactLocation(const T *ArtHolder, ArtifactPosition Slot) - { - artHolder = const_cast(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 - bool isHolder(const T *t) const - { - if(auto ptrToT = boost::get >(&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 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 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); diff --git a/lib/NetPacksBase.h b/lib/NetPacksBase.h new file mode 100644 index 000000000..5201f92a0 --- /dev/null +++ b/lib/NetPacksBase.h @@ -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 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 message; //vector of EMessage + + std::vector > localStrings; //pairs; 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 exactStrings; + std::vector numbers; + + template 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(type, serial)); + } + MetaString& operator<<(const std::pair &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(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 &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 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 > TArtHolder; + +struct ArtifactLocation +{ + TArtHolder artHolder; + ArtifactPosition slot; + + ArtifactLocation() + { + artHolder = ConstTransitivePtr(); + slot = ArtifactPosition::PRE_FIRST; + } + template + ArtifactLocation(const T *ArtHolder, ArtifactPosition Slot) + { + artHolder = const_cast(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 + bool isHolder(const T *t) const + { + if(auto ptrToT = boost::get >(&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 void serialize(Handler &h, const int version) + { + h & artHolder & slot; + } +}; \ No newline at end of file diff --git a/lib/NetPacksLib.cpp b/lib/NetPacksLib.cpp index d5d601441..f6ae7d3f9 100644 --- a/lib/NetPacksLib.cpp +++ b/lib/NetPacksLib.cpp @@ -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 diff --git a/lib/VCMI_lib.cbp b/lib/VCMI_lib.cbp index 91cc820d4..9a47138ad 100644 --- a/lib/VCMI_lib.cbp +++ b/lib/VCMI_lib.cbp @@ -138,6 +138,7 @@ + diff --git a/server/CQuery.h b/server/CQuery.h index f04dacf9e..355882e93 100644 --- a/server/CQuery.h +++ b/server/CQuery.h @@ -6,10 +6,8 @@ class CGObjectInstance; class CGHeroInstance; class CArmedInstance; -struct CPack; class CGameHandler; class CObjectVisitQuery; -struct TryMoveHero; class CQuery; typedef shared_ptr QueryPtr;