From 59586e18e66f983c7342e6645e3f6dfad08ffeb4 Mon Sep 17 00:00:00 2001 From: Maurice Heumann Date: Sun, 1 Jan 2023 21:51:04 +0100 Subject: [PATCH] Rename component interfaces --- src/client/component/arxan.cpp | 2 +- src/client/component/auth.cpp | 2 +- src/client/component/bots.cpp | 2 +- src/client/component/branding.cpp | 2 +- src/client/component/colors.cpp | 2 +- src/client/component/command.cpp | 2 +- src/client/component/console.cpp | 2 +- src/client/component/dedicated.cpp | 2 +- src/client/component/demonware.cpp | 2 +- src/client/component/discord.cpp | 2 +- src/client/component/exception.cpp | 2 +- src/client/component/icon.cpp | 2 +- src/client/component/loot.cpp | 2 +- src/client/component/network.cpp | 2 +- src/client/component/party.cpp | 2 +- src/client/component/scheduler.cpp | 2 +- src/client/component/splash.cpp | 2 +- src/client/component/steam_proxy.cpp | 2 +- src/client/component/updater.cpp | 2 +- src/client/game/game.cpp | 5 +++-- src/client/loader/component_interface.hpp | 8 ++++---- src/client/loader/component_loader.cpp | 10 +++++----- src/client/loader/component_loader.hpp | 4 ++-- 23 files changed, 33 insertions(+), 32 deletions(-) diff --git a/src/client/component/arxan.cpp b/src/client/component/arxan.cpp index 069e2021..f9c8bb1e 100644 --- a/src/client/component/arxan.cpp +++ b/src/client/component/arxan.cpp @@ -696,7 +696,7 @@ namespace arxan return zw_terminate_process_hook.invoke(process_handle, exit_status); } - struct component final : component_interface + struct component final : generic_component { void post_load() override { diff --git a/src/client/component/auth.cpp b/src/client/component/auth.cpp index 8b226d29..19beb07c 100644 --- a/src/client/component/auth.cpp +++ b/src/client/component/auth.cpp @@ -107,7 +107,7 @@ namespace auth return guid; } - struct component final : client_component_interface + struct component final : client_component { void post_unpack() override { diff --git a/src/client/component/bots.cpp b/src/client/component/bots.cpp index ff6e41ae..bbc7d556 100644 --- a/src/client/component/bots.cpp +++ b/src/client/component/bots.cpp @@ -41,7 +41,7 @@ namespace bots } } - struct component final : client_component_interface + struct component final : client_component { void post_unpack() override { diff --git a/src/client/component/branding.cpp b/src/client/component/branding.cpp index a57edad4..c638a5d5 100644 --- a/src/client/component/branding.cpp +++ b/src/client/component/branding.cpp @@ -27,7 +27,7 @@ namespace branding } } - struct component final : client_component_interface + struct component final : client_component { void post_unpack() override { diff --git a/src/client/component/colors.cpp b/src/client/component/colors.cpp index 79913e96..8d5b23bb 100644 --- a/src/client/component/colors.cpp +++ b/src/client/component/colors.cpp @@ -30,7 +30,7 @@ namespace colors utils::hook::copy(g_color_table + index * 4, color_float, sizeof(color_float)); } - struct component final : client_component_interface + struct component final : client_component { void post_unpack() override { diff --git a/src/client/component/command.cpp b/src/client/component/command.cpp index aa01ae5b..7c0b31d4 100644 --- a/src/client/component/command.cpp +++ b/src/client/component/command.cpp @@ -46,7 +46,7 @@ namespace command } } - struct component final : client_component_interface + struct component final : client_component { void post_unpack() override { diff --git a/src/client/component/console.cpp b/src/client/component/console.cpp index 18ff80f1..df31d086 100644 --- a/src/client/component/console.cpp +++ b/src/client/component/console.cpp @@ -193,7 +193,7 @@ namespace console } } - struct component final : client_component_interface + struct component final : client_component { void post_unpack() override { diff --git a/src/client/component/dedicated.cpp b/src/client/component/dedicated.cpp index 70431910..2650c416 100644 --- a/src/client/component/dedicated.cpp +++ b/src/client/component/dedicated.cpp @@ -9,7 +9,7 @@ namespace dedicated { } - struct component final : server_component_interface + struct component final : server_component { void post_unpack() override { diff --git a/src/client/component/demonware.cpp b/src/client/component/demonware.cpp index c9e9d622..f50ccc15 100644 --- a/src/client/component/demonware.cpp +++ b/src/client/component/demonware.cpp @@ -441,7 +441,7 @@ namespace demonware } } - struct component final : component_interface + struct component final : generic_component { component() { diff --git a/src/client/component/discord.cpp b/src/client/component/discord.cpp index c288683a..421fe889 100644 --- a/src/client/component/discord.cpp +++ b/src/client/component/discord.cpp @@ -32,7 +32,7 @@ namespace discord } } - class component final : public client_component_interface + class component final : public client_component { public: void post_load() override diff --git a/src/client/component/exception.cpp b/src/client/component/exception.cpp index 1dae9fad..98c4e7f9 100644 --- a/src/client/component/exception.cpp +++ b/src/client/component/exception.cpp @@ -193,7 +193,7 @@ namespace exception } } - struct component final : component_interface + struct component final : generic_component { component() { diff --git a/src/client/component/icon.cpp b/src/client/component/icon.cpp index 8416a3c3..b9d4f669 100644 --- a/src/client/component/icon.cpp +++ b/src/client/component/icon.cpp @@ -29,7 +29,7 @@ namespace icon } } - struct component final : component_interface + struct component final : generic_component { void post_load() override { diff --git a/src/client/component/loot.cpp b/src/client/component/loot.cpp index 5c96fbdb..ee1fcbb3 100644 --- a/src/client/component/loot.cpp +++ b/src/client/component/loot.cpp @@ -49,7 +49,7 @@ namespace loot } }; - struct component final : client_component_interface + struct component final : client_component { void post_unpack() override { diff --git a/src/client/component/network.cpp b/src/client/component/network.cpp index 27f6880f..d89b6954 100644 --- a/src/client/component/network.cpp +++ b/src/client/component/network.cpp @@ -210,7 +210,7 @@ namespace network return 2; } - struct component final : client_component_interface + struct component final : client_component { void post_unpack() override { diff --git a/src/client/component/party.cpp b/src/client/component/party.cpp index 4134a952..6fa0ee0c 100644 --- a/src/client/component/party.cpp +++ b/src/client/component/party.cpp @@ -217,7 +217,7 @@ namespace party network::send(host, "getInfo", challenge); } - struct component final : client_component_interface + struct component final : client_component { void post_unpack() override { diff --git a/src/client/component/scheduler.cpp b/src/client/component/scheduler.cpp index 4df10dce..f23e25b6 100644 --- a/src/client/component/scheduler.cpp +++ b/src/client/component/scheduler.cpp @@ -149,7 +149,7 @@ namespace scheduler }, type, delay); } - struct component final : component_interface + struct component final : generic_component { void post_load() override { diff --git a/src/client/component/splash.cpp b/src/client/component/splash.cpp index bdf70d4c..d2010e80 100644 --- a/src/client/component/splash.cpp +++ b/src/client/component/splash.cpp @@ -165,7 +165,7 @@ namespace splash } } - struct component final : client_component_interface + struct component final : client_component { component() { diff --git a/src/client/component/steam_proxy.cpp b/src/client/component/steam_proxy.cpp index cad0ec65..c196feff 100644 --- a/src/client/component/steam_proxy.cpp +++ b/src/client/component/steam_proxy.cpp @@ -205,7 +205,7 @@ namespace steam_proxy } } - struct component final : component_interface + struct component final : generic_component { void post_load() override { diff --git a/src/client/component/updater.cpp b/src/client/component/updater.cpp index 8c0d7eec..c58117a2 100644 --- a/src/client/component/updater.cpp +++ b/src/client/component/updater.cpp @@ -127,7 +127,7 @@ namespace updater } } - class component final : public component_interface + class component final : public generic_component { public: component() diff --git a/src/client/game/game.cpp b/src/client/game/game.cpp index 3b2f27e0..052af5e0 100644 --- a/src/client/game/game.cpp +++ b/src/client/game/game.cpp @@ -9,7 +9,7 @@ namespace game { const utils::nt::library& get_host_library() { - static auto host = [] + static auto host_library = [] { utils::nt::library host{}; if (!host || host == utils::nt::library::get_by_address(get_base)) @@ -19,7 +19,8 @@ namespace game return host; }(); - return host; + + return host_library; } } diff --git a/src/client/loader/component_interface.hpp b/src/client/loader/component_interface.hpp index 69e0e31e..a17a0c73 100644 --- a/src/client/loader/component_interface.hpp +++ b/src/client/loader/component_interface.hpp @@ -17,11 +17,11 @@ enum class component_type any, }; -struct component_interface +struct generic_component { static constexpr component_type type = component_type::any; - virtual ~component_interface() = default; + virtual ~generic_component() = default; virtual void post_load() { @@ -41,12 +41,12 @@ struct component_interface } }; -struct client_component_interface : component_interface +struct client_component : generic_component { static constexpr component_type type = component_type::client; }; -struct server_component_interface : component_interface +struct server_component : generic_component { static constexpr component_type type = component_type::server; }; diff --git a/src/client/loader/component_loader.cpp b/src/client/loader/component_loader.cpp index e3395f60..3b1471ef 100644 --- a/src/client/loader/component_loader.cpp +++ b/src/client/loader/component_loader.cpp @@ -7,9 +7,9 @@ namespace component_loader { namespace { - std::vector>& get_components() + std::vector>& get_components() { - using component_vector = std::vector>; + using component_vector = std::vector>; using component_vector_container = std::unique_ptr> ; @@ -29,13 +29,13 @@ namespace component_loader return functors; } - void activate_component(std::unique_ptr component) + void activate_component(std::unique_ptr component) { auto& components = get_components(); components.push_back(std::move(component)); - std::ranges::stable_sort(components, [](const std::unique_ptr& a, - const std::unique_ptr& b) + std::ranges::stable_sort(components, [](const std::unique_ptr& a, + const std::unique_ptr& b) { return a->priority() > b->priority(); }); diff --git a/src/client/loader/component_loader.hpp b/src/client/loader/component_loader.hpp index 8d0a4ac4..d20d2293 100644 --- a/src/client/loader/component_loader.hpp +++ b/src/client/loader/component_loader.hpp @@ -3,7 +3,7 @@ namespace component_loader { - using registration_functor = std::function()>; + using registration_functor = std::function()>; void register_component(registration_functor functor, component_type type); @@ -25,7 +25,7 @@ namespace component_loader template class installer final { - static_assert(std::is_base_of_v, "component has invalid base class"); + static_assert(std::is_base_of_v, "component has invalid base class"); public: installer()