Skip to content

Commit 674bacf

Browse files
committed
Refactor xrNetServer
1 parent faeca71 commit 674bacf

24 files changed

+1330
-1258
lines changed

src/xrGame/Level.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,7 @@ void CLevel::OnAlifeSimulatorLoaded()
10011001
GameTaskManager().ResetStorage();
10021002
}
10031003

1004-
void CLevel::OnSessionTerminate(LPCSTR reason) { MainMenu()->OnSessionTerminate(reason); }
1004+
void CLevel::OnSessionTerminate(pcstr reason) { MainMenu()->OnSessionTerminate(reason); }
10051005
u32 GameID() { return Game().Type(); }
10061006
CZoneList* CLevel::create_hud_zones_list()
10071007
{

src/xrGame/Level.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ class CLevel : public IGame_Level, public IPureClient
380380
virtual u32 GetRealPing() { return m_dwRealPing; }
381381
public:
382382
void remove_objects();
383-
virtual void OnSessionTerminate(LPCSTR reason);
383+
virtual void OnSessionTerminate(pcstr reason);
384384
file_transfer::client_site* m_file_transfer = nullptr;
385385
compression::ppmd_trained_stream* m_trained_stream = nullptr;
386386
compression::lzo_dictionary_buffer m_lzo_dictionary;

src/xrGame/xrServer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ void xrServer::SendBroadcast(ClientID exclude, NET_Packet& P, u32 dwFlags)
782782
net_players.ForFoundClientsDo(ClientExcluderPredicate(exclude), temp_functor);
783783
}
784784
//--------------------------------------------------------------------
785-
CSE_Abstract* xrServer::entity_Create(LPCSTR name) { return F_entity_Create(name); }
785+
CSE_Abstract* xrServer::entity_Create(pcstr name) { return F_entity_Create(name); }
786786
void xrServer::entity_Destroy(CSE_Abstract*& P)
787787
{
788788
#ifdef DEBUG

src/xrGame/xrServer.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ class xrServer : public IPureServer
177177
void Perform_reject(CSE_Abstract* what, CSE_Abstract* from, int delta);
178178
virtual void Perform_destroy(CSE_Abstract* tpSE_Abstract, u32 mode) override;
179179

180-
virtual CSE_Abstract* Process_spawn(NET_Packet& P, ClientID sender,
181-
BOOL bSpawnWithClientsMainEntityAsParent = FALSE, CSE_Abstract* tpExistedEntity = 0) override;
180+
CSE_Abstract* Process_spawn(NET_Packet& P, ClientID sender,
181+
bool bSpawnWithClientsMainEntityAsParent = false, CSE_Abstract* tpExistedEntity = nullptr) override;
182182
void Process_update(NET_Packet& P, ClientID sender);
183183
void Process_save(NET_Packet& P, ClientID sender);
184184
void Process_event(NET_Packet& P, ClientID sender);
@@ -244,7 +244,7 @@ class xrServer : public IPureServer
244244
virtual void client_Destroy(IClient* C); // destroy client info
245245

246246
// utilities
247-
virtual CSE_Abstract* entity_Create(LPCSTR name) override;
247+
virtual CSE_Abstract* entity_Create(pcstr name) override;
248248
virtual void entity_Destroy(CSE_Abstract*& P) override;
249249
u32 GetEntitiesNum() { return entities.size(); };
250250
CSE_Abstract* GetEntity(u32 Num);

src/xrGame/xrServer_process_spawn.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#endif
88

99
CSE_Abstract* xrServer::Process_spawn(
10-
NET_Packet& P, ClientID sender, BOOL bSpawnWithClientsMainEntityAsParent, CSE_Abstract* tpExistedEntity)
10+
NET_Packet& P, ClientID sender, bool bSpawnWithClientsMainEntityAsParent, CSE_Abstract* tpExistedEntity)
1111
{
1212
// create server entity
1313
xrClientData* CL = ID_to_client(sender);

src/xrNetServer/NET_AuthCheck.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
void XRNETSERVER_API fill_auth_check_params(xr_auth_strings_t& ignore, xr_auth_strings_t& check)
55
{
66
string_path config;
7-
LPCSTR pth = FS.get_path("$app_data_root$")->m_Path;
7+
pcstr pth = FS.get_path("$app_data_root$")->m_Path;
88
ignore.push_back(shared_str(pth));
99
ignore.push_back(shared_str(FS.update_path(config, "$game_config$", "localization.ltx")));
1010
ignore.push_back(shared_str(FS.update_path(config, "$game_config$", "fonts.ltx")));
@@ -13,7 +13,7 @@ void XRNETSERVER_API fill_auth_check_params(xr_auth_strings_t& ignore, xr_auth_s
1313
ignore.push_back(shared_str(FS.update_path(config, "$game_config$", "gameplay")));
1414
ignore.push_back(shared_str(FS.update_path(config, "$game_config$", "ui")));
1515
ignore.push_back(shared_str(FS.update_path(config, "$game_config$", "scripts")));
16-
ignore.push_back(shared_str(FS.update_path(config, "$game_config$", "misc\\script_sound_pripyat.ltx")));
16+
ignore.push_back(shared_str(FS.update_path(config, "$game_config$", "misc//script_sound_pripyat.ltx")));
1717
ignore.push_back(shared_str(FS.update_path(config, "$game_scripts$", "state_mgr_pri_a15.script")));
1818

1919
check.push_back(shared_str(FS.update_path(config, "$game_config$", "")));
@@ -24,33 +24,32 @@ void XRNETSERVER_API fill_auth_check_params(xr_auth_strings_t& ignore, xr_auth_s
2424
check.push_back(shared_str(FS.update_path(config, "$game_sounds$", "weapons")));
2525

2626
// check scopes
27-
check.push_back(shared_str(FS.update_path(config, "$game_textures$", "wpn\\wpn_crosshair.dds")));
28-
check.push_back(shared_str(FS.update_path(config, "$game_textures$", "wpn\\wpn_crosshair_bino.dds")));
29-
check.push_back(shared_str(FS.update_path(config, "$game_textures$", "wpn\\wpn_crosshair_g36.dds")));
30-
check.push_back(shared_str(FS.update_path(config, "$game_textures$", "wpn\\wpn_crosshair_l85.dds")));
31-
check.push_back(shared_str(FS.update_path(config, "$game_textures$", "wpn\\wpn_crosshair_rpg.dds")));
27+
check.push_back(shared_str(FS.update_path(config, "$game_textures$", "wpn//wpn_crosshair.dds")));
28+
check.push_back(shared_str(FS.update_path(config, "$game_textures$", "wpn//wpn_crosshair_bino.dds")));
29+
check.push_back(shared_str(FS.update_path(config, "$game_textures$", "wpn//wpn_crosshair_g36.dds")));
30+
check.push_back(shared_str(FS.update_path(config, "$game_textures$", "wpn//wpn_crosshair_l85.dds")));
31+
check.push_back(shared_str(FS.update_path(config, "$game_textures$", "wpn//wpn_crosshair_rpg.dds")));
3232

3333
check.push_back(shared_str("xrD3D9-Null"));
3434
check.push_back(shared_str("ODE"));
3535
check.push_back(shared_str("xrCDB"));
3636
check.push_back(shared_str("xrCore"));
37-
// check.push_back (shared_str("xrGame"));
37+
//check.push_back(shared_str("xrGame"));
3838
check.push_back(shared_str("xrGamespy"));
3939
check.push_back(shared_str("xrNetserver"));
4040
check.push_back(shared_str("xrParticles"));
4141
check.push_back(shared_str("xrRender_R1"));
4242
check.push_back(shared_str("xrRender_R2"));
4343
check.push_back(shared_str("xrSound"));
4444
check.push_back(shared_str("xrXMLParser"));
45-
// check.push_back (shared_str("xrEngine.exe"));
45+
//check.push_back(shared_str("xrEngine.exe"));
4646
}
4747

48-
bool XRNETSERVER_API allow_to_include_path(xr_auth_strings_t const& ignore, LPCSTR path)
48+
bool XRNETSERVER_API allow_to_include_path(xr_auth_strings_t const& ignore, pcstr path)
4949
{
5050
for (xr_auth_strings_t::const_iterator i = ignore.begin(), ie = ignore.end(); i != ie; ++i)
51-
{
5251
if (!strncmp(i->c_str(), path, i->size()))
5352
return false;
54-
}
53+
5554
return true;
5655
}

src/xrNetServer/NET_AuthCheck.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
#pragma once
12
#ifndef NET_AUTH_CHECK_INCLUDED
23
#define NET_AUTH_CHECK_INCLUDED
34

45
#include "net_shared.h"
56

6-
typedef xr_vector<shared_str> xr_auth_strings_t;
7+
using xr_auth_strings_t = xr_vector<shared_str>;
78
void XRNETSERVER_API fill_auth_check_params(xr_auth_strings_t& ignore, xr_auth_strings_t& check);
8-
bool XRNETSERVER_API allow_to_include_path(xr_auth_strings_t const& ignore, LPCSTR path);
9+
bool XRNETSERVER_API allow_to_include_path(xr_auth_strings_t const& ignore, pcstr path);
910

1011
#endif //#ifndef NET_AUTH_CHECK_INCLUDED

0 commit comments

Comments
 (0)