From 122f84f14d6177cc4c78b817ab71712185e0b47f Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Tue, 20 Sep 2022 10:57:57 +0100 Subject: Standardise concommand func naming in C++ (#277) part of refactor --- NorthstarDLL/bansystem.cpp | 12 ++++++------ NorthstarDLL/modmanager.cpp | 4 ++-- NorthstarDLL/playlist.cpp | 8 ++++---- NorthstarDLL/serverauthentication.cpp | 5 +++-- 4 files changed, 15 insertions(+), 14 deletions(-) (limited to 'NorthstarDLL') diff --git a/NorthstarDLL/bansystem.cpp b/NorthstarDLL/bansystem.cpp index df98464e..c15cf115 100644 --- a/NorthstarDLL/bansystem.cpp +++ b/NorthstarDLL/bansystem.cpp @@ -177,7 +177,7 @@ bool ServerBanSystem::IsUIDAllowed(uint64_t uid) return std::find(m_vBannedUids.begin(), m_vBannedUids.end(), uid) == m_vBannedUids.end(); } -void BanPlayerCommand(const CCommand& args) +void ConCommand_ban(const CCommand& args) { if (args.ArgC() < 2) return; @@ -196,7 +196,7 @@ void BanPlayerCommand(const CCommand& args) } } -void UnbanPlayerCommand(const CCommand& args) +void ConCommand_unban(const CCommand& args) { if (args.ArgC() < 2) return; @@ -205,7 +205,7 @@ void UnbanPlayerCommand(const CCommand& args) g_ServerBanSystem->UnbanUID(strtoull(args.Arg(1), nullptr, 10)); } -void ClearBanlistCommand(const CCommand& args) +void ConCommand_clearbanlist(const CCommand& args) { g_ServerBanSystem->ClearBanlist(); } @@ -215,7 +215,7 @@ void InitialiseBanSystem(HMODULE baseAddress) g_ServerBanSystem = new ServerBanSystem; g_ServerBanSystem->OpenBanlist(); - RegisterConCommand("ban", BanPlayerCommand, "bans a given player by uid or name", FCVAR_GAMEDLL); - RegisterConCommand("unban", UnbanPlayerCommand, "unbans a given player by uid", FCVAR_NONE); - RegisterConCommand("clearbanlist", ClearBanlistCommand, "clears all uids on the banlist", FCVAR_NONE); + RegisterConCommand("ban", ConCommand_ban, "bans a given player by uid or name", FCVAR_GAMEDLL); + RegisterConCommand("unban", ConCommand_unban, "unbans a given player by uid", FCVAR_NONE); + RegisterConCommand("clearbanlist", ConCommand_clearbanlist, "clears all uids on the banlist", FCVAR_NONE); } diff --git a/NorthstarDLL/modmanager.cpp b/NorthstarDLL/modmanager.cpp index 41391e11..2223109f 100644 --- a/NorthstarDLL/modmanager.cpp +++ b/NorthstarDLL/modmanager.cpp @@ -606,7 +606,7 @@ void ModManager::CompileAssetsForFile(const char* filename) } } -void ReloadModsCommand(const CCommand& args) +void ConCommand_reload_mods(const CCommand& args) { g_ModManager->LoadMods(); } @@ -615,7 +615,7 @@ void InitialiseModManager(HMODULE baseAddress) { g_ModManager = new ModManager; - RegisterConCommand("reload_mods", ReloadModsCommand, "idk", FCVAR_NONE); + RegisterConCommand("reload_mods", ConCommand_reload_mods, "reloads mods", FCVAR_NONE); } fs::path GetModFolderPath() diff --git a/NorthstarDLL/playlist.cpp b/NorthstarDLL/playlist.cpp index 21374607..f3e17a32 100644 --- a/NorthstarDLL/playlist.cpp +++ b/NorthstarDLL/playlist.cpp @@ -19,7 +19,7 @@ GetCurrentPlaylistVarType GetCurrentPlaylistVarOriginal; ConVar* Cvar_ns_use_clc_SetPlaylistVarOverride; -void SetPlaylistCommand(const CCommand& args) +void ConCommand_playlist(const CCommand& args) { if (args.ArgC() < 2) return; @@ -27,7 +27,7 @@ void SetPlaylistCommand(const CCommand& args) SetCurrentPlaylist(args.Arg(1)); } -void SetPlaylistVarOverrideCommand(const CCommand& args) +void ConCommand_setplaylistvaroverride(const CCommand& args) { if (args.ArgC() < 3) return; @@ -74,8 +74,8 @@ int GetCurrentGamemodeMaxPlayersHook() void InitialisePlaylistHooks(HMODULE baseAddress) { - RegisterConCommand("setplaylist", SetPlaylistCommand, "Sets the current playlist", FCVAR_NONE); - RegisterConCommand("setplaylistvaroverrides", SetPlaylistVarOverrideCommand, "sets a playlist var override", FCVAR_NONE); + RegisterConCommand("setplaylist", ConCommand_playlist, "Sets the current playlist", FCVAR_NONE); + RegisterConCommand("setplaylistvaroverrides", ConCommand_setplaylistvaroverride, "sets a playlist var override", FCVAR_NONE); // note: clc_SetPlaylistVarOverride is pretty insecure, since it allows for entirely arbitrary playlist var overrides to be sent to the // server this is somewhat restricted on custom servers to prevent it being done outside of private matches, but ideally it should be // disabled altogether, since the custom menus won't use it anyway this should only really be accepted if you want vanilla client diff --git a/NorthstarDLL/serverauthentication.cpp b/NorthstarDLL/serverauthentication.cpp index bff19197..af170766 100644 --- a/NorthstarDLL/serverauthentication.cpp +++ b/NorthstarDLL/serverauthentication.cpp @@ -642,7 +642,7 @@ bool ProcessConnectionlessPacketHook(void* a1, netpacket_t* packet) return ProcessConnectionlessPacket(a1, packet); } -void ResetPdataCommand(const CCommand& args) +void ConCommand_ns_resetpersistence(const CCommand& args) { if (*sv_m_State == server_state_t::ss_active) { @@ -689,7 +689,8 @@ void InitialiseServerAuthentication(HMODULE baseAddress) Cvar_net_datablock_enabled = g_pCVar->FindVar("net_datablock_enabled"); - RegisterConCommand("ns_resetpersistence", ResetPdataCommand, "resets your pdata when you next enter the lobby", FCVAR_NONE); + RegisterConCommand( + "ns_resetpersistence", ConCommand_ns_resetpersistence, "resets your pdata when you next enter the lobby", FCVAR_NONE); HookEnabler hook; ENABLER_CREATEHOOK( -- cgit v1.2.3