-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathreplay.h
108 lines (89 loc) · 4 KB
/
replay.h
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
ent-ghost
Copyright [2011-2013] [Jack Lu]
This file is part of the ent-ghost source code.
ent-ghost is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ent-ghost source code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ent-ghost source code. If not, see <http://www.gnu.org/licenses/>.
ent-ghost is modified from GHost++ (http://ghostplusplus.googlecode.com/)
GHost++ is Copyright [2008] [Trevor Hogan]
*/
#ifndef REPLAY_H
#define REPLAY_H
#include "gameslot.h"
//
// CReplay
//
class CIncomingAction;
class CReplay : public CPacked
{
public:
enum BlockID {
REPLAY_LEAVEGAME = 0x17,
REPLAY_FIRSTSTARTBLOCK = 0x1A,
REPLAY_SECONDSTARTBLOCK = 0x1B,
REPLAY_THIRDSTARTBLOCK = 0x1C,
REPLAY_TIMESLOT2 = 0x1E, // corresponds to W3GS_INCOMING_ACTION2
REPLAY_TIMESLOT = 0x1F, // corresponds to W3GS_INCOMING_ACTION
REPLAY_CHATMESSAGE = 0x20,
REPLAY_CHECKSUM = 0x22, // corresponds to W3GS_OUTGOING_KEEPALIVE
REPLAY_DESYNC = 0x23
};
private:
unsigned char m_HostPID;
string m_HostName;
string m_GameName;
string m_StatString;
uint32_t m_PlayerCount;
uint32_t m_MapGameType;
vector<PIDPlayer> m_Players;
vector<CGameSlot> m_Slots;
uint32_t m_RandomSeed;
unsigned char m_SelectMode; // also known as the "layout style" elsewhere in this project
unsigned char m_StartSpotCount;
queue<BYTEARRAY> m_LoadingBlocks;
queue<BYTEARRAY> m_Blocks;
queue<uint32_t> m_CheckSums;
string m_CompiledBlocks;
public:
CReplay( );
virtual ~CReplay( );
unsigned char GetHostPID( ) { return m_HostPID; }
string GetHostName( ) { return m_HostName; }
string GetGameName( ) { return m_GameName; }
string GetStatString( ) { return m_StatString; }
uint32_t GetPlayerCount( ) { return m_PlayerCount; }
uint32_t GetMapGameType( ) { return m_MapGameType; }
vector<PIDPlayer> GetPlayers( ) { return m_Players; }
vector<CGameSlot> GetSlots( ) { return m_Slots; }
uint32_t GetRandomSeed( ) { return m_RandomSeed; }
unsigned char GetSelectMode( ) { return m_SelectMode; }
unsigned char GetStartSpotCount( ) { return m_StartSpotCount; }
queue<BYTEARRAY> *GetLoadingBlocks( ) { return &m_LoadingBlocks; }
queue<BYTEARRAY> *GetBlocks( ) { return &m_Blocks; }
queue<uint32_t> *GetCheckSums( ) { return &m_CheckSums; }
void AddPlayer( unsigned char nPID, string nName ) { m_Players.push_back( PIDPlayer( nPID, nName ) ); }
void SetSlots( vector<CGameSlot> nSlots ) { m_Slots = nSlots; }
void SetRandomSeed( uint32_t nRandomSeed ) { m_RandomSeed = nRandomSeed; }
void SetSelectMode( unsigned char nSelectMode ) { m_SelectMode = nSelectMode; }
void SetStartSpotCount( unsigned char nStartSpotCount ) { m_StartSpotCount = nStartSpotCount; }
void SetMapGameType( uint32_t nMapGameType ) { m_MapGameType = nMapGameType; }
void SetHostPID( unsigned char nHostPID ) { m_HostPID = nHostPID; }
void SetHostName( string nHostName ) { m_HostName = nHostName; }
void AddLeaveGame( uint32_t reason, unsigned char PID, uint32_t result );
void AddLeaveGameDuringLoading( uint32_t reason, unsigned char PID, uint32_t result );
void AddTimeSlot2( queue<CIncomingAction *> actions );
void AddTimeSlot( uint16_t timeIncrement, queue<CIncomingAction *> actions );
void AddChatMessage( unsigned char PID, unsigned char flags, uint32_t chatMode, string message );
void AddLoadingBlock( BYTEARRAY &loadingBlock );
void BuildReplay( string gameName, string statString, uint32_t war3Version, uint16_t buildNumber );
void ParseReplay( bool parseBlocks );
};
#endif