Skip to content

Commit 6cf7972

Browse files
committed
Reformat: xrGameSpy
1 parent 32e8f37 commit 6cf7972

27 files changed

+1191
-1502
lines changed

src/xrGameSpy/GameSpy_ATLAS.cpp

Lines changed: 65 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,188 +1,124 @@
1-
#include "stdafx.h"
21
#include "GameSpy_ATLAS.h"
2+
#include "stdafx.h"
33

4-
CGameSpy_ATLAS::CGameSpy_ATLAS ()
4+
CGameSpy_ATLAS::CGameSpy_ATLAS()
55
{
6-
m_interface = NULL;
7-
Init ();
6+
m_interface = NULL;
7+
Init();
88
}
99

10-
CGameSpy_ATLAS::~CGameSpy_ATLAS ()
10+
CGameSpy_ATLAS::~CGameSpy_ATLAS()
1111
{
12-
if (m_interface)
13-
{
14-
scShutdown(m_interface);
15-
}
12+
if (m_interface) {
13+
scShutdown(m_interface);
14+
}
1615
}
1716

1817
void CGameSpy_ATLAS::Init()
1918
{
20-
SCResult init_res = scInitialize(GAMESPY_GAMEID, &m_interface);
21-
VERIFY(init_res == SCResult_NO_ERROR);
22-
if (init_res != SCResult_NO_ERROR)
23-
{
24-
Msg("! GameSpy ATLAS: failed to initialize, error code: %d", init_res);
25-
}
19+
SCResult init_res = scInitialize(GAMESPY_GAMEID, &m_interface);
20+
VERIFY(init_res == SCResult_NO_ERROR);
21+
if (init_res != SCResult_NO_ERROR) {
22+
Msg("! GameSpy ATLAS: failed to initialize, error code: %d", init_res);
23+
}
2624
}
2725

2826
void CGameSpy_ATLAS::Think()
2927
{
30-
scThink(m_interface);
28+
scThink(m_interface);
3129
}
3230

3331
shared_str const CGameSpy_ATLAS::TryToTranslate(GHTTPResult httpResult)
3432
{
35-
return "mp_gamespy_http_error";
33+
return "mp_gamespy_http_error";
3634
}
3735

3836
shared_str const CGameSpy_ATLAS::TryToTranslate(WSLoginValue loginValue)
3937
{
40-
return "mp_gamespy_ws_login_error";
38+
return "mp_gamespy_ws_login_error";
4139
}
4240

4341
shared_str const CGameSpy_ATLAS::TryToTranslate(SCResult result)
4442
{
45-
return "mp_gamespy_atlas_error";
43+
return "mp_gamespy_atlas_error";
4644
}
4745

48-
u32 CGameSpy_ATLAS::WSLoginProfile(shared_str const & email,
49-
shared_str const & nick,
50-
shared_str const & password,
51-
WSLoginCallback callback,
52-
void * userData)
46+
u32 CGameSpy_ATLAS::WSLoginProfile(shared_str const& email, shared_str const& nick, shared_str const& password,
47+
WSLoginCallback callback, void* userData)
5348
{
54-
return static_cast<u32>(wsLoginProfile(GP_PARTNERID_GAMESPY, GAMESPY_GP_NAMESPACE_ID,
55-
nick.c_str(), email.c_str(), password.c_str(), NULL, callback, userData));
49+
return static_cast<u32>(wsLoginProfile(GP_PARTNERID_GAMESPY, GAMESPY_GP_NAMESPACE_ID, nick.c_str(), email.c_str(),
50+
password.c_str(), NULL, callback, userData));
5651
}
5752

58-
SCResult CGameSpy_ATLAS::CreateSession(const GSLoginCertificate * theCertificate,
59-
const GSLoginPrivateData * thePrivateData,
60-
SCCreateSessionCallback theCallback,
61-
gsi_time theTimeoutMs,
62-
void * theUserData)
53+
SCResult CGameSpy_ATLAS::CreateSession(const GSLoginCertificate* theCertificate,
54+
const GSLoginPrivateData* thePrivateData, SCCreateSessionCallback theCallback, gsi_time theTimeoutMs,
55+
void* theUserData)
6356
{
64-
return scCreateSession(
65-
m_interface,
66-
theCertificate,
67-
thePrivateData,
68-
theCallback,
69-
theTimeoutMs,
70-
theUserData
71-
);
57+
return scCreateSession(m_interface, theCertificate, thePrivateData, theCallback, theTimeoutMs, theUserData);
7258
}
7359

7460
SCResult CGameSpy_ATLAS::SetReportIntention(const gsi_u8 theConnectionId[SC_CONNECTION_GUID_SIZE],
75-
gsi_bool isAuthoritative,
76-
const GSLoginCertificate * theCertificate,
77-
const GSLoginPrivateData * thePrivateData,
78-
SCSetReportIntentionCallback theCallback,
79-
gsi_time theTimeoutMs,
80-
void * theUserData)
81-
{
82-
return scSetReportIntention(
83-
m_interface,
84-
theConnectionId,
85-
isAuthoritative,
86-
theCertificate,
87-
thePrivateData,
88-
theCallback,
89-
theTimeoutMs,
90-
theUserData
91-
);
92-
}
93-
94-
char const* CGameSpy_ATLAS::GetConnectionId()
95-
{
96-
return scGetConnectionId(m_interface);
97-
}
98-
99-
SCResult CGameSpy_ATLAS::SubmitReport(const SCReportPtr theReport,
100-
gsi_bool isAuthoritative,
101-
const GSLoginCertificate * theCertificate,
102-
const GSLoginPrivateData * thePrivateData,
103-
SCSubmitReportCallback theCallback,
104-
gsi_time theTimeoutMs,
105-
void * theUserData)
106-
{
107-
return scSubmitReport(
108-
m_interface,
109-
theReport,
110-
isAuthoritative,
111-
theCertificate,
112-
thePrivateData,
113-
theCallback,
114-
theTimeoutMs,
115-
theUserData
116-
);
117-
}
118-
119-
SCResult CGameSpy_ATLAS::CreateReport(gsi_u32 theHeaderVersion,
120-
gsi_u32 thePlayerCount,
121-
gsi_u32 theTeamCount,
122-
SCReportPtr * theReportOut)
123-
{
124-
return scCreateReport(
125-
m_interface,
126-
theHeaderVersion,
127-
thePlayerCount,
128-
theTeamCount,
129-
theReportOut
130-
);
61+
gsi_bool isAuthoritative, const GSLoginCertificate* theCertificate, const GSLoginPrivateData* thePrivateData,
62+
SCSetReportIntentionCallback theCallback, gsi_time theTimeoutMs, void* theUserData)
63+
{
64+
return scSetReportIntention(m_interface, theConnectionId, isAuthoritative, theCertificate, thePrivateData,
65+
theCallback, theTimeoutMs, theUserData);
66+
}
67+
68+
char const* CGameSpy_ATLAS::GetConnectionId()
69+
{
70+
return scGetConnectionId(m_interface);
71+
}
72+
73+
SCResult CGameSpy_ATLAS::SubmitReport(const SCReportPtr theReport, gsi_bool isAuthoritative,
74+
const GSLoginCertificate* theCertificate, const GSLoginPrivateData* thePrivateData,
75+
SCSubmitReportCallback theCallback, gsi_time theTimeoutMs, void* theUserData)
76+
{
77+
return scSubmitReport(m_interface, theReport, isAuthoritative, theCertificate, thePrivateData, theCallback,
78+
theTimeoutMs, theUserData);
79+
}
80+
81+
SCResult CGameSpy_ATLAS::CreateReport(
82+
gsi_u32 theHeaderVersion, gsi_u32 thePlayerCount, gsi_u32 theTeamCount, SCReportPtr* theReportOut)
83+
{
84+
return scCreateReport(m_interface, theHeaderVersion, thePlayerCount, theTeamCount, theReportOut);
13185
}
13286
SCResult CGameSpy_ATLAS::ReportBeginGlobalData(SCReportPtr theReportData)
13387
{
134-
return scReportBeginGlobalData(theReportData);
88+
return scReportBeginGlobalData(theReportData);
13589
}
13690

13791
SCResult CGameSpy_ATLAS::ReportBeginPlayerData(SCReportPtr theReportData)
13892
{
139-
return scReportBeginPlayerData(theReportData);
93+
return scReportBeginPlayerData(theReportData);
14094
}
14195

14296
SCResult CGameSpy_ATLAS::ReportBeginNewPlayer(SCReportPtr theReportData)
14397
{
144-
return scReportBeginNewPlayer(theReportData);
98+
return scReportBeginNewPlayer(theReportData);
14599
}
146100

147-
SCResult CGameSpy_ATLAS::ReportSetPlayerData(SCReportPtr theReport,
148-
gsi_u32 thePlayerIndex,
149-
const gsi_u8 thePlayerConnectionId[SC_CONNECTION_GUID_SIZE],
150-
gsi_u32 thePlayerTeamIndex,
151-
SCGameResult theResult,
152-
gsi_u32 theProfileId,
153-
const GSLoginCertificate * theCertificate)
101+
SCResult CGameSpy_ATLAS::ReportSetPlayerData(SCReportPtr theReport, gsi_u32 thePlayerIndex,
102+
const gsi_u8 thePlayerConnectionId[SC_CONNECTION_GUID_SIZE], gsi_u32 thePlayerTeamIndex, SCGameResult theResult,
103+
gsi_u32 theProfileId, const GSLoginCertificate* theCertificate)
154104
{
155-
gsi_u8 zero_auth_data[16];
156-
ZeroMemory(zero_auth_data, sizeof(zero_auth_data));
157-
return scReportSetPlayerData(
158-
theReport,
159-
thePlayerIndex,
160-
thePlayerConnectionId,
161-
thePlayerTeamIndex,
162-
theResult,
163-
theProfileId,
164-
theCertificate,
165-
zero_auth_data
166-
);
105+
gsi_u8 zero_auth_data[16];
106+
ZeroMemory(zero_auth_data, sizeof(zero_auth_data));
107+
return scReportSetPlayerData(theReport, thePlayerIndex, thePlayerConnectionId, thePlayerTeamIndex, theResult,
108+
theProfileId, theCertificate, zero_auth_data);
167109
}
168110

169-
SCResult CGameSpy_ATLAS::ReportAddIntValue(SCReportPtr theReportData,
170-
gsi_u16 theKeyId,
171-
gsi_i32 theValue)
111+
SCResult CGameSpy_ATLAS::ReportAddIntValue(SCReportPtr theReportData, gsi_u16 theKeyId, gsi_i32 theValue)
172112
{
173-
return scReportAddIntValue(theReportData, theKeyId, theValue);
113+
return scReportAddIntValue(theReportData, theKeyId, theValue);
174114
}
175115

176-
SCResult CGameSpy_ATLAS::ReportAddStringValue(SCReportPtr theReportData,
177-
gsi_u16 theKeyId,
178-
const gsi_char * theValue)
116+
SCResult CGameSpy_ATLAS::ReportAddStringValue(SCReportPtr theReportData, gsi_u16 theKeyId, const gsi_char* theValue)
179117
{
180-
return scReportAddStringValue(theReportData, theKeyId, theValue);
118+
return scReportAddStringValue(theReportData, theKeyId, theValue);
181119
}
182120

183-
SCResult CGameSpy_ATLAS::ReportEnd(SCReportPtr theReport,
184-
gsi_bool isAuth,
185-
SCGameStatus theStatus)
121+
SCResult CGameSpy_ATLAS::ReportEnd(SCReportPtr theReport, gsi_bool isAuth, SCGameStatus theStatus)
186122
{
187-
return scReportEnd(theReport, isAuth, theStatus);
123+
return scReportEnd(theReport, isAuth, theStatus);
188124
}

src/xrGameSpy/GameSpy_ATLAS.h

Lines changed: 37 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -7,69 +7,44 @@
77
class XRGAMESPY_API CGameSpy_ATLAS
88
{
99
public:
10-
CGameSpy_ATLAS ();
11-
~CGameSpy_ATLAS ();
10+
CGameSpy_ATLAS();
11+
~CGameSpy_ATLAS();
12+
13+
void Think();
14+
u32 WSLoginProfile(shared_str const& email, shared_str const& nick, shared_str const& password,
15+
WSLoginCallback callback, void* userData);
16+
17+
SCResult CreateSession(const GSLoginCertificate* theCertificate, const GSLoginPrivateData* thePrivateData,
18+
SCCreateSessionCallback theCallback, gsi_time theTimeoutMs, void* theUserData);
19+
20+
SCResult SetReportIntention(const gsi_u8 theConnectionId[SC_CONNECTION_GUID_SIZE], gsi_bool isAuthoritative,
21+
const GSLoginCertificate* theCertificate, const GSLoginPrivateData* thePrivateData,
22+
SCSetReportIntentionCallback theCallback, gsi_time theTimeoutMs, void* theUserData);
23+
char const* GetConnectionId();
24+
SCResult SubmitReport(const SCReportPtr theReport, gsi_bool isAuthoritative,
25+
const GSLoginCertificate* theCertificate, const GSLoginPrivateData* thePrivateData,
26+
SCSubmitReportCallback theCallback, gsi_time theTimeoutMs, void* theUserData);
27+
28+
SCResult CreateReport(
29+
gsi_u32 theHeaderVersion, gsi_u32 thePlayerCount, gsi_u32 theTeamCount, SCReportPtr* theReportOut);
30+
SCResult ReportBeginGlobalData(SCReportPtr theReportData);
31+
SCResult ReportBeginPlayerData(SCReportPtr theReportData);
32+
SCResult ReportBeginNewPlayer(SCReportPtr theReportData);
33+
SCResult ReportSetPlayerData(SCReportPtr theReport, gsi_u32 thePlayerIndex,
34+
const gsi_u8 thePlayerConnectionId[SC_CONNECTION_GUID_SIZE], gsi_u32 thePlayerTeamIndex, SCGameResult theResult,
35+
gsi_u32 theProfileId, const GSLoginCertificate* theCertificate);
36+
SCResult ReportAddIntValue(SCReportPtr theReportData, gsi_u16 theKeyId, gsi_i32 theValue);
37+
SCResult ReportAddStringValue(SCReportPtr theReportData, gsi_u16 theKeyId, const gsi_char* theValue);
38+
SCResult ReportEnd(SCReportPtr theReport, gsi_bool isAuth, SCGameStatus theStatus);
39+
40+
static shared_str const TryToTranslate(GHTTPResult httpResult);
41+
static shared_str const TryToTranslate(WSLoginValue loginValue);
42+
static shared_str const TryToTranslate(SCResult result);
1243

13-
void Think ();
14-
u32 WSLoginProfile (shared_str const & email,
15-
shared_str const & nick,
16-
shared_str const & password,
17-
WSLoginCallback callback,
18-
void * userData);
19-
20-
SCResult CreateSession (const GSLoginCertificate * theCertificate,
21-
const GSLoginPrivateData * thePrivateData,
22-
SCCreateSessionCallback theCallback,
23-
gsi_time theTimeoutMs,
24-
void * theUserData);
25-
26-
SCResult SetReportIntention (const gsi_u8 theConnectionId[SC_CONNECTION_GUID_SIZE],
27-
gsi_bool isAuthoritative,
28-
const GSLoginCertificate * theCertificate,
29-
const GSLoginPrivateData * thePrivateData,
30-
SCSetReportIntentionCallback theCallback,
31-
gsi_time theTimeoutMs,
32-
void * theUserData);
33-
char const* GetConnectionId ();
34-
SCResult SubmitReport (const SCReportPtr theReport,
35-
gsi_bool isAuthoritative,
36-
const GSLoginCertificate * theCertificate,
37-
const GSLoginPrivateData * thePrivateData,
38-
SCSubmitReportCallback theCallback,
39-
gsi_time theTimeoutMs,
40-
void * theUserData);
41-
42-
SCResult CreateReport (gsi_u32 theHeaderVersion,
43-
gsi_u32 thePlayerCount,
44-
gsi_u32 theTeamCount,
45-
SCReportPtr * theReportOut);
46-
SCResult ReportBeginGlobalData (SCReportPtr theReportData);
47-
SCResult ReportBeginPlayerData (SCReportPtr theReportData);
48-
SCResult ReportBeginNewPlayer (SCReportPtr theReportData);
49-
SCResult ReportSetPlayerData (SCReportPtr theReport,
50-
gsi_u32 thePlayerIndex,
51-
const gsi_u8 thePlayerConnectionId[SC_CONNECTION_GUID_SIZE],
52-
gsi_u32 thePlayerTeamIndex,
53-
SCGameResult theResult,
54-
gsi_u32 theProfileId,
55-
const GSLoginCertificate * theCertificate);
56-
SCResult ReportAddIntValue (SCReportPtr theReportData,
57-
gsi_u16 theKeyId,
58-
gsi_i32 theValue);
59-
SCResult ReportAddStringValue (SCReportPtr theReportData,
60-
gsi_u16 theKeyId,
61-
const gsi_char * theValue);
62-
SCResult ReportEnd (SCReportPtr theReport,
63-
gsi_bool isAuth,
64-
SCGameStatus theStatus);
65-
66-
static shared_str const TryToTranslate(GHTTPResult httpResult);
67-
static shared_str const TryToTranslate(WSLoginValue loginValue);
68-
static shared_str const TryToTranslate(SCResult result);
6944
private:
70-
SCInterfacePtr m_interface;
45+
SCInterfacePtr m_interface;
7146

72-
void Init ();
73-
}; //class CGameSpy_ATLAS
47+
void Init();
48+
}; // class CGameSpy_ATLAS
7449

75-
#endif //#ifndef GAMESPY_ATLAS_INCLUDED
50+
#endif //#ifndef GAMESPY_ATLAS_INCLUDED

0 commit comments

Comments
 (0)