DDraceNetwork Docs
save.h
Go to the documentation of this file.
1#ifndef GAME_SERVER_SAVE_H
2#define GAME_SERVER_SAVE_H
3
4#include <base/vmath.h>
5
8
10class CGameContext;
11class CGameWorld;
12class CCharacter;
13class CSaveTeam;
14
15enum
16{
20};
21
22enum class ESaveResult
23{
24 SUCCESS,
31};
32
34{
35public:
37 ~CSaveTee() = default;
38 void Save(CCharacter *pchr, bool AddPenalty = true);
39 bool Load(CCharacter *pchr, int Team, bool IsSwap = false);
40 char *GetString(const CSaveTeam *pTeam);
41 int FromString(const char *pString);
42 void LoadHookedPlayer(const CSaveTeam *pTeam);
43 bool IsHooking() const;
44 vec2 GetPos() const { return m_Pos; }
45 const char *GetName() const { return m_aName; }
46 int GetClientId() const { return m_ClientId; }
47 void SetClientId(int ClientId) { m_ClientId = ClientId; }
48
49 enum
50 {
56 };
57
58private:
60
61 char m_aString[2048];
62 char m_aName[16];
63
67
68 // Teamstuff
72
74 {
76 int m_Ammo;
78 int m_Got;
80
81 // ninja
82 struct
83 {
89
92
102
113
118
120
124
125 // Core
139
140 // player input
145
147
149};
150
152{
153public:
154 CSaveTeam();
155 ~CSaveTeam();
156 char *GetString();
157 int GetMembersCount() const { return m_MembersCount; }
158 // MatchPlayers has to be called afterwards
159 int FromString(const char *pString);
160 // returns true if a team can load, otherwise writes a nice error Message in pMessage
161 bool MatchPlayers(const char (*paNames)[MAX_NAME_LENGTH], const int *pClientId, int NumPlayer, char *pMessage, int MessageLen) const;
162 ESaveResult Save(CGameContext *pGameServer, int Team, bool Dry = false, bool Force = false);
163 bool Load(CGameContext *pGameServer, int Team, bool KeepCurrentWeakStrong, bool IgnorePlayers = false);
164
166
167 // returns true if an error occurred
168 static bool HandleSaveError(ESaveResult Result, int ClientId, CGameContext *pGameContext);
169
170private:
171 CCharacter *MatchCharacter(CGameContext *pGameServer, int ClientId, int SaveId, bool KeepCurrentCharacter) const;
172
173 char m_aString[65536];
174
176 {
180 };
182
183 int m_TeamState = 0;
187 int m_Practice = 0;
188};
189
190#endif // GAME_SERVER_SAVE_H
Definition: character.h:30
Definition: gamecontext.h:79
Definition: gameworld.h:17
Definition: save.h:152
bool Load(CGameContext *pGameServer, int Team, bool KeepCurrentWeakStrong, bool IgnorePlayers=false)
Definition: save.cpp:595
int FromString(const char *pString)
Definition: save.cpp:673
CSaveTeam()
Definition: save.cpp:485
SSimpleSwitchers * m_pSwitchers
Definition: save.h:181
ESaveResult Save(CGameContext *pGameServer, int Team, bool Dry=false, bool Force=false)
Definition: save.cpp:496
char * GetString()
Definition: save.cpp:649
int m_MembersCount
Definition: save.h:184
char m_aString[65536]
Definition: save.h:173
int m_TeamLocked
Definition: save.h:186
CCharacter * MatchCharacter(CGameContext *pGameServer, int ClientId, int SaveId, bool KeepCurrentCharacter) const
Definition: save.cpp:638
static bool HandleSaveError(ESaveResult Result, int ClientId, CGameContext *pGameContext)
Definition: save.cpp:567
int m_TeamState
Definition: save.h:183
~CSaveTeam()
Definition: save.cpp:490
int GetMembersCount() const
Definition: save.h:157
CSaveTee * m_pSavedTees
Definition: save.h:165
int m_HighestSwitchNumber
Definition: save.h:185
bool MatchPlayers(const char(*paNames)[MAX_NAME_LENGTH], const int *pClientId, int NumPlayer, char *pMessage, int MessageLen) const
Definition: save.cpp:827
int m_Practice
Definition: save.h:187
Definition: save.h:34
char m_aString[2048]
Definition: save.h:61
int m_HookHitEnabled
Definition: save.h:107
vec2 m_HookTeleBase
Definition: save.h:134
int m_LastPenalty
Definition: save.h:112
void SetClientId(int ClientId)
Definition: save.h:47
int m_Jumps
Definition: save.h:131
int m_LiveFrozen
Definition: save.h:99
vec2 m_ActivationDir
Definition: save.h:84
int m_Jetpack
Definition: save.h:94
int m_QueuedWeapon
Definition: save.h:91
int m_DeepFrozen
Definition: save.h:98
int m_LastTimeCp
Definition: save.h:115
struct CSaveTee::@262 m_Ninja
~CSaveTee()=default
int m_NinjaJetpack
Definition: save.h:95
void Save(CCharacter *pchr, bool AddPenalty=true)
Definition: save.cpp:14
int m_Time
Definition: save.h:108
int m_CollisionEnabled
Definition: save.h:104
int m_HitDisabledFlags
Definition: save.h:103
int m_EndlessHook
Definition: save.h:100
int m_CurrentMoveTime
Definition: save.h:86
int m_NewHook
Definition: save.h:138
bool Load(CCharacter *pchr, int Team, bool IsSwap=false)
Definition: save.cpp:134
@ SHOTGUN_HIT_DISABLED
Definition: save.h:53
@ LASER_HIT_DISABLED
Definition: save.h:55
@ GRENADE_HIT_DISABLED
Definition: save.h:54
@ HAMMER_HIT_DISABLED
Definition: save.h:52
@ HIT_ALL
Definition: save.h:51
int m_TuneZoneOld
Definition: save.h:106
int GetClientId() const
Definition: save.h:46
int m_InputFire
Definition: save.h:143
int m_NeededFaketuning
Definition: save.h:66
int m_LastTimeCpBroadcasted
Definition: save.h:116
int m_InputJump
Definition: save.h:142
int m_HookState
Definition: save.h:136
int m_LastWeapon
Definition: save.h:90
int m_Paused
Definition: save.h:65
const char * GetName() const
Definition: save.h:45
int m_ActivationTick
Definition: save.h:85
struct CSaveTee::WeaponStat m_aWeapons[NUM_WEAPONS]
float m_aCurrentTimeCp[MAX_CHECKPOINTS]
Definition: save.h:117
int m_Alive
Definition: save.h:64
int m_JumpedTotal
Definition: save.h:130
int m_OldVelAmount
Definition: save.h:87
int m_FreezeTime
Definition: save.h:96
int m_Jumped
Definition: save.h:129
int m_HasTelegunLaser
Definition: save.h:123
int m_HasTelegunGrenade
Definition: save.h:122
vec2 m_HookPos
Definition: save.h:132
int FromString(const char *pString)
Definition: save.cpp:350
int m_TeleCheckpoint
Definition: save.h:111
char m_aGameUuid[UUID_MAXSTRSIZE]
Definition: save.h:148
int m_TeeFinished
Definition: save.h:70
int m_TimeCpBroadcastEndTime
Definition: save.h:114
vec2 m_PrevPos
Definition: save.h:110
int m_TuneZone
Definition: save.h:105
vec2 GetPos() const
Definition: save.h:44
char m_aName[16]
Definition: save.h:62
bool IsHooking() const
Definition: save.cpp:480
int m_IsSolo
Definition: save.h:71
void LoadHookedPlayer(const CSaveTeam *pTeam)
Definition: save.cpp:473
vec2 m_CorePos
Definition: save.h:126
int m_InputHook
Definition: save.h:144
int m_HookedPlayer
Definition: save.h:137
int m_HasTelegunGun
Definition: save.h:121
vec2 m_Pos
Definition: save.h:109
int m_ReloadTimer
Definition: save.h:146
int m_ClientId
Definition: save.h:59
int m_ActiveWeapon
Definition: save.h:128
char * GetString(const CSaveTeam *pTeam)
Definition: save.cpp:263
int m_HookTick
Definition: save.h:135
vec2 m_Vel
Definition: save.h:127
int m_NotEligibleForFinish
Definition: save.h:119
int m_TeeStarted
Definition: save.h:69
int m_EndlessJump
Definition: save.h:93
int m_InputDirection
Definition: save.h:141
int m_FreezeStart
Definition: save.h:97
vec2 m_HookDir
Definition: save.h:133
int m_DDRaceState
Definition: save.h:101
Definition: gamecontroller.h:19
@ MAX_CHECKPOINTS
Definition: protocol.h:90
@ MAX_NAME_LENGTH
Definition: protocol.h:97
@ NUM_WEAPONS
Definition: protocol.h:1257
@ NUM_RESCUEMODES
Definition: save.h:19
@ RESCUEMODE_AUTO
Definition: save.h:17
@ RESCUEMODE_MANUAL
Definition: save.h:18
ESaveResult
Definition: save.h:23
Definition: save.h:176
int m_EndTime
Definition: save.h:178
int m_Type
Definition: save.h:179
int m_Status
Definition: save.h:177
Definition: save.h:74
int m_Got
Definition: save.h:78
int m_AmmoRegenStart
Definition: save.h:75
int m_Ammo
Definition: save.h:76
int m_Ammocost
Definition: save.h:77
@ UUID_MAXSTRSIZE
Definition: uuid_manager.h:8