aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/util
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDLL/util')
-rw-r--r--NorthstarDLL/util/printcommands.cpp24
-rw-r--r--NorthstarDLL/util/printmaps.cpp10
-rw-r--r--NorthstarDLL/util/utils.cpp2
-rw-r--r--NorthstarDLL/util/utils.h5
4 files changed, 19 insertions, 22 deletions
diff --git a/NorthstarDLL/util/printcommands.cpp b/NorthstarDLL/util/printcommands.cpp
index 7c915318..34d56666 100644
--- a/NorthstarDLL/util/printcommands.cpp
+++ b/NorthstarDLL/util/printcommands.cpp
@@ -12,7 +12,7 @@ void PrintCommandHelpDialogue(const ConCommandBase* command, const char* name)
}
// temp because command->IsCommand does not currently work
- ConVar* cvar = R2::g_pCVar->FindVar(command->m_pszName);
+ ConVar* cvar = g_pCVar->FindVar(command->m_pszName);
// build string for flags if not FCVAR_NONE
std::string flagString;
@@ -66,7 +66,7 @@ void TryPrintCvarHelpForCommand(const char* pCommand)
}
// check if we're inputting a cvar, but not setting it at all
- ConVar* cvar = R2::g_pCVar->FindVar(pCvarStr);
+ ConVar* cvar = g_pCVar->FindVar(pCvarStr);
if (cvar)
PrintCommandHelpDialogue(&cvar->m_ConCommandBase, pCvarStr);
@@ -81,7 +81,7 @@ void ConCommand_help(const CCommand& arg)
return;
}
- PrintCommandHelpDialogue(R2::g_pCVar->FindCommandBase(arg.Arg(1)), arg.Arg(1));
+ PrintCommandHelpDialogue(g_pCVar->FindCommandBase(arg.Arg(1)), arg.Arg(1));
}
void ConCommand_find(const CCommand& arg)
@@ -96,7 +96,7 @@ void ConCommand_find(const CCommand& arg)
char pTempSearchTerm[256];
ConCommandBase* var;
- CCVarIteratorInternal* itint = R2::g_pCVar->FactoryInternalIterator();
+ CCVarIteratorInternal* itint = g_pCVar->FactoryInternalIterator();
std::map<std::string, ConCommandBase*> sorted;
for (itint->SetFirst(); itint->IsValid(); itint->Next())
{
@@ -165,7 +165,7 @@ void ConCommand_findflags(const CCommand& arg)
}
ConCommandBase* var;
- CCVarIteratorInternal* itint = R2::g_pCVar->FactoryInternalIterator();
+ CCVarIteratorInternal* itint = g_pCVar->FactoryInternalIterator();
std::map<std::string, ConCommandBase*> sorted;
for (itint->SetFirst(); itint->IsValid(); itint->Next())
{
@@ -189,7 +189,7 @@ void ConCommand_findflags(const CCommand& arg)
void ConCommand_list(const CCommand& arg)
{
ConCommandBase* var;
- CCVarIteratorInternal* itint = R2::g_pCVar->FactoryInternalIterator();
+ CCVarIteratorInternal* itint = g_pCVar->FactoryInternalIterator();
std::map<std::string, ConCommandBase*> sorted;
for (itint->SetFirst(); itint->IsValid(); itint->Next())
{
@@ -210,7 +210,7 @@ void ConCommand_list(const CCommand& arg)
void ConCommand_differences(const CCommand& arg)
{
- CCVarIteratorInternal* itint = R2::g_pCVar->FactoryInternalIterator();
+ CCVarIteratorInternal* itint = g_pCVar->FactoryInternalIterator();
std::map<std::string, ConCommandBase*> sorted;
for (itint->SetFirst(); itint->IsValid(); itint->Next())
@@ -225,7 +225,7 @@ void ConCommand_differences(const CCommand& arg)
for (auto& map : sorted)
{
- ConVar* cvar = R2::g_pCVar->FindVar(map.second->m_pszName);
+ ConVar* cvar = g_pCVar->FindVar(map.second->m_pszName);
if (!cvar)
{
@@ -267,19 +267,19 @@ void InitialiseCommandPrint()
// these commands already exist, so we need to modify the preexisting command to use our func instead
// and clear the flags also
- ConCommand* helpCommand = R2::g_pCVar->FindCommand("help");
+ ConCommand* helpCommand = g_pCVar->FindCommand("help");
helpCommand->m_nFlags = FCVAR_NONE;
helpCommand->m_pCommandCallback = ConCommand_help;
- ConCommand* findCommand = R2::g_pCVar->FindCommand("convar_findByFlags");
+ ConCommand* findCommand = g_pCVar->FindCommand("convar_findByFlags");
findCommand->m_nFlags = FCVAR_NONE;
findCommand->m_pCommandCallback = ConCommand_findflags;
- ConCommand* listCommand = R2::g_pCVar->FindCommand("convar_list");
+ ConCommand* listCommand = g_pCVar->FindCommand("convar_list");
listCommand->m_nFlags = FCVAR_NONE;
listCommand->m_pCommandCallback = ConCommand_list;
- ConCommand* diffCommand = R2::g_pCVar->FindCommand("convar_differences");
+ ConCommand* diffCommand = g_pCVar->FindCommand("convar_differences");
diffCommand->m_nFlags = FCVAR_NONE;
diffCommand->m_pCommandCallback = ConCommand_differences;
}
diff --git a/NorthstarDLL/util/printmaps.cpp b/NorthstarDLL/util/printmaps.cpp
index bf9f1dec..d3253605 100644
--- a/NorthstarDLL/util/printmaps.cpp
+++ b/NorthstarDLL/util/printmaps.cpp
@@ -42,10 +42,10 @@ void RefreshMapList()
// Only update the maps list every 10 seconds max to we avoid constantly reading fs
static double fLastRefresh = -999;
- if (fLastRefresh + 10.0 > R2::g_pGlobals->m_flRealTime)
+ if (fLastRefresh + 10.0 > g_pGlobals->m_flRealTime)
return;
- fLastRefresh = R2::g_pGlobals->m_flRealTime;
+ fLastRefresh = g_pGlobals->m_flRealTime;
// Rebuild map list
vMapList.clear();
@@ -110,7 +110,7 @@ void RefreshMapList()
}
// get maps in game dir
- std::string gameDir = fmt::format("{}/maps", R2::g_pModName);
+ std::string gameDir = fmt::format("{}/maps", g_pModName);
if (!std::filesystem::exists(gameDir))
{
return;
@@ -212,7 +212,7 @@ AUTOHOOK(Host_Map_f, engine.dll + 0x15B340, void, __fastcall, (const CCommand& a
return;
}
- if (*R2::g_pServerState >= R2::server_state_t::ss_active)
+ if (*g_pServerState >= server_state_t::ss_active)
return Host_Changelevel_f(args);
else
return Host_Map_helper(args, nullptr);
@@ -222,7 +222,7 @@ void InitialiseMapsPrint()
{
AUTOHOOK_DISPATCH()
- ConCommand* mapsCommand = R2::g_pCVar->FindCommand("maps");
+ ConCommand* mapsCommand = g_pCVar->FindCommand("maps");
mapsCommand->m_pCommandCallback = ConCommand_maps;
}
diff --git a/NorthstarDLL/util/utils.cpp b/NorthstarDLL/util/utils.cpp
index 2c9dc85a..c3f90cfa 100644
--- a/NorthstarDLL/util/utils.cpp
+++ b/NorthstarDLL/util/utils.cpp
@@ -20,7 +20,7 @@ bool skip_valid_ansi_csi_sgr(char*& str)
return true;
}
-void NS::Utils::RemoveAsciiControlSequences(char* str, bool allow_color_codes)
+void RemoveAsciiControlSequences(char* str, bool allow_color_codes)
{
for (char *pc = str, c = *pc; c = *pc; pc++)
{
diff --git a/NorthstarDLL/util/utils.h b/NorthstarDLL/util/utils.h
index 97b92f18..85922692 100644
--- a/NorthstarDLL/util/utils.h
+++ b/NorthstarDLL/util/utils.h
@@ -1,6 +1,3 @@
#pragma once
-namespace NS::Utils
-{
- void RemoveAsciiControlSequences(char* str, bool allow_color_codes);
-}
+void RemoveAsciiControlSequences(char* str, bool allow_color_codes);