Skip to content

Commit

Permalink
Refactor xrNetServer
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Oct 21, 2017
1 parent faeca71 commit 674bacf
Show file tree
Hide file tree
Showing 24 changed files with 1,330 additions and 1,258 deletions.
2 changes: 1 addition & 1 deletion src/xrGame/Level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ void CLevel::OnAlifeSimulatorLoaded()
GameTaskManager().ResetStorage();
}

void CLevel::OnSessionTerminate(LPCSTR reason) { MainMenu()->OnSessionTerminate(reason); }
void CLevel::OnSessionTerminate(pcstr reason) { MainMenu()->OnSessionTerminate(reason); }
u32 GameID() { return Game().Type(); }
CZoneList* CLevel::create_hud_zones_list()
{
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/Level.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ class CLevel : public IGame_Level, public IPureClient
virtual u32 GetRealPing() { return m_dwRealPing; }
public:
void remove_objects();
virtual void OnSessionTerminate(LPCSTR reason);
virtual void OnSessionTerminate(pcstr reason);
file_transfer::client_site* m_file_transfer = nullptr;
compression::ppmd_trained_stream* m_trained_stream = nullptr;
compression::lzo_dictionary_buffer m_lzo_dictionary;
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/xrServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ void xrServer::SendBroadcast(ClientID exclude, NET_Packet& P, u32 dwFlags)
net_players.ForFoundClientsDo(ClientExcluderPredicate(exclude), temp_functor);
}
//--------------------------------------------------------------------
CSE_Abstract* xrServer::entity_Create(LPCSTR name) { return F_entity_Create(name); }
CSE_Abstract* xrServer::entity_Create(pcstr name) { return F_entity_Create(name); }
void xrServer::entity_Destroy(CSE_Abstract*& P)
{
#ifdef DEBUG
Expand Down
6 changes: 3 additions & 3 deletions src/xrGame/xrServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ class xrServer : public IPureServer
void Perform_reject(CSE_Abstract* what, CSE_Abstract* from, int delta);
virtual void Perform_destroy(CSE_Abstract* tpSE_Abstract, u32 mode) override;

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

// utilities
virtual CSE_Abstract* entity_Create(LPCSTR name) override;
virtual CSE_Abstract* entity_Create(pcstr name) override;
virtual void entity_Destroy(CSE_Abstract*& P) override;
u32 GetEntitiesNum() { return entities.size(); };
CSE_Abstract* GetEntity(u32 Num);
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/xrServer_process_spawn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#endif

CSE_Abstract* xrServer::Process_spawn(
NET_Packet& P, ClientID sender, BOOL bSpawnWithClientsMainEntityAsParent, CSE_Abstract* tpExistedEntity)
NET_Packet& P, ClientID sender, bool bSpawnWithClientsMainEntityAsParent, CSE_Abstract* tpExistedEntity)
{
// create server entity
xrClientData* CL = ID_to_client(sender);
Expand Down
23 changes: 11 additions & 12 deletions src/xrNetServer/NET_AuthCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
void XRNETSERVER_API fill_auth_check_params(xr_auth_strings_t& ignore, xr_auth_strings_t& check)
{
string_path config;
LPCSTR pth = FS.get_path("$app_data_root$")->m_Path;
pcstr pth = FS.get_path("$app_data_root$")->m_Path;
ignore.push_back(shared_str(pth));
ignore.push_back(shared_str(FS.update_path(config, "$game_config$", "localization.ltx")));
ignore.push_back(shared_str(FS.update_path(config, "$game_config$", "fonts.ltx")));
Expand All @@ -13,7 +13,7 @@ void XRNETSERVER_API fill_auth_check_params(xr_auth_strings_t& ignore, xr_auth_s
ignore.push_back(shared_str(FS.update_path(config, "$game_config$", "gameplay")));
ignore.push_back(shared_str(FS.update_path(config, "$game_config$", "ui")));
ignore.push_back(shared_str(FS.update_path(config, "$game_config$", "scripts")));
ignore.push_back(shared_str(FS.update_path(config, "$game_config$", "misc\\script_sound_pripyat.ltx")));
ignore.push_back(shared_str(FS.update_path(config, "$game_config$", "misc//script_sound_pripyat.ltx")));
ignore.push_back(shared_str(FS.update_path(config, "$game_scripts$", "state_mgr_pri_a15.script")));

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

// check scopes
check.push_back(shared_str(FS.update_path(config, "$game_textures$", "wpn\\wpn_crosshair.dds")));
check.push_back(shared_str(FS.update_path(config, "$game_textures$", "wpn\\wpn_crosshair_bino.dds")));
check.push_back(shared_str(FS.update_path(config, "$game_textures$", "wpn\\wpn_crosshair_g36.dds")));
check.push_back(shared_str(FS.update_path(config, "$game_textures$", "wpn\\wpn_crosshair_l85.dds")));
check.push_back(shared_str(FS.update_path(config, "$game_textures$", "wpn\\wpn_crosshair_rpg.dds")));
check.push_back(shared_str(FS.update_path(config, "$game_textures$", "wpn//wpn_crosshair.dds")));
check.push_back(shared_str(FS.update_path(config, "$game_textures$", "wpn//wpn_crosshair_bino.dds")));
check.push_back(shared_str(FS.update_path(config, "$game_textures$", "wpn//wpn_crosshair_g36.dds")));
check.push_back(shared_str(FS.update_path(config, "$game_textures$", "wpn//wpn_crosshair_l85.dds")));
check.push_back(shared_str(FS.update_path(config, "$game_textures$", "wpn//wpn_crosshair_rpg.dds")));

check.push_back(shared_str("xrD3D9-Null"));
check.push_back(shared_str("ODE"));
check.push_back(shared_str("xrCDB"));
check.push_back(shared_str("xrCore"));
// check.push_back (shared_str("xrGame"));
//check.push_back(shared_str("xrGame"));
check.push_back(shared_str("xrGamespy"));
check.push_back(shared_str("xrNetserver"));
check.push_back(shared_str("xrParticles"));
check.push_back(shared_str("xrRender_R1"));
check.push_back(shared_str("xrRender_R2"));
check.push_back(shared_str("xrSound"));
check.push_back(shared_str("xrXMLParser"));
// check.push_back (shared_str("xrEngine.exe"));
//check.push_back(shared_str("xrEngine.exe"));
}

bool XRNETSERVER_API allow_to_include_path(xr_auth_strings_t const& ignore, LPCSTR path)
bool XRNETSERVER_API allow_to_include_path(xr_auth_strings_t const& ignore, pcstr path)
{
for (xr_auth_strings_t::const_iterator i = ignore.begin(), ie = ignore.end(); i != ie; ++i)
{
if (!strncmp(i->c_str(), path, i->size()))
return false;
}

return true;
}
5 changes: 3 additions & 2 deletions src/xrNetServer/NET_AuthCheck.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#pragma once
#ifndef NET_AUTH_CHECK_INCLUDED
#define NET_AUTH_CHECK_INCLUDED

#include "net_shared.h"

typedef xr_vector<shared_str> xr_auth_strings_t;
using xr_auth_strings_t = xr_vector<shared_str>;
void XRNETSERVER_API fill_auth_check_params(xr_auth_strings_t& ignore, xr_auth_strings_t& check);
bool XRNETSERVER_API allow_to_include_path(xr_auth_strings_t const& ignore, LPCSTR path);
bool XRNETSERVER_API allow_to_include_path(xr_auth_strings_t const& ignore, pcstr path);

#endif //#ifndef NET_AUTH_CHECK_INCLUDED
Loading

0 comments on commit 674bacf

Please sign in to comment.