From d6965d392e39405d625babe627c3114a7ed31219 Mon Sep 17 00:00:00 2001 From: superp00t Date: Wed, 16 Aug 2023 18:18:01 -0400 Subject: [PATCH] fix(console): replace definitions --- src/console/Command.cpp | 14 +++++--------- src/console/Command.hpp | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/console/Command.cpp b/src/console/Command.cpp index 42b5478..0f6e8cb 100644 --- a/src/console/Command.cpp +++ b/src/console/Command.cpp @@ -85,19 +85,15 @@ void AddToHistory(const char* command) { } uint32_t ConsoleCommandHistoryDepth() { - return HISTORY_DEPTH; -} - -void ConsoleCommandInitialize() { - ConsoleCommandRegister("help", ConsoleCommand_Help, CONSOLE, "Provides help information about a command."); + return CONSOLE_HISTORY_DEPTH; } int32_t ConsoleCommandRegister(const char* command, COMMANDHANDLER handler, CATEGORY category, const char* helpText) { STORM_ASSERT(command); STORM_ASSERT(handler); - if (SStrLen(command) > (MAX_CMD_LENGTH - 1) || g_consoleCommandHash.Ptr(command)) { - // The command name exceeds MAX_CMD_LENGTH, minus the null terminator + if (SStrLen(command) > (CONSOLE_MAX_CMD_LENGTH - 1) || g_consoleCommandHash.Ptr(command)) { + // The command name exceeds CONSOLE_MAX_CMD_LENGTH, minus the null terminator // or it has already been registered return 0; } @@ -216,9 +212,9 @@ void ConsoleCommandExecute(char* commandLine, int32_t addToHistory) { } const char* command = nullptr; - auto arguments = reinterpret_cast(SMemAlloc(CMD_BUFFER_SIZE, __FILE__, __LINE__, 0)); + auto arguments = reinterpret_cast(SMemAlloc(CONSOLE_CMD_BUFFER_SIZE, __FILE__, __LINE__, 0)); - auto cmd = ParseCommand(commandLine, &command, arguments, CMD_BUFFER_SIZE); + auto cmd = ParseCommand(commandLine, &command, arguments, CONSOLE_CMD_BUFFER_SIZE); if (cmd) { cmd->m_handler(command, arguments); diff --git a/src/console/Command.hpp b/src/console/Command.hpp index b9e3e12..d902e82 100644 --- a/src/console/Command.hpp +++ b/src/console/Command.hpp @@ -6,7 +6,7 @@ #include #include -#define CONSOLE_REGISTER_LIST(category, list) RegisterConsoleCommandList(category, list, std::size(list)) +#define CONSOLE_REGISTER_LIST(category, list) RegisterConsoleCommandList(category, list, sizeof(list) / sizeof(ConsoleCommandList)) #define CONSOLE_EXEC_BUFFER_SIZE 8192 #define CONSOLE_CMD_BUFFER_SIZE 1024