[General] Basic refactoring

This commit is contained in:
momo5502 2017-01-20 14:36:52 +01:00
parent 76fd8a65f5
commit 079bc920a8
145 changed files with 447 additions and 252 deletions

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class Component class Component
@ -30,62 +32,62 @@ namespace Components
}; };
} }
#include "Modules\Auth.hpp" #include "Modules/Auth.hpp"
#include "Modules\Bans.hpp" #include "Modules/Bans.hpp"
#include "Modules\Bots.hpp" #include "Modules/Bots.hpp"
#include "Modules\Dvar.hpp" #include "Modules/Dvar.hpp"
#include "Modules\Lean.hpp" #include "Modules/Lean.hpp"
#include "Modules\Maps.hpp" #include "Modules/Maps.hpp"
#include "Modules\News.hpp" #include "Modules/News.hpp"
#include "Modules\Flags.hpp" #include "Modules/Flags.hpp"
#include "Modules\Menus.hpp" #include "Modules/Menus.hpp"
#include "Modules\Toast.hpp" #include "Modules/Toast.hpp"
#include "Modules\Zones.hpp" #include "Modules/Zones.hpp"
#include "Modules\Colors.hpp" #include "Modules/Colors.hpp"
#include "Modules\D3D9Ex.hpp" #include "Modules/D3D9Ex.hpp"
#include "Modules\Script.hpp" #include "Modules/Script.hpp"
#include "Modules\Weapon.hpp" #include "Modules/Weapon.hpp"
#include "Modules\Window.hpp" #include "Modules/Window.hpp"
#include "Modules\Command.hpp" #include "Modules/Command.hpp"
#include "Modules\Console.hpp" #include "Modules/Console.hpp"
#include "Modules\IPCPipe.hpp" #include "Modules/IPCPipe.hpp"
#include "Modules\UIScript.hpp" #include "Modules/UIScript.hpp"
#include "Modules\ModList.hpp" #include "Modules/ModList.hpp"
#include "Modules\Network.hpp" #include "Modules/Network.hpp"
#include "Modules\Theatre.hpp" #include "Modules/Theatre.hpp"
#include "Modules\Node.hpp" #include "Modules/Node.hpp"
#include "Modules\RCon.hpp" #include "Modules/RCon.hpp"
#include "Modules\Party.hpp" // Destroys the order, but requires network classes :D #include "Modules/Party.hpp" // Destroys the order, but requires network classes :D
#include "Modules\Logger.hpp" #include "Modules/Logger.hpp"
#include "Modules\Download.hpp" #include "Modules/Download.hpp"
#include "Modules\Playlist.hpp" #include "Modules/Playlist.hpp"
#include "Modules\RawFiles.hpp" #include "Modules/RawFiles.hpp"
#include "Modules\Renderer.hpp" #include "Modules/Renderer.hpp"
#include "Modules\UIFeeder.hpp" #include "Modules/UIFeeder.hpp"
#include "Modules\AntiCheat.hpp" #include "Modules/AntiCheat.hpp"
#include "Modules\Dedicated.hpp" #include "Modules/Dedicated.hpp"
#include "Modules\Discovery.hpp" #include "Modules/Discovery.hpp"
#include "Modules\Exception.hpp" #include "Modules/Exception.hpp"
#include "Modules\FastFiles.hpp" #include "Modules/FastFiles.hpp"
#include "Modules\FrameTime.hpp" #include "Modules/FrameTime.hpp"
#include "Modules\Gametypes.hpp" #include "Modules/Gametypes.hpp"
#include "Modules\Materials.hpp" #include "Modules/Materials.hpp"
#include "Modules\Singleton.hpp" #include "Modules/Singleton.hpp"
#include "Modules\Threading.hpp" #include "Modules/Threading.hpp"
#include "Modules\BitMessage.hpp" #include "Modules/BitMessage.hpp"
#include "Modules\FileSystem.hpp" #include "Modules/FileSystem.hpp"
#include "Modules\ModelSurfs.hpp" #include "Modules/ModelSurfs.hpp"
#include "Modules\PlayerName.hpp" #include "Modules/PlayerName.hpp"
#include "Modules\QuickPatch.hpp" #include "Modules/QuickPatch.hpp"
#include "Modules\ServerInfo.hpp" #include "Modules/ServerInfo.hpp"
#include "Modules\ServerList.hpp" #include "Modules/ServerList.hpp"
#include "Modules\SlowMotion.hpp" #include "Modules/SlowMotion.hpp"
#include "Modules\ArenaLength.hpp" #include "Modules/ArenaLength.hpp"
#include "Modules\StringTable.hpp" #include "Modules/StringTable.hpp"
#include "Modules\ZoneBuilder.hpp" #include "Modules/ZoneBuilder.hpp"
#include "Modules\AssetHandler.hpp" #include "Modules/AssetHandler.hpp"
#include "Modules\Localization.hpp" #include "Modules/Localization.hpp"
#include "Modules\MusicalTalent.hpp" #include "Modules/MusicalTalent.hpp"
#include "Modules\MinidumpUpload.hpp" #include "Modules/MinidumpUpload.hpp"
#include "Modules\StructuredData.hpp" #include "Modules/StructuredData.hpp"
#include "Modules\ConnectProtocol.hpp" #include "Modules/ConnectProtocol.hpp"

View File

@ -33,7 +33,7 @@ namespace Components
{ {
#ifdef DEBUG_DETECTIONS #ifdef DEBUG_DETECTIONS
Logger::Flush(); Logger::Flush();
MessageBoxA(0, "Check the log for more information!", "AntiCheat triggered", MB_ICONERROR); MessageBoxA(nullptr, "Check the log for more information!", "AntiCheat triggered", MB_ICONERROR);
ExitProcess(0xFFFFFFFF); ExitProcess(0xFFFFFFFF);
#else #else
static std::thread triggerThread; static std::thread triggerThread;
@ -200,7 +200,7 @@ namespace Components
MessageBoxA(0, Utils::String::VA("Loading library %s via %s %X", std::string(library.begin(), library.end()).data(), buffer, reinterpret_cast<uint32_t>(callee)), 0, 0); MessageBoxA(0, Utils::String::VA("Loading library %s via %s %X", std::string(library.begin(), library.end()).data(), buffer, reinterpret_cast<uint32_t>(callee)), 0, 0);
return LoadLibraryExW(library.data(), NULL, 0); return LoadLibraryExW(library.data(), nullptr, 0);
} }
HANDLE WINAPI AntiCheat::LoadLibaryAStub(const char* library) HANDLE WINAPI AntiCheat::LoadLibaryAStub(const char* library)
@ -357,7 +357,7 @@ namespace Components
DWORD dwSize = 0; DWORD dwSize = 0;
PVOID pTokenInfo = nullptr; PVOID pTokenInfo = nullptr;
if (GetTokenInformation(hToken, TokenUser, NULL, 0, &dwSize) || GetLastError() != ERROR_INSUFFICIENT_BUFFER) return GetLastError(); if (GetTokenInformation(hToken, TokenUser, nullptr, 0, &dwSize) || GetLastError() != ERROR_INSUFFICIENT_BUFFER) return GetLastError();
if (dwSize) if (dwSize)
{ {
@ -458,9 +458,9 @@ namespace Components
SE_KERNEL_OBJECT, // process object SE_KERNEL_OBJECT, // process object
OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION, OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
psidCurUser, // NULL, // Owner SID psidCurUser, // NULL, // Owner SID
NULL, // Group SID nullptr, // Group SID
pDacl, pDacl,
NULL // SACL nullptr // SACL
); );
} }

View File

@ -1,3 +1,5 @@
#pragma once
#ifndef DEBUG #ifndef DEBUG
// Hide AntiCheat in embeded symbol names // Hide AntiCheat in embeded symbol names
#define AntiCheat SubComponent #define AntiCheat SubComponent
@ -12,7 +14,7 @@ namespace Components
~AntiCheat(); ~AntiCheat();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "AntiCheat"; }; const char* getName() override { return "AntiCheat"; };
#endif #endif
static void CrashClient(); static void CrashClient();

View File

@ -6,7 +6,7 @@ namespace Components
ArenaLength(); ArenaLength();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "ArenaLength"; }; const char* getName() override { return "ArenaLength"; };
#endif #endif
static Game::newMapArena_t NewArenas[128]; static Game::newMapArena_t NewArenas[128];

View File

@ -276,7 +276,7 @@ namespace Components
Game::XAssetHeader AssetHandler::FindAssetForZone(Game::XAssetType type, std::string filename, ZoneBuilder::Zone* builder, bool isSubAsset) Game::XAssetHeader AssetHandler::FindAssetForZone(Game::XAssetType type, std::string filename, ZoneBuilder::Zone* builder, bool isSubAsset)
{ {
Game::XAssetHeader header = { 0 }; Game::XAssetHeader header = { nullptr };
if (type >= Game::XAssetType::ASSET_TYPE_COUNT) return header; if (type >= Game::XAssetType::ASSET_TYPE_COUNT) return header;
auto tempPool = &AssetHandler::TemporaryAssets[type]; auto tempPool = &AssetHandler::TemporaryAssets[type];

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class AssetHandler : public Component class AssetHandler : public Component
@ -21,7 +23,7 @@ namespace Components
~AssetHandler(); ~AssetHandler();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "AssetHandler"; }; const char* getName() override { return "AssetHandler"; };
#endif #endif
static void OnFind(Game::XAssetType type, Utils::Slot<Callback> callback); static void OnFind(Game::XAssetType type, Utils::Slot<Callback> callback);
@ -70,30 +72,30 @@ namespace Components
}; };
} }
#include "AssetInterfaces\IXModel.hpp" #include "AssetInterfaces/IXModel.hpp"
#include "AssetInterfaces\IFxWorld.hpp" #include "AssetInterfaces/IFxWorld.hpp"
#include "AssetInterfaces\IMapEnts.hpp" #include "AssetInterfaces/IMapEnts.hpp"
#include "AssetInterfaces\IRawFile.hpp" #include "AssetInterfaces/IRawFile.hpp"
#include "AssetInterfaces\IComWorld.hpp" #include "AssetInterfaces/IComWorld.hpp"
#include "AssetInterfaces\IGfxImage.hpp" #include "AssetInterfaces/IGfxImage.hpp"
#include "AssetInterfaces\IGfxWorld.hpp" #include "AssetInterfaces/IGfxWorld.hpp"
#include "AssetInterfaces\IMaterial.hpp" #include "AssetInterfaces/IMaterial.hpp"
#include "AssetInterfaces\ISndCurve.hpp" #include "AssetInterfaces/ISndCurve.hpp"
#include "AssetInterfaces\IclipMap_t.hpp" #include "AssetInterfaces/IclipMap_t.hpp"
#include "AssetInterfaces\IPhysPreset.hpp" #include "AssetInterfaces/IPhysPreset.hpp"
#include "AssetInterfaces\IXAnimParts.hpp" #include "AssetInterfaces/IXAnimParts.hpp"
#include "AssetInterfaces\IFxEffectDef.hpp" #include "AssetInterfaces/IFxEffectDef.hpp"
#include "AssetInterfaces\IGameWorldMp.hpp" #include "AssetInterfaces/IGameWorldMp.hpp"
#include "AssetInterfaces\IGameWorldSp.hpp" #include "AssetInterfaces/IGameWorldSp.hpp"
#include "AssetInterfaces\IGfxLightDef.hpp" #include "AssetInterfaces/IGfxLightDef.hpp"
#include "AssetInterfaces\ILoadedSound.hpp" #include "AssetInterfaces/ILoadedSound.hpp"
#include "AssetInterfaces\IPhysCollmap.hpp" #include "AssetInterfaces/IPhysCollmap.hpp"
#include "AssetInterfaces\IStringTable.hpp" #include "AssetInterfaces/IStringTable.hpp"
#include "AssetInterfaces\IXModelSurfs.hpp" #include "AssetInterfaces/IXModelSurfs.hpp"
#include "AssetInterfaces\ILocalizeEntry.hpp" #include "AssetInterfaces/ILocalizeEntry.hpp"
#include "AssetInterfaces\Isnd_alias_list_t.hpp" #include "AssetInterfaces/Isnd_alias_list_t.hpp"
#include "AssetInterfaces\IMaterialPixelShader.hpp" #include "AssetInterfaces/IMaterialPixelShader.hpp"
#include "AssetInterfaces\IMaterialTechniqueSet.hpp" #include "AssetInterfaces/IMaterialTechniqueSet.hpp"
#include "AssetInterfaces\IMaterialVertexShader.hpp" #include "AssetInterfaces/IMaterialVertexShader.hpp"
#include "AssetInterfaces\IStructuredDataDefSet.hpp" #include "AssetInterfaces/IStructuredDataDefSet.hpp"
#include "AssetInterfaces\IMaterialVertexDeclaration.hpp" #include "AssetInterfaces/IMaterialVertexDeclaration.hpp"

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
namespace Assets namespace Assets
{ {

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IComWorld : public Components::AssetHandler::IAsset class IComWorld : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
namespace Assets namespace Assets
{ {

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IFxEffectDef : public Components::AssetHandler::IAsset class IFxEffectDef : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <StdInclude.hpp> #include "StdInclude.hpp"
namespace Assets namespace Assets
{ {

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IFxWorld : public Components::AssetHandler::IAsset class IFxWorld : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
namespace Assets namespace Assets
{ {

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IGameWorldMp : public Components::AssetHandler::IAsset class IGameWorldMp : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
namespace Assets namespace Assets
{ {

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IGameWorldSp : public Components::AssetHandler::IAsset class IGameWorldSp : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
#define IW4X_IMG_VERSION "0" #define IW4X_IMG_VERSION "0"

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IGfxImage : public Components::AssetHandler::IAsset class IGfxImage : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
namespace Assets namespace Assets
{ {

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IGfxLightDef : public Components::AssetHandler::IAsset class IGfxLightDef : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
#define IW4X_GFXMAP_VERSION 1 #define IW4X_GFXMAP_VERSION 1

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IGfxWorld : public Components::AssetHandler::IAsset class IGfxWorld : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
namespace Assets namespace Assets
{ {

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class ILoadedSound : public Components::AssetHandler::IAsset class ILoadedSound : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
namespace Assets namespace Assets
{ {

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class ILocalizeEntry : public Components::AssetHandler::IAsset class ILocalizeEntry : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
namespace Assets namespace Assets
{ {

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IMapEnts : public Components::AssetHandler::IAsset class IMapEnts : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
#define IW4X_MAT_VERSION "0" #define IW4X_MAT_VERSION "0"

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IMaterial : public Components::AssetHandler::IAsset class IMaterial : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
namespace Assets namespace Assets
{ {

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IMaterialPixelShader : public Components::AssetHandler::IAsset class IMaterialPixelShader : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
namespace Assets namespace Assets
{ {

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IMaterialTechniqueSet : public Components::AssetHandler::IAsset class IMaterialTechniqueSet : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
namespace Assets namespace Assets
{ {

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IMaterialVertexDeclaration : public Components::AssetHandler::IAsset class IMaterialVertexDeclaration : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
namespace Assets namespace Assets
{ {

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IMaterialVertexShader : public Components::AssetHandler::IAsset class IMaterialVertexShader : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
namespace Assets namespace Assets
{ {

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IPhysCollmap : public Components::AssetHandler::IAsset class IPhysCollmap : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
namespace Assets namespace Assets
{ {

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IPhysPreset : public Components::AssetHandler::IAsset class IPhysPreset : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
namespace Assets namespace Assets
{ {

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IRawFile : public Components::AssetHandler::IAsset class IRawFile : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
namespace Assets namespace Assets
{ {

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class ISndCurve : public Components::AssetHandler::IAsset class ISndCurve : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
namespace Assets namespace Assets
{ {

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IStringTable : public Components::AssetHandler::IAsset class IStringTable : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
namespace Assets namespace Assets
{ {

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IStructuredDataDefSet : public Components::AssetHandler::IAsset class IStructuredDataDefSet : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
#define IW4X_ANIM_VERSION 1 #define IW4X_ANIM_VERSION 1

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IXAnimParts : public Components::AssetHandler::IAsset class IXAnimParts : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
#define IW4X_MODEL_VERSION 4 #define IW4X_MODEL_VERSION 4

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IXModel : public Components::AssetHandler::IAsset class IXModel : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
namespace Assets namespace Assets
{ {

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IXModelSurfs : public Components::AssetHandler::IAsset class IXModelSurfs : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <StdInclude.hpp> #include "StdInclude.hpp"
#define IW4X_CLIPMAP_VERSION 1 #define IW4X_CLIPMAP_VERSION 1

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class IclipMap_t : public Components::AssetHandler::IAsset class IclipMap_t : public Components::AssetHandler::IAsset

View File

@ -1,4 +1,4 @@
#include <STDInclude.hpp> #include "STDInclude.hpp"
namespace Assets namespace Assets
{ {

View File

@ -1,3 +1,5 @@
#pragma once
namespace Assets namespace Assets
{ {
class Isnd_alias_list_t : public Components::AssetHandler::IAsset class Isnd_alias_list_t : public Components::AssetHandler::IAsset

View File

@ -109,12 +109,10 @@ namespace Components
return; return;
} }
if (address.isLoopback() // Simply connect, if we're in debug mode, we ignore all security checks
// Simply connect, if we're in debug mode, we ignore all security checks #ifndef DEBUG
#ifdef DEBUG if (address.isLoopback())
|| true
#endif #endif
)
{ {
if (!connectData.infostring().empty()) if (!connectData.infostring().empty())
{ {
@ -127,6 +125,7 @@ namespace Components
Network::Send(address, "error\nInvalid infostring data!"); Network::Send(address, "error\nInvalid infostring data!");
} }
} }
#ifndef DEBUG
else else
{ {
// Validate proto data // Validate proto data
@ -204,6 +203,7 @@ namespace Components
Logger::Print("Verified XUID %llX (%d) from %s\n", xuid, userLevel, address.getCString()); Logger::Print("Verified XUID %llX (%d) from %s\n", xuid, userLevel, address.getCString());
Game::SV_DirectConnect(*address.get()); Game::SV_DirectConnect(*address.get());
} }
#endif
} }
__declspec(naked) void Auth::DirectConnectStub() __declspec(naked) void Auth::DirectConnectStub()

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class Auth : public Component class Auth : public Component
@ -7,10 +9,10 @@ namespace Components
~Auth(); ~Auth();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Auth"; }; const char* getName() override { return "Auth"; };
#endif #endif
bool unitTest(); bool unitTest() override;
static void StoreKey(); static void StoreKey();
static void LoadKey(bool force = false); static void LoadKey(bool force = false);

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class Bans : public Component class Bans : public Component
@ -9,7 +11,7 @@ namespace Components
~Bans(); ~Bans();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Bans"; }; const char* getName() override { return "Bans"; };
#endif #endif
static void BanClientNum(int num, std::string reason); static void BanClientNum(int num, std::string reason);

View File

@ -2,10 +2,6 @@
#ifndef DISABLE_BITMESSAGE #ifndef DISABLE_BITMESSAGE
#include <Shlwapi.h>
using namespace Utils;
namespace Components namespace Components
{ {
std::thread BitMessage::ShutDownThread; std::thread BitMessage::ShutDownThread;
@ -110,6 +106,9 @@ namespace Components
case 3: // Reconnecting case 3: // Reconnecting
Logger::Print("%s: Reconnecting\n", node->Ip.data()); Logger::Print("%s: Reconnecting\n", node->Ip.data());
break; break;
default:
break;
} }
} }

View File

@ -2,8 +2,8 @@
#ifndef DISABLE_BITMESSAGE #ifndef DISABLE_BITMESSAGE
#define BITMESSAGE_KEYS_FILENAME std::string("players/bmk.dat") #define BITMESSAGE_KEYS_FILENAME "players/bmk.dat"s
#define BITMESSAGE_OBJECT_STORAGE_FILENAME std::string("players/storage.dat") #define BITMESSAGE_OBJECT_STORAGE_FILENAME "players/storage.dat"s
namespace Components namespace Components
{ {
@ -14,7 +14,7 @@ namespace Components
~BitMessage(); ~BitMessage();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "BitMessage"; }; const char* getName() override { return "BitMessage"; };
#endif #endif
static void SetDefaultTTL(time_t ttl); static void SetDefaultTTL(time_t ttl);

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class Bots : public Component class Bots : public Component
@ -7,7 +9,7 @@ namespace Components
~Bots(); ~Bots();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Bots"; }; const char* getName() override { return "Bots"; };
#endif #endif
private: private:

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class Colors : public Component class Colors : public Component
@ -7,7 +9,7 @@ namespace Components
~Colors(); ~Colors();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Colors"; }; const char* getName() override { return "Colors"; };
#endif #endif
static void Strip(const char* in, char* out, int max); static void Strip(const char* in, char* out, int max);

View File

@ -62,7 +62,7 @@ namespace Components
{ {
if (Loader::IsPregame()) if (Loader::IsPregame())
{ {
MessageBoxA(0, "Registering server commands in pregamestate is illegal!", 0, MB_ICONERROR); MessageBoxA(0, "Registering server commands in pregamestate is illegal!", nullptr, MB_ICONERROR);
#ifdef DEBUG #ifdef DEBUG
__debugbreak(); __debugbreak();
@ -237,14 +237,14 @@ namespace Components
float pos[3] = { 0.0f, 0.0f, 0.0f }; float pos[3] = { 0.0f, 0.0f, 0.0f };
float orientation[3] = { 0.0f, 0.0f, 0.0f }; float orientation[3] = { 0.0f, 0.0f, 0.0f };
pos[0] = strtof(params->get(1), NULL); pos[0] = strtof(params->get(1), nullptr);
pos[1] = strtof(params->get(2), NULL); pos[1] = strtof(params->get(2), nullptr);
pos[2] = strtof(params->get(3), NULL); pos[2] = strtof(params->get(3), nullptr);
if(params->length() == 6) if(params->length() == 6)
{ {
orientation[0] = strtof(params->get(4), NULL); orientation[0] = strtof(params->get(4), nullptr);
orientation[1] = strtof(params->get(5), NULL); orientation[1] = strtof(params->get(5), nullptr);
} }
Game::TeleportPlayer(&Game::g_entities[clientNum], pos, orientation); Game::TeleportPlayer(&Game::g_entities[clientNum], pos, orientation);
@ -258,7 +258,7 @@ namespace Components
{ {
if (params->length() > 1) if (params->length() > 1)
{ {
ShellExecuteA(NULL, "open", params->get(1), 0, 0, SW_SHOWNORMAL); ShellExecuteA(nullptr, "open", params->get(1), nullptr, nullptr, SW_SHOWNORMAL);
} }
}); });
} }

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class Command : public Component class Command : public Component
@ -49,7 +51,7 @@ namespace Components
~Command(); ~Command();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Command"; }; const char* getName() override { return "Command"; };
#endif #endif
static Game::cmd_function_t* Allocate(); static Game::cmd_function_t* Allocate();

View File

@ -22,16 +22,16 @@ namespace Components
bool ConnectProtocol::InstallProtocol() bool ConnectProtocol::InstallProtocol()
{ {
HKEY hKey = NULL; HKEY hKey = nullptr;
std::string data; std::string data;
char ownPth[MAX_PATH] = { 0 }; char ownPth[MAX_PATH] = { 0 };
char workdir[MAX_PATH] = { 0 }; char workdir[MAX_PATH] = { 0 };
DWORD dwsize = MAX_PATH; DWORD dwsize = MAX_PATH;
HMODULE hModule = GetModuleHandle(NULL); HMODULE hModule = GetModuleHandle(nullptr);
if (hModule != NULL) if (hModule != nullptr)
{ {
if (GetModuleFileNameA(hModule, ownPth, MAX_PATH) == ERROR) if (GetModuleFileNameA(hModule, ownPth, MAX_PATH) == ERROR)
{ {
@ -45,7 +45,7 @@ namespace Components
else else
{ {
char* endPtr = strstr(workdir, "iw4x.exe"); char* endPtr = strstr(workdir, "iw4x.exe");
if (endPtr != NULL) if (endPtr != nullptr)
{ {
*endPtr = 0; *endPtr = 0;
} }
@ -68,7 +68,7 @@ namespace Components
char regred[MAX_PATH] = { 0 }; char regred[MAX_PATH] = { 0 };
// Check if the game has been moved. // Check if the game has been moved.
openRes = RegQueryValueExA(hKey, 0, 0, 0, reinterpret_cast<BYTE*>(regred), &dwsize); openRes = RegQueryValueExA(hKey, nullptr, 0, 0, reinterpret_cast<BYTE*>(regred), &dwsize);
if (openRes == ERROR_SUCCESS) if (openRes == ERROR_SUCCESS)
{ {
char* endPtr = strstr(regred, "\" \"%1\""); char* endPtr = strstr(regred, "\" \"%1\"");
@ -84,7 +84,7 @@ namespace Components
RegCloseKey(hKey); RegCloseKey(hKey);
if (strcmp(regred + 1, ownPth)) if (strcmp(regred + 1, ownPth))
{ {
openRes = RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x"); RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x");
} }
else else
{ {
@ -93,12 +93,12 @@ namespace Components
} }
else else
{ {
openRes = RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x"); RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x");
} }
} }
else else
{ {
openRes = RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x"); RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Classes\\iw4x");
} }
// Open SOFTWARE\\Classes // Open SOFTWARE\\Classes

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class ConnectProtocol : public Component class ConnectProtocol : public Component
@ -6,7 +8,7 @@ namespace Components
ConnectProtocol(); ConnectProtocol();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "ConnectProtocol"; }; const char* getName() override { return "ConnectProtocol"; };
#endif #endif
static bool IsEvaluated(); static bool IsEvaluated();

View File

@ -1,3 +1,5 @@
#pragma once
#define OUTPUT_HEIGHT 250 #define OUTPUT_HEIGHT 250
#define OUTPUT_MAX_TOP (OUTPUT_HEIGHT - (Console::Height - 2)) #define OUTPUT_MAX_TOP (OUTPUT_HEIGHT - (Console::Height - 2))
@ -10,7 +12,7 @@ namespace Components
~Console(); ~Console();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Console"; }; const char* getName() override { return "Console"; };
#endif #endif
static void SetSkipShutdown(); static void SetSkipShutdown();

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class D3D9Ex : public Component class D3D9Ex : public Component
@ -6,7 +8,7 @@ namespace Components
D3D9Ex(); D3D9Ex();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "D3D9Ex"; }; const char* getName() override { return "D3D9Ex"; };
#endif #endif
private: private:

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class Dedicated : public Component class Dedicated : public Component
@ -9,7 +11,7 @@ namespace Components
~Dedicated(); ~Dedicated();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Dedicated"; }; const char* getName() override { return "Dedicated"; };
#endif #endif
static bool IsEnabled(); static bool IsEnabled();

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class Discovery : public Component class Discovery : public Component
@ -7,7 +9,7 @@ namespace Components
~Discovery(); ~Discovery();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Discovery"; }; const char* getName() override { return "Discovery"; };
#endif #endif
static void Perform(); static void Perform();

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class Download : public Component class Download : public Component
@ -7,7 +9,7 @@ namespace Components
~Download(); ~Download();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Download"; }; const char* getName() override { return "Download"; };
#endif #endif
static void InitiateClientDownload(std::string mod); static void InitiateClientDownload(std::string mod);
@ -16,7 +18,7 @@ namespace Components
class ClientDownload class ClientDownload
{ {
public: public:
ClientDownload() : valid(false), running(false), terminateThread(false), totalBytes(0), downBytes(0), lastTimeStamp(0), timeStampBytes(0) {} ClientDownload() : running(false), valid(false), terminateThread(false), totalBytes(0), downBytes(0), lastTimeStamp(0), timeStampBytes(0) {}
~ClientDownload() { this->clear(); } ~ClientDownload() { this->clear(); }
bool running; bool running;

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class Dvar : public Component class Dvar : public Component
@ -43,7 +45,7 @@ namespace Components
~Dvar(); ~Dvar();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Dvar"; }; const char* getName() override { return "Dvar"; };
#endif #endif
static void OnInit(Utils::Slot<Callback> callback); static void OnInit(Utils::Slot<Callback> callback);

View File

@ -1,4 +1,4 @@
#pragma once
namespace Components namespace Components
{ {
@ -9,7 +9,7 @@ namespace Components
~Exception(); ~Exception();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Exception"; }; const char* getName() override { return "Exception"; };
#endif #endif
static LPTOP_LEVEL_EXCEPTION_FILTER Hook(); static LPTOP_LEVEL_EXCEPTION_FILTER Hook();

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class FastFiles : public Component class FastFiles : public Component
@ -7,7 +9,7 @@ namespace Components
~FastFiles(); ~FastFiles();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "FastFiles"; }; const char* getName() override { return "FastFiles"; };
#endif #endif
static void AddZonePath(std::string path); static void AddZonePath(std::string path);

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class FileSystem : public Component class FileSystem : public Component
@ -19,9 +21,9 @@ namespace Components
File() {}; File() {};
File(std::string file) : filePath(file) { this->read(); }; File(std::string file) : filePath(file) { this->read(); };
bool exists() { return !this->buffer.empty(); }; bool exists() override { return !this->buffer.empty(); };
std::string getName() { return this->filePath; }; std::string getName() override { return this->filePath; };
std::string& getBuffer() { return this->buffer; }; std::string& getBuffer() override { return this->buffer; };
private: private:
std::string filePath; std::string filePath;
@ -36,9 +38,9 @@ namespace Components
RawFile() {}; RawFile() {};
RawFile(std::string file) : filePath(file) { this->read(); }; RawFile(std::string file) : filePath(file) { this->read(); };
bool exists() { return !this->buffer.empty(); }; bool exists() override { return !this->buffer.empty(); };
std::string getName() { return this->filePath; }; std::string getName() override { return this->filePath; };
std::string& getBuffer() { return this->buffer; }; std::string& getBuffer() override { return this->buffer; };
private: private:
std::string filePath; std::string filePath;
@ -87,7 +89,7 @@ namespace Components
~FileSystem(); ~FileSystem();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "FileSystem"; }; const char* getName() override { return "FileSystem"; };
#endif #endif
static std::vector<std::string> GetFileList(std::string path, std::string extension); static std::vector<std::string> GetFileList(std::string path, std::string extension);

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class Flags : public Component class Flags : public Component
@ -7,7 +9,7 @@ namespace Components
~Flags(); ~Flags();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Flags"; }; const char* getName() override { return "Flags"; };
#endif #endif
static bool HasFlag(std::string flag); static bool HasFlag(std::string flag);

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class FrameTime : public Component class FrameTime : public Component
@ -6,7 +8,7 @@ namespace Components
FrameTime(); FrameTime();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "FrameTime"; }; const char* getName() override { return "FrameTime"; };
#endif #endif
private: private:

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class Gametypes : public Component class Gametypes : public Component
@ -6,7 +8,7 @@ namespace Components
Gametypes(); Gametypes();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Gametypes"; }; const char* getName() override { return "Gametypes"; };
#endif #endif
private: private:

View File

@ -7,7 +7,7 @@ namespace Components
#pragma region Pipe #pragma region Pipe
Pipe::Pipe() : type(IPCTYPE_NONE), reconnectAttempt(0), pipe(INVALID_HANDLE_VALUE), connectCallback(0), threadAttached(false) Pipe::Pipe() : connectCallback(0), pipe(INVALID_HANDLE_VALUE), threadAttached(false), type(IPCTYPE_NONE), reconnectAttempt(0)
{ {
this->destroy(); this->destroy();
} }

View File

@ -1,3 +1,5 @@
#pragma once
#define IPC_MAX_RECONNECTS 3 #define IPC_MAX_RECONNECTS 3
#define IPC_COMMAND_SIZE 100 #define IPC_COMMAND_SIZE 100
#define IPC_BUFFER_SIZE 0x2000 #define IPC_BUFFER_SIZE 0x2000
@ -63,7 +65,7 @@ namespace Components
IPCPipe(); IPCPipe();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "IPCPipe"; }; const char* getName() override { return "IPCPipe"; };
#endif #endif
static bool Write(std::string command, std::string data); static bool Write(std::string command, std::string data);

View File

@ -1,3 +1,5 @@
#pragma once
#define BUTTON_FLAG_LEANLEFT 0x40 #define BUTTON_FLAG_LEANLEFT 0x40
#define BUTTON_FLAG_LEANRIGHT 0x80 #define BUTTON_FLAG_LEANRIGHT 0x80
@ -9,7 +11,7 @@ namespace Components
Lean(); Lean();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Lean"; }; const char* getName() override { return "Lean"; };
#endif #endif
private: private:

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class Localization : public Component class Localization : public Component
@ -7,7 +9,7 @@ namespace Components
~Localization(); ~Localization();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Localization"; }; const char* getName() override { return "Localization"; };
#endif #endif
static void Set(std::string key, std::string value); static void Set(std::string key, std::string value);

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class Logger : public Component class Logger : public Component
@ -7,7 +9,7 @@ namespace Components
~Logger(); ~Logger();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Logger"; }; const char* getName() override { return "Logger"; };
#endif #endif
static void MessagePrint(int channel, std::string message); static void MessagePrint(int channel, std::string message);

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class Maps : public Component class Maps : public Component
@ -7,7 +9,7 @@ namespace Components
~Maps(); ~Maps();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Maps"; }; const char* getName() override { return "Maps"; };
#endif #endif
static void HandleAsSPMap(); static void HandleAsSPMap();

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class Materials : public Component class Materials : public Component
@ -7,7 +9,7 @@ namespace Components
~Materials(); ~Materials();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Materials"; }; const char* getName() override { return "Materials"; };
#endif #endif
static int FormatImagePath(char* buffer, size_t size, int, int, const char* image); static int FormatImagePath(char* buffer, size_t size, int, int, const char* image);

View File

@ -1,3 +1,5 @@
#pragma once
#define MAX_SOURCEFILES 64 #define MAX_SOURCEFILES 64
#undef LoadMenu #undef LoadMenu
@ -10,7 +12,7 @@ namespace Components
~Menus(); ~Menus();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Menus"; }; const char* getName() override { return "Menus"; };
#endif #endif
static void FreeEverything(); static void FreeEverything();

View File

@ -37,7 +37,7 @@ namespace Components
{ {
public: public:
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "MinidumpUpload"; }; const char* getName() override { return "MinidumpUpload"; };
#endif #endif
MinidumpUpload(); MinidumpUpload();
~MinidumpUpload(); ~MinidumpUpload();

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class ModList : public Component class ModList : public Component
@ -7,7 +9,7 @@ namespace Components
~ModList(); ~ModList();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "ModList"; }; const char* getName() override { return "ModList"; };
#endif #endif
static void RunMod(std::string mod); static void RunMod(std::string mod);

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class ModelSurfs : public Component class ModelSurfs : public Component
@ -7,7 +9,7 @@ namespace Components
~ModelSurfs(); ~ModelSurfs();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "ModelSurfs"; }; const char* getName() override { return "ModelSurfs"; };
#endif #endif
private: private:

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class MusicalTalent : public Component class MusicalTalent : public Component
@ -7,7 +9,7 @@ namespace Components
~MusicalTalent(); ~MusicalTalent();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "MusicalTalent"; }; const char* getName() override { return "MusicalTalent"; };
#endif #endif
static void Replace(std::string sound, const char* file); static void Replace(std::string sound, const char* file);

View File

@ -1,3 +1,5 @@
#pragma once
#define NETWORK_MAX_PACKETS_PER_SECOND 100'000 #define NETWORK_MAX_PACKETS_PER_SECOND 100'000
namespace Components namespace Components
@ -57,7 +59,7 @@ namespace Components
~Network(); ~Network();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Network"; }; const char* getName() override { return "Network"; };
#endif #endif
static void Handle(std::string packet, Utils::Slot<Callback> callback); static void Handle(std::string packet, Utils::Slot<Callback> callback);

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class News : public Component class News : public Component
@ -7,10 +9,10 @@ namespace Components
~News(); ~News();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "News"; }; const char* getName() override { return "News"; };
#endif #endif
bool unitTest(); bool unitTest() override;
private: private:
static std::thread Thread; static std::thread Thread;

View File

@ -1,3 +1,5 @@
#pragma once
#define NODE_QUERY_INTERVAL 1000 * 60 * 2 // Query nodelist from nodes evry 2 minutes #define NODE_QUERY_INTERVAL 1000 * 60 * 2 // Query nodelist from nodes evry 2 minutes
#define NODE_QUERY_TIMEOUT 1000 * 30 * 1 // Invalidate nodes after 30 seconds without query response #define NODE_QUERY_TIMEOUT 1000 * 30 * 1 // Invalidate nodes after 30 seconds without query response
#define NODE_INVALID_DELETE 1000 * 60 * 10 // Delete invalidated nodes after 10 minutes #define NODE_INVALID_DELETE 1000 * 60 * 10 // Delete invalidated nodes after 10 minutes
@ -18,10 +20,10 @@ namespace Components
~Node(); ~Node();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Node"; }; const char* getName() override { return "Node"; };
#endif #endif
bool unitTest(); bool unitTest() override;
static void SyncNodeList(); static void SyncNodeList();
static void AddNode(Network::Address address); static void AddNode(Network::Address address);

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class Party : public Component class Party : public Component
@ -7,7 +9,7 @@ namespace Components
~Party(); ~Party();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "Party"; }; const char* getName() override { return "Party"; };
#endif #endif
static Network::Address Target(); static Network::Address Target();

View File

@ -1,3 +1,5 @@
#pragma once
namespace Components namespace Components
{ {
class PlayerName : public Component class PlayerName : public Component
@ -7,7 +9,7 @@ namespace Components
~PlayerName(); ~PlayerName();
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS) #if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
const char* getName() { return "PlayerName"; }; const char* getName() override { return "PlayerName"; };
#endif #endif
private: private:

Some files were not shown because too many files have changed in this diff Show More