fix(console): replace definitions

This commit is contained in:
phaneron 2023-08-16 18:18:01 -04:00
parent 47e8d94842
commit d6965d392e
2 changed files with 6 additions and 10 deletions

View file

@ -85,19 +85,15 @@ void AddToHistory(const char* command) {
} }
uint32_t ConsoleCommandHistoryDepth() { uint32_t ConsoleCommandHistoryDepth() {
return HISTORY_DEPTH; return CONSOLE_HISTORY_DEPTH;
}
void ConsoleCommandInitialize() {
ConsoleCommandRegister("help", ConsoleCommand_Help, CONSOLE, "Provides help information about a command.");
} }
int32_t ConsoleCommandRegister(const char* command, COMMANDHANDLER handler, CATEGORY category, const char* helpText) { int32_t ConsoleCommandRegister(const char* command, COMMANDHANDLER handler, CATEGORY category, const char* helpText) {
STORM_ASSERT(command); STORM_ASSERT(command);
STORM_ASSERT(handler); STORM_ASSERT(handler);
if (SStrLen(command) > (MAX_CMD_LENGTH - 1) || g_consoleCommandHash.Ptr(command)) { if (SStrLen(command) > (CONSOLE_MAX_CMD_LENGTH - 1) || g_consoleCommandHash.Ptr(command)) {
// The command name exceeds MAX_CMD_LENGTH, minus the null terminator // The command name exceeds CONSOLE_MAX_CMD_LENGTH, minus the null terminator
// or it has already been registered // or it has already been registered
return 0; return 0;
} }
@ -216,9 +212,9 @@ void ConsoleCommandExecute(char* commandLine, int32_t addToHistory) {
} }
const char* command = nullptr; const char* command = nullptr;
auto arguments = reinterpret_cast<char*>(SMemAlloc(CMD_BUFFER_SIZE, __FILE__, __LINE__, 0)); auto arguments = reinterpret_cast<char*>(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) { if (cmd) {
cmd->m_handler(command, arguments); cmd->m_handler(command, arguments);

View file

@ -6,7 +6,7 @@
#include <storm/Hash.hpp> #include <storm/Hash.hpp>
#include <cstdint> #include <cstdint>
#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_EXEC_BUFFER_SIZE 8192
#define CONSOLE_CMD_BUFFER_SIZE 1024 #define CONSOLE_CMD_BUFFER_SIZE 1024