Small optimizations

This commit is contained in:
momo5502 2016-04-11 11:25:08 +02:00
parent 3c15e41585
commit 4cb3e04c88
10 changed files with 23 additions and 30 deletions

2
deps/protobuf vendored

@ -1 +1 @@
Subproject commit 667f4a6282f9d7e7edb0acc8758e384b17a0359d Subproject commit 3ffbdd712f0413ce4964d626c5e10533f1f74893

View File

@ -1,7 +1,5 @@
#include "STDInclude.hpp" #include "STDInclude.hpp"
using namespace std::literals;
namespace Components namespace Components
{ {
ConnectProtocol::Container ConnectProtocol::ConnectContainer = { false, false, "" }; ConnectProtocol::Container ConnectProtocol::ConnectContainer = { false, false, "" };

View File

@ -1,7 +1,5 @@
#include "STDInclude.hpp" #include "STDInclude.hpp"
using namespace std::literals;
namespace Components namespace Components
{ {
WINDOW* Console::OutputWindow; WINDOW* Console::OutputWindow;
@ -322,7 +320,7 @@ namespace Components
{ {
while (true) while (true)
{ {
Sleep(5000); std::this_thread::sleep_for(5s);
} }
} }

View File

@ -1,7 +1,5 @@
#include "STDInclude.hpp" #include "STDInclude.hpp"
using namespace std::literals;
namespace Components namespace Components
{ {
Discovery::Container Discovery::DiscoveryContainer = { false, false, nullptr }; Discovery::Container Discovery::DiscoveryContainer = { false, false, nullptr };

View File

@ -93,7 +93,7 @@ namespace Components
void FileSystem::DeleteFile(std::string folder, std::string file) void FileSystem::DeleteFile(std::string folder, std::string file)
{ {
char path[MAX_PATH] = { 0 }; char path[MAX_PATH] = { 0 };
Game::FS_BuildPathToFile(Dvar::Var("fs_basepath").Get<const char*>(),reinterpret_cast<char*>(0x63D0BB8), Utils::VA("%s/%s", folder.data(), file.data()), reinterpret_cast<char**>(&path)); Game::FS_BuildPathToFile(Dvar::Var("fs_basepath").Get<const char*>(), reinterpret_cast<char*>(0x63D0BB8), Utils::VA("%s/%s", folder.data(), file.data()), reinterpret_cast<char**>(&path));
Game::FS_Remove(path); Game::FS_Remove(path);
} }

View File

@ -1,7 +1,5 @@
#include "STDInclude.hpp" #include "STDInclude.hpp"
using namespace std::literals;
namespace Components namespace Components
{ {
Pipe* IPCPipe::ServerPipe = 0; Pipe* IPCPipe::ServerPipe = 0;
@ -36,7 +34,7 @@ namespace Components
{ {
Logger::Print("Attempting to reconnect to the pipe.\n"); Logger::Print("Attempting to reconnect to the pipe.\n");
this->ReconnectAttempt++; this->ReconnectAttempt++;
Sleep(500); std::this_thread::sleep_for(500ms);
return this->Connect(name); return this->Connect(name);
} }

View File

@ -1,7 +1,5 @@
#include "STDInclude.hpp" #include "STDInclude.hpp"
using namespace std::literals;
namespace Components namespace Components
{ {
Utils::Cryptography::ECDSA::Key Node::SignatureKey; Utils::Cryptography::ECDSA::Key Node::SignatureKey;

View File

@ -373,8 +373,8 @@ namespace Components
Game::Menus_CloseAll(Game::uiContext); Game::Menus_CloseAll(Game::uiContext);
char xnaddr[32]; Game::_XSESSION_INFO hostInfo;
Game::CL_ConnectFromParty(0, xnaddr, *address.Get(), 0, 0, info.Get("mapname").data(), info.Get("gametype").data()); Game::CL_ConnectFromParty(0, &hostInfo, *address.Get(), 0, 0, info.Get("mapname").data(), info.Get("gametype").data());
} }
} }
else else

View File

@ -15,7 +15,7 @@ namespace Game
typedef int(__cdecl * CL_IsCgameInitialized_t)(); typedef int(__cdecl * CL_IsCgameInitialized_t)();
extern CL_IsCgameInitialized_t CL_IsCgameInitialized; extern CL_IsCgameInitialized_t CL_IsCgameInitialized;
typedef void(__cdecl * CL_ConnectFromParty_t)(int controller, void*, netadr_t adr, int, int, const char*, const char*); typedef void(__cdecl * CL_ConnectFromParty_t)(int controllerIndex, _XSESSION_INFO *hostInfo, netadr_t addr, int numPublicSlots, int numPrivateSlots, const char *mapname, const char *gametype);
extern CL_ConnectFromParty_t CL_ConnectFromParty; extern CL_ConnectFromParty_t CL_ConnectFromParty;
typedef void(__cdecl * Cmd_AddCommand_t)(const char* name, void(*callback), cmd_function_t* data, char); typedef void(__cdecl * Cmd_AddCommand_t)(const char* name, void(*callback), cmd_function_t* data, char);
@ -24,22 +24,22 @@ namespace Game
typedef void(__cdecl * Cmd_AddServerCommand_t)(const char* name, void(*callback), cmd_function_t* data); typedef void(__cdecl * Cmd_AddServerCommand_t)(const char* name, void(*callback), cmd_function_t* data);
extern Cmd_AddServerCommand_t Cmd_AddServerCommand; extern Cmd_AddServerCommand_t Cmd_AddServerCommand;
typedef void(__cdecl * Cmd_ExecuteSingleCommand_t)(int controller, int a2, const char* cmd); typedef void(__cdecl * Cmd_ExecuteSingleCommand_t)(int localClientNum, int controllerIndex, const char* cmd);
extern Cmd_ExecuteSingleCommand_t Cmd_ExecuteSingleCommand; extern Cmd_ExecuteSingleCommand_t Cmd_ExecuteSingleCommand;
typedef void(__cdecl * Com_Error_t)(int type, char* message, ...); typedef void(__cdecl * Com_Error_t)(int type, char* message, ...);
extern Com_Error_t Com_Error; extern Com_Error_t Com_Error;
typedef void(__cdecl * Com_Printf_t)(int, const char*, ...); typedef void(__cdecl * Com_Printf_t)(int channel, const char *fmt, ...);
extern Com_Printf_t Com_Printf; extern Com_Printf_t Com_Printf;
typedef void(__cdecl * Com_PrintMessage_t)(int, const char*, char); typedef void(__cdecl * Com_PrintMessage_t)(int channel, const char *msg, int error);
extern Com_PrintMessage_t Com_PrintMessage; extern Com_PrintMessage_t Com_PrintMessage;
typedef int(__cdecl * Com_Milliseconds_t)(void); typedef int(__cdecl * Com_Milliseconds_t)();
extern Com_Milliseconds_t Com_Milliseconds; extern Com_Milliseconds_t Com_Milliseconds;
typedef char* (__cdecl * Com_ParseExt_t)(const char**); typedef char* (__cdecl * Com_ParseExt_t)(const char **data_p);
extern Com_ParseExt_t Com_ParseExt; extern Com_ParseExt_t Com_ParseExt;
typedef void(__cdecl * DB_EnumXAssets_t)(XAssetType type, void(*)(XAssetHeader, void *), void* userdata, bool overrides); typedef void(__cdecl * DB_EnumXAssets_t)(XAssetType type, void(*)(XAssetHeader, void *), void* userdata, bool overrides);
@ -48,7 +48,7 @@ namespace Game
typedef XAssetHeader (__cdecl * DB_FindXAssetHeader_t)(XAssetType type, const char* name); typedef XAssetHeader (__cdecl * DB_FindXAssetHeader_t)(XAssetType type, const char* name);
extern DB_FindXAssetHeader_t DB_FindXAssetHeader; extern DB_FindXAssetHeader_t DB_FindXAssetHeader;
typedef const char* (__cdecl * DB_GetXAssetNameHandler_t)(Game::XAssetHeader* asset); typedef const char* (__cdecl * DB_GetXAssetNameHandler_t)(XAssetHeader* asset);
extern DB_GetXAssetNameHandler_t* DB_GetXAssetNameHandlers; extern DB_GetXAssetNameHandler_t* DB_GetXAssetNameHandlers;
typedef int(__cdecl * DB_GetXAssetSizeHandler_t)(); typedef int(__cdecl * DB_GetXAssetSizeHandler_t)();
@ -148,7 +148,7 @@ namespace Game
typedef int(__cdecl * FS_Remove_t)(char *); typedef int(__cdecl * FS_Remove_t)(char *);
extern FS_Remove_t FS_Remove; extern FS_Remove_t FS_Remove;
typedef int(__cdecl * FS_Restart_t)(int a1, int a2); typedef int(__cdecl * FS_Restart_t)(int localClientNum, int checksumFeed);
extern FS_Restart_t FS_Restart; extern FS_Restart_t FS_Restart;
typedef int(__cdecl * FS_BuildPathToFile_t)(const char*, const char*, const char*, char**); typedef int(__cdecl * FS_BuildPathToFile_t)(const char*, const char*, const char*, char**);
@ -191,7 +191,7 @@ namespace Game
typedef __int64(__cdecl * MSG_ReadInt64_t)(msg_t* msg); typedef __int64(__cdecl * MSG_ReadInt64_t)(msg_t* msg);
extern MSG_ReadInt64_t MSG_ReadInt64; extern MSG_ReadInt64_t MSG_ReadInt64;
typedef char* (__cdecl * MSG_ReadString_t)(msg_t*); typedef char* (__cdecl * MSG_ReadString_t)(msg_t* msg);
extern MSG_ReadString_t MSG_ReadString; extern MSG_ReadString_t MSG_ReadString;
typedef int(__cdecl * MSG_ReadByte_t)(msg_t* msg); typedef int(__cdecl * MSG_ReadByte_t)(msg_t* msg);
@ -200,10 +200,10 @@ namespace Game
typedef void(__cdecl * MSG_WriteByte_t)(msg_t* msg, unsigned char c); typedef void(__cdecl * MSG_WriteByte_t)(msg_t* msg, unsigned char c);
extern MSG_WriteByte_t MSG_WriteByte; extern MSG_WriteByte_t MSG_WriteByte;
typedef void(__cdecl * MSG_WriteData_t)(msg_t* msg, char*, size_t); typedef void(__cdecl * MSG_WriteData_t)(msg_t *buf, const void *data, int length);
extern MSG_WriteData_t MSG_WriteData; extern MSG_WriteData_t MSG_WriteData;
typedef void(__cdecl * MSG_WriteLong_t)(msg_t* msg, int); typedef void(__cdecl * MSG_WriteLong_t)(msg_t *msg, int c);
extern MSG_WriteLong_t MSG_WriteLong; extern MSG_WriteLong_t MSG_WriteLong;
typedef int(__cdecl * MSG_WriteBitsCompress_t)(bool trainHuffman, const char *from, char *to, int size); typedef int(__cdecl * MSG_WriteBitsCompress_t)(bool trainHuffman, const char *from, char *to, int size);
@ -212,13 +212,13 @@ namespace Game
typedef const char* (__cdecl * NET_AdrToString_t)(netadr_t adr); typedef const char* (__cdecl * NET_AdrToString_t)(netadr_t adr);
extern NET_AdrToString_t NET_AdrToString; extern NET_AdrToString_t NET_AdrToString;
typedef bool(__cdecl * NET_CompareAdr_t)(netadr_t, netadr_t); typedef bool(__cdecl * NET_CompareAdr_t)(netadr_t a, netadr_t b);
extern NET_CompareAdr_t NET_CompareAdr; extern NET_CompareAdr_t NET_CompareAdr;
typedef bool(__cdecl * NET_IsLocalAddress_t)(netadr_t); typedef bool(__cdecl * NET_IsLocalAddress_t)(netadr_t adr);
extern NET_IsLocalAddress_t NET_IsLocalAddress; extern NET_IsLocalAddress_t NET_IsLocalAddress;
typedef bool(__cdecl * NET_StringToAdr_t)(const char*, netadr_t*); typedef bool(__cdecl * NET_StringToAdr_t)(const char *s, netadr_t *a);
extern NET_StringToAdr_t NET_StringToAdr; extern NET_StringToAdr_t NET_StringToAdr;
typedef void(__cdecl* NET_OutOfBandPrint_t)(netsrc_t sock, netadr_t adr, const char *data); typedef void(__cdecl* NET_OutOfBandPrint_t)(netsrc_t sock, netadr_t adr, const char *data);

View File

@ -101,6 +101,9 @@
#pragma comment(lib, "Wininet.lib") #pragma comment(lib, "Wininet.lib")
#pragma comment(lib, "shlwapi.lib") #pragma comment(lib, "shlwapi.lib")
// Enable additional literals
using namespace std::literals;
#endif #endif
// Revision number // Revision number