-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSerialization.cpp
62 lines (45 loc) · 1.32 KB
/
Serialization.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Include StdAfx.h
#include "StdAfx.h"
#ifdef RUN_ONLY
/////////////////////////////
// RUNTIME serialization
void ExtObject::Serialize(bin& ar)
{
int gameID;
CString gamePrivateKey;
CString username;
CString userToken;
if (ar.loading)
{
ar >> gameID >> gamePrivateKey >> username >> userToken >> m_LoadScoresCount;
api.SetGameID( gameID );
api.SetGamePrivateKey( CStdString( gamePrivateKey ) );
api.SetUsername( CStdString( username ) );
api.SetUserToken( CStdString( userToken ) );
}
else
{
ar << api.GetGameID() << CString( api.GetGamePrivateKey() ) << CString( api.GetUsername() ) << CString( api.GetUserToken() ) << m_LoadScoresCount;
}
}
#else // RUN_ONLY
/////////////////////////////
// EDITTIME serialization
// Save and load all your object's edittime data here.
// If you change the serialization format after plugin release, change 'Version' and check it while loading.
// You can then use the old serialization routine if 'Version' is still 1, and set new features to their defaults.
// You never need to check 'Version' while saving.
void EditExt::Serialize(bin& ar)
{
int Version = 1;
SerializeVersion(ar, Version);
if (ar.loading)
{
ar >> m_GameID >> m_GamePrivateKey >> m_LoadScoresCount;
}
else
{
ar << m_GameID << m_GamePrivateKey << m_LoadScoresCount;
}
}
#endif // RUN_ONLY