Skip to content

Commit 5746d41

Browse files
author
nitrocaster
committed
Merge serializable interfaces.
1 parent 20c9616 commit 5746d41

20 files changed

+77
-126
lines changed

res/gamedata/scripts/lua_help.script

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,13 +1275,7 @@ C++ class property_evaluator_const : property_evaluator {
12751275

12761276
};
12771277

1278-
C++ class ipure_alife_load_object {
1279-
};
1280-
1281-
C++ class ipure_alife_save_object {
1282-
};
1283-
1284-
C++ class ipure_alife_load_save_object : ipure_alife_load_object,ipure_alife_save_object {
1278+
C++ class iserializable {
12851279
};
12861280

12871281
C++ class Fbox {

src/Common/object_interfaces.h

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,36 +22,18 @@ class IPureDestroyableObject {
2222

2323
IC IPureDestroyableObject::~IPureDestroyableObject() {}
2424

25-
template <typename _storage_type>
26-
class IPureLoadableObject {
25+
class ISerializable
26+
{
2727
public:
28-
virtual ~IPureLoadableObject() = 0;
29-
virtual void load(_storage_type &storage) = 0;
28+
virtual ~ISerializable() = 0;
29+
virtual void load(IReader &reader) = 0;
30+
virtual void save(IWriter &writer) = 0;
3031
};
3132

32-
template <typename _storage_type>
33-
IC IPureLoadableObject<_storage_type>::~IPureLoadableObject() {}
33+
IC ISerializable::~ISerializable() {}
3434

35-
template <typename _storage_type>
36-
class IPureSavableObject {
37-
public:
38-
virtual ~IPureSavableObject() = 0;
39-
virtual void save(_storage_type &storage) = 0;
40-
};
41-
42-
template <typename _storage_type>
43-
IC IPureSavableObject<_storage_type>::~IPureSavableObject() {}
44-
45-
template <typename _storage_type_load, typename _storage_type_save>
46-
class IPureSerializeObject : public IPureLoadableObject<_storage_type_load>, public IPureSavableObject<_storage_type_save> {
47-
public:
48-
virtual ~IPureSerializeObject() = 0;
49-
};
50-
51-
template <typename _storage_type_load, typename _storage_type_save>
52-
IC IPureSerializeObject<typename _storage_type_load, typename _storage_type_save>::~IPureSerializeObject() {}
53-
54-
class IPureServerObject : public IPureSerializeObject<IReader,IWriter> {
35+
class IPureServerObject : public ISerializable
36+
{
5537
public:
5638
virtual ~IPureServerObject() = 0;
5739
virtual void STATE_Write (NET_Packet &tNetPacket) = 0;

src/Common/object_loader.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ struct CLoader {
3636
IC static void load_data(T &data, M &stream, const P &p)
3737
{
3838
CHelper1<T>::load_data<
39-
object_type_traits::is_base_and_derived_or_same_from_template<
40-
IPureLoadableObject,
39+
object_type_traits::is_base_and_derived<
40+
ISerializable,
4141
T
4242
>::value
4343
>(data,stream,p);

src/Common/object_saver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ struct CSaver {
3636
IC static void save_data(const T &data, M &stream, const P &p)
3737
{
3838
CHelper1<T>::save_data<
39-
object_type_traits::is_base_and_derived_or_same_from_template<
40-
IPureSavableObject,
39+
object_type_traits::is_base_and_derived<
40+
ISerializable,
4141
T
4242
>::value
4343
>(data,stream,p);

src/utils/xrAI/server_entity_wrapper.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
class CSE_Abstract;
1414

15-
class CServerEntityWrapper : public IPureSerializeObject<IReader,IWriter> {
15+
class CServerEntityWrapper : public ISerializable
16+
{
1617
private:
1718
CSE_Abstract *m_object;
1819

src/xrGame/GameTask.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class CGameTask;
1010

1111
typedef xr_vector<luabind::functor<bool> > task_state_functors;
1212

13-
class SScriptTaskHelper: public IPureSerializeObject<IReader,IWriter>
13+
class SScriptTaskHelper: public ISerializable
1414
{
1515
public:
1616
xr_vector<shared_str> m_s_complete_lua_functions;

src/xrGame/GameTaskDefs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ enum ETaskType{
2121
extern shared_str g_active_task_id;
2222
class CGameTask;
2323

24-
struct SGameTaskKey : public IPureSerializeObject<IReader,IWriter>,public IPureDestroyableObject
24+
struct SGameTaskKey : public ISerializable, public IPureDestroyableObject
2525
{
2626
shared_str task_id;
2727
CGameTask* game_task;

src/xrGame/LevelFogOfWar.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class CUICustomMap;
1111
class CFogOfWarWrapper;
1212

13-
class CLevelFogOfWar: public IPureSerializeObject<IReader,IWriter>, public CUIWindow
13+
class CLevelFogOfWar: public ISerializable, public CUIWindow
1414
{
1515
public:
1616
ref_shader hShader;

src/xrGame/actor_statistic_defs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
extern xr_token actor_stats_token[];
55

66

7-
struct SStatDetailBData: public IPureSerializeObject<IReader,IWriter>
7+
struct SStatDetailBData: public ISerializable
88
{
99
shared_str key;
1010
s32 int_count;
@@ -18,7 +18,7 @@ struct SStatDetailBData: public IPureSerializeObject<IReader,IWriter>
1818

1919
typedef xr_vector<SStatDetailBData> vStatDetailData;
2020

21-
struct SStatSectionData: public IPureSerializeObject<IReader,IWriter>
21+
struct SStatSectionData: public ISerializable
2222
{
2323
shared_str key;
2424
vStatDetailData data;

src/xrGame/alife_abstract_registry.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
#include "Common/object_broker.h"
1313

1414
template <typename _index_type, typename _data_type>
15-
class CALifeAbstractRegistry : public IPureSerializeObject<IReader,IWriter> {
15+
class CALifeAbstractRegistry : public ISerializable
16+
{
1617
public:
1718
typedef xr_map<_index_type,_data_type> OBJECT_REGISTRY;
1819
typedef typename OBJECT_REGISTRY::iterator iterator;

0 commit comments

Comments
 (0)