2014-01-16 23:24:06 +03:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*/
|
2017-07-13 10:26:03 +02:00
|
|
|
#pragma once
|
2014-01-16 23:24:06 +03:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
class CClient;
|
2014-01-16 23:24:06 +03:00
|
|
|
class CGameState;
|
2017-07-20 06:08:49 +02:00
|
|
|
class CGameHandler;
|
|
|
|
class CConnection;
|
2014-01-16 23:24:06 +03:00
|
|
|
class CStackBasicDescriptor;
|
|
|
|
class CGHeroInstance;
|
|
|
|
class CStackInstance;
|
|
|
|
class CArmedInstance;
|
|
|
|
class CArtifactSet;
|
|
|
|
class CBonusSystemNode;
|
2014-02-09 00:54:35 +03:00
|
|
|
struct ArtSlotInfo;
|
2014-01-16 23:24:06 +03:00
|
|
|
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
#include <vcmi/Metatype.h>
|
|
|
|
|
2014-01-16 23:24:06 +03:00
|
|
|
#include "ConstTransitivePtr.h"
|
|
|
|
#include "GameConstants.h"
|
2017-07-20 06:08:49 +02:00
|
|
|
#include "JsonNode.h"
|
2014-01-16 23:24:06 +03:00
|
|
|
|
2014-06-24 00:05:53 +03:00
|
|
|
struct DLL_LINKAGE CPack
|
2014-01-16 23:24:06 +03:00
|
|
|
{
|
2018-01-05 19:21:07 +02:00
|
|
|
std::shared_ptr<CConnection> c; // Pointer to connection that pack received from
|
|
|
|
|
|
|
|
CPack() : c(nullptr) {};
|
2016-10-02 22:41:57 +02:00
|
|
|
virtual ~CPack() {};
|
2016-11-18 16:45:59 +02:00
|
|
|
|
2014-01-16 23:24:06 +03:00
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
2017-08-11 19:03:05 +02:00
|
|
|
logNetwork->error("CPack serialized... this should not happen!");
|
2016-10-02 22:41:57 +02:00
|
|
|
assert(false && "CPack serialized");
|
2014-01-16 23:24:06 +03:00
|
|
|
}
|
2017-07-20 06:08:49 +02:00
|
|
|
|
|
|
|
void applyGs(CGameState * gs)
|
|
|
|
{}
|
2014-01-16 23:24:06 +03:00
|
|
|
};
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
struct CPackForClient : public CPack
|
|
|
|
{
|
|
|
|
CPackForClient(){};
|
|
|
|
|
|
|
|
CGameState* GS(CClient *cl);
|
|
|
|
void applyFirstCl(CClient *cl)//called before applying to gs
|
|
|
|
{}
|
|
|
|
void applyCl(CClient *cl)//called after applying to gs
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CPackForServer : public CPack
|
|
|
|
{
|
2018-01-05 19:21:07 +02:00
|
|
|
mutable PlayerColor player;
|
|
|
|
mutable si32 requestID;
|
2017-07-20 06:08:49 +02:00
|
|
|
CGameState* GS(CGameHandler *gh);
|
|
|
|
CPackForServer():
|
2018-01-05 19:21:07 +02:00
|
|
|
player(PlayerColor::NEUTRAL)
|
2017-07-20 06:08:49 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool applyGh(CGameHandler *gh) //called after applying to gs
|
|
|
|
{
|
|
|
|
logGlobal->error("Should not happen... applying plain CPackForServer");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-01-05 19:21:07 +02:00
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
|
|
|
h & player;
|
|
|
|
h & requestID;
|
|
|
|
}
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
protected:
|
|
|
|
void throwNotAllowedAction();
|
|
|
|
void throwOnWrongOwner(CGameHandler * gh, ObjectInstanceID id);
|
|
|
|
void throwOnWrongPlayer(CGameHandler * gh, PlayerColor player);
|
2018-11-17 21:56:51 +02:00
|
|
|
void throwAndComplain(CGameHandler * gh, std::string txt);
|
2017-07-20 06:08:49 +02:00
|
|
|
bool isPlayerOwns(CGameHandler * gh, ObjectInstanceID id);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void wrongPlayerMessage(CGameHandler * gh, PlayerColor expectedplayer);
|
|
|
|
};
|
2014-01-16 23:24:06 +03:00
|
|
|
|
2016-11-18 15:58:22 +02:00
|
|
|
struct DLL_LINKAGE MetaString
|
2014-01-16 23:24:06 +03:00
|
|
|
{
|
|
|
|
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,
|
2017-06-06 06:53:51 +02:00
|
|
|
MINE_EVNTS, ADVOB_TXT, ART_EVNTS, SPELL_NAME, SEC_SKILL_NAME, CRE_SING_NAMES, CREGENS4, COLOR, ART_DESCR, JK_TXT};
|
2014-01-16 23:24:06 +03:00
|
|
|
|
|
|
|
std::vector<ui8> message; //vector of EMessage
|
|
|
|
|
2017-06-06 06:53:51 +02:00
|
|
|
std::vector<std::pair<ui8,ui32> > localStrings;
|
2014-01-16 23:24:06 +03:00
|
|
|
std::vector<std::string> exactStrings;
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
std::vector<int64_t> numbers;
|
2014-01-16 23:24:06 +03:00
|
|
|
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
template <typename Handler> void serialize(Handler & h, const int version)
|
2014-01-16 23:24:06 +03:00
|
|
|
{
|
2017-07-31 15:35:42 +02:00
|
|
|
h & exactStrings;
|
|
|
|
h & localStrings;
|
|
|
|
h & message;
|
|
|
|
h & numbers;
|
2014-01-16 23:24:06 +03:00
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
MetaString& operator<<(int64_t txt)
|
2014-01-16 23:24:06 +03:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
void addReplacement(int64_t txt)
|
2014-01-16 23:24:06 +03:00
|
|
|
{
|
|
|
|
message.push_back(TREPLACE_NUMBER);
|
|
|
|
numbers.push_back(txt);
|
|
|
|
}
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
void addReplacement2(int64_t txt)
|
2014-01-16 23:24:06 +03:00
|
|
|
{
|
|
|
|
message.push_back(TREPLACE_PLUSNUMBER);
|
|
|
|
numbers.push_back(txt);
|
|
|
|
}
|
2014-01-21 20:03:21 +03:00
|
|
|
void addCreReplacement(CreatureID id, TQuantity count); //adds sing or plural name;
|
|
|
|
void addReplacement(const CStackBasicDescriptor &stack); //adds sing or plural name;
|
|
|
|
std::string buildList () const;
|
2014-01-16 23:24:06 +03:00
|
|
|
void clear()
|
|
|
|
{
|
|
|
|
exactStrings.clear();
|
|
|
|
localStrings.clear();
|
|
|
|
message.clear();
|
|
|
|
numbers.clear();
|
|
|
|
}
|
2014-01-21 20:03:21 +03:00
|
|
|
void toString(std::string &dst) const;
|
2016-11-18 15:58:22 +02:00
|
|
|
std::string toString() const;
|
2014-01-16 23:24:06 +03:00
|
|
|
void getLocalString(const std::pair<ui8,ui32> &txt, std::string &dst) const;
|
|
|
|
|
2016-11-18 15:58:22 +02:00
|
|
|
MetaString(){}
|
2014-01-16 23:24:06 +03:00
|
|
|
};
|
|
|
|
|
2016-11-18 15:58:22 +02:00
|
|
|
struct Component
|
2014-01-16 23:24:06 +03:00
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
2017-07-31 15:35:42 +02:00
|
|
|
h & id;
|
|
|
|
h & subtype;
|
|
|
|
h & val;
|
|
|
|
h & when;
|
2014-01-16 23:24:06 +03:00
|
|
|
}
|
|
|
|
Component()
|
2016-11-27 21:07:01 +02:00
|
|
|
:id(0), subtype(0), val(0), when(0)
|
2014-01-16 23:24:06 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef boost::variant<ConstTransitivePtr<CGHeroInstance>, ConstTransitivePtr<CStackInstance> > TArtHolder;
|
|
|
|
|
|
|
|
struct ArtifactLocation
|
|
|
|
{
|
2018-03-10 21:19:55 +02:00
|
|
|
TArtHolder artHolder;//TODO: identify holder by id
|
2014-01-16 23:24:06 +03:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2014-02-09 02:07:33 +03:00
|
|
|
DLL_LINKAGE void removeArtifact(); // BE CAREFUL, this operation modifies holder (gs)
|
|
|
|
|
2014-01-16 23:24:06 +03:00
|
|
|
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)
|
|
|
|
{
|
2017-07-31 15:35:42 +02:00
|
|
|
h & artHolder;
|
|
|
|
h & slot;
|
2014-01-16 23:24:06 +03:00
|
|
|
}
|
2014-06-24 00:05:53 +03:00
|
|
|
};
|
2017-07-04 13:24:46 +02:00
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
///custom effect (resistance, reflection, etc)
|
|
|
|
struct CustomEffectInfo
|
|
|
|
{
|
|
|
|
CustomEffectInfo()
|
|
|
|
:effect(0),
|
|
|
|
sound(0),
|
|
|
|
stack(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
/// WoG AC format
|
|
|
|
ui32 effect;
|
|
|
|
ui32 sound;
|
|
|
|
ui32 stack;
|
|
|
|
template <typename Handler> void serialize(Handler & h, const int version)
|
|
|
|
{
|
|
|
|
h & effect;
|
|
|
|
h & sound;
|
|
|
|
h & stack;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there.
* Declared existing Entity APIs.
* Added basic script context caching
* Started Lua script module
* Started Lua spell effect API
* Started script state persistence
* Started battle info callback binding
* CommitPackage removed
* Extracted spells::Caster to own header; Expanded Spell API.
* implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C
* !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented
* Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key)
* Re-enabled VERM macros.
* !?GM0 added
* !?TM implemented
* Added !!MF:N
* Started !?OB, !!BM, !!HE, !!OW, !!UN
* Added basic support of w-variables
* Added support for ERM indirect variables
* Made !?FU regular trigger
* !!re (ERA loop receiver) implemented
* Fixed ERM receivers with zero args.
2018-03-17 16:58:30 +02:00
|
|
|
class EntityChanges
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Metatype metatype;
|
|
|
|
int32_t entityIndex;
|
|
|
|
JsonNode data;
|
|
|
|
EntityChanges()
|
|
|
|
: metatype(Metatype::UNKNOWN),
|
|
|
|
entityIndex(0),
|
|
|
|
data()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
template <typename Handler> void serialize(Handler & h, const int version)
|
|
|
|
{
|
|
|
|
h & metatype;
|
|
|
|
h & entityIndex;
|
|
|
|
h & data;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
class BattleChanges
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum class EOperation : si8
|
|
|
|
{
|
|
|
|
ADD,
|
|
|
|
RESET_STATE,
|
|
|
|
UPDATE,
|
|
|
|
REMOVE
|
|
|
|
};
|
|
|
|
|
|
|
|
JsonNode data;
|
|
|
|
EOperation operation;
|
|
|
|
|
|
|
|
BattleChanges()
|
|
|
|
: operation(EOperation::RESET_STATE),
|
|
|
|
data()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
BattleChanges(EOperation operation_)
|
|
|
|
: operation(operation_),
|
|
|
|
data()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class UnitChanges : public BattleChanges
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
uint32_t id;
|
|
|
|
int64_t healthDelta;
|
|
|
|
|
|
|
|
UnitChanges()
|
|
|
|
: BattleChanges(EOperation::RESET_STATE),
|
|
|
|
id(0),
|
|
|
|
healthDelta(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
UnitChanges(uint32_t id_, EOperation operation_)
|
|
|
|
: BattleChanges(operation_),
|
|
|
|
id(id_),
|
|
|
|
healthDelta(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler & h, const int version)
|
|
|
|
{
|
|
|
|
h & id;
|
|
|
|
h & healthDelta;
|
|
|
|
h & data;
|
|
|
|
h & operation;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class ObstacleChanges : public BattleChanges
|
2017-07-04 13:24:46 +02:00
|
|
|
{
|
|
|
|
public:
|
2017-07-20 06:08:49 +02:00
|
|
|
uint32_t id;
|
|
|
|
|
|
|
|
ObstacleChanges()
|
|
|
|
: BattleChanges(EOperation::RESET_STATE),
|
|
|
|
id(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ObstacleChanges(uint32_t id_, EOperation operation_)
|
|
|
|
: BattleChanges(operation_),
|
|
|
|
id(id_)
|
2017-07-04 13:24:46 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler & h, const int version)
|
|
|
|
{
|
2017-07-20 06:08:49 +02:00
|
|
|
h & id;
|
|
|
|
h & data;
|
|
|
|
h & operation;
|
2017-07-04 13:24:46 +02:00
|
|
|
}
|
|
|
|
};
|