Elaztek Developer Hub
Blamite Game Engine - blam!  00406.12.10.23.1457.blamite
The core library for the Blamite Game Engine.
console.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <map>
5 #include <vector>
6 #include <Strings/components/diagnostics/errors/errors.h>
7 
8 #ifndef BLAM
9 #define BLAM
10 #endif
11 
15 enum class BlamCommandType
16 {
17  Builtin,
18  Script,
19  Other
20 };
21 
32 {
33  std::string name;
34  std::string description;
35  std::string syntax;
36  std::vector<std::string> aliases;
37 
39 
47  virtual BlamResult Execute(std::vector<std::string> arguments) { return BlamResult::Success_OK; };
48 };
49 
54 {
62  BLAM std::string RegisterCommand(BlamConsoleCommand* command);
63 
71  BLAM void UnregisterCommand(std::string name);
72 
80  BLAM BlamConsoleCommand* GetCommand(std::string name);
81 
89  BLAM BlamResult RunCommandLine(std::string command_line);
90 
99  BLAM std::map<std::string, BlamConsoleCommand*> GetCommandList();
100 
105 
109  BLAM void Cleanup();
110 
114  BLAM void RunInitCommands();
115 }
command_list
std::map< std::string, BlamConsoleCommand * > command_list
The list of all loaded console commands.
Definition: console.cpp:47
Blam::Resources::Console::VersionCommand
Class for the version command.
Definition: version.hpp:18
Blam::Resources::Console::UnregisterCommand
BLAM void UnregisterCommand(std::string name)
Unregisters the console command with the specified name.
Definition: console.cpp:223
Blam::Resources::Console::RegisterBuiltinCommands
BLAM void RegisterBuiltinCommands()
Registers all hard-coded engine commands.
Definition: console.cpp:361
Blam::Resources::Console::HistoryCommand
Class for the history command.
Definition: history.hpp:13
BlamCommandType::Builtin
@ Builtin
A command that is hard-coded into the engine.
abort.hpp
BlamGlobalUpdateResult::OutOfBounds
@ OutOfBounds
The provided value was too small or too large for the globals' data type.
drop.hpp
Blam::Logger::LogEvent
BLAM void LogEvent(std::string message)
Logs a message to the log and/or console.
Definition: aliases.cpp:130
Blam::Resources::Console::NoUCommand
Class for the nou command.
Definition: nou.hpp:13
script_doc.hpp
BlamConsoleCommand::description
std::string description
An optional description of the command. Shown when using the classify command.
Definition: console.h:34
Blam::Resources::Console::ScreenshotCommand
Class for the screenshot command.
Definition: screenshot.hpp:13
Blam::Globals::UpdateGlobal
BLAM BlamGlobalUpdateResult UpdateGlobal(std::string name, std::string new_value)
Updates the value of a String global.
Definition: globals.cpp:574
Blam::Resources::Console::Win32DialogTestCommand
Class for the win32_dialog_test command.
Definition: win32_dialog_test.hpp:14
BlamEngineGlobal::name
std::string name
The name of the global.
Definition: globals.h:57
BlamGlobalUpdateResult::UnknownGlobal
@ UnknownGlobal
The specified global does not exist.
BlamConsoleCommand
Class used to represent a console command.
Definition: console.h:31
Blam::Resources::Console::ClearScreenCommand
Class for the cls command.
Definition: cls.hpp:16
Blam::Resources::Console::ListenerBugCheckCommand
Class for the listener_bug_check command.
Definition: listener_bug_check.hpp:17
BlamCommandType::Other
@ Other
Currently unused.
BlamGlobalUpdateResult::Ok
@ Ok
The global was updated successfully.
engine_text.h
Blam::Resources::Console::CrashCommand
Class for the crash command.
Definition: crash.hpp:14
version.hpp
open_web_url.hpp
console.h
screenshot.hpp
Blam::Resources::Console::Halo2PrintCommand
Class for the h2print command.
Definition: h2print.hpp:17
Blam::Resources::Console::ShowStatsCommand
Class for the show_stats command.
Definition: show_stats.hpp:16
nou.hpp
Blam::Resources::Console::GetCommand
BLAM BlamConsoleCommand * GetCommand(std::string name)
Retrieves a command with the specified name.
Definition: console.cpp:233
Blam::Resources::Console::ClassifyCommand
Class for the classify command.
Definition: classify.hpp:13
Blam::Resources::Console::Halo2HelpCommand
Class for the h2help command.
Definition: h2help.hpp:18
Blam::Resources::Console::ToggleImguiWindowCommand
Class for the toggle_imgui_window command.
Definition: toggle_imgui_window.hpp:12
BlamConsoleCommand::Execute
virtual BlamResult Execute(std::vector< std::string > arguments)
Called upon command execution.
Definition: console.h:47
BlamGlobalUpdateResult::InvalidArgs
@ InvalidArgs
The provided arguments were invalid.
Blam::Resources::Console::QuitCommand
Class for the quit command.
Definition: quit.hpp:13
BlamEngineGlobal::type
BlamGlobalType type
The type of the global.
Definition: globals.h:56
classify.hpp
Blam::Resources::Console::TagLoadForceCommand
Class for the tag_load_force command.
Definition: tag_load_force.hpp:17
Blam::Resources::Console::DropCommand
Class for the drop command.
Definition: drop.hpp:14
Blam::Resources::Console::RunInitCommands
BLAM void RunInitCommands()
Attempts to read init.txt and runs any commands added to it.
Definition: console.cpp:398
listener_bug_check.hpp
h2print.hpp
ENGINE_CFG
#define ENGINE_CFG
Macro to allow quicker access to the main configuration file.
Definition: config.h:20
show_stats.hpp
String
@ String
Represents a std::string.
Definition: globals.h:39
Blam::Resources::Console::ExploreCommand
Class for the explore command.
Definition: explore.hpp:18
Blam::Resources::Console::AbortCommand
Class for the abort command.
Definition: abort.hpp:12
Blam::Resources::Console::TagFieldSizesCommand
Class for the tag_field_sizes command.
Definition: tag_field_sizes.hpp:15
Blam::Resources::Console::RegenDebugMenuCommand
Class for the debug_menu_rebuild command.
Definition: debug_menu_rebuild.hpp:16
generate_plugins.hpp
explore.hpp
BLAM
#define BLAM
Definition: console.h:9
Blam::Resources::Console::GeneratePluginsCommand
Class for the generate_plugins command.
Definition: generate_plugins.hpp:14
console_update_global
void console_update_global(std::string global_name, std::vector< std::string > arguments)
Function to handle updating an engine global from the console.
Definition: console.cpp:175
BlamEngineGlobal
Structure containing data for a game engine global.
Definition: globals.h:54
Blam::Settings::Paths::ParseFolderPlaceholders
BLAM std::string ParseFolderPlaceholders(std::string string)
Parses any engine/user data folder placeholders within a string.
Definition: paths.cpp:382
BlamConsoleCommand::name
std::string name
The name of the console command.
Definition: console.h:33
map_name.hpp
BlamGlobalUpdateResult
BlamGlobalUpdateResult
Enumerator for the result of a global update attempt.
Definition: globals.h:19
Blam::Resources::Console::MapNameCommand
Class for the map_name command.
Definition: map_name.hpp:18
it
ARPHIC PUBLIC LICENSE Ltd Yung Chi Taiwan All rights reserved except as specified below Everyone is permitted to copy and distribute verbatim copies of this license but changing it is forbidden Preamble The licenses for most software are designed to take away your freedom to share and change it By the ARPHIC PUBLIC LICENSE specifically permits and encourages you to use this provided that you give the recipients all the rights that we gave you and make sure they can get the modifications of this software Legal Terms Font means the TrueType fonts AR PL Mingti2L AR PL KaitiM AR PL KaitiM and the derivatives of those fonts created through any modification including modifying reordering converting changing font or adding deleting some characters in from glyph table PL means Public License Copyright Holder means whoever is named in the copyright or copyrights for the Font You means the or person redistributing or modifying the Font Freely Available means that you have the freedom to copy or modify the Font as well as redistribute copies of the Font under the same conditions you not price If you you can charge for this service Copying &Distribution You may copy and distribute verbatim copies of this Font in any without provided that you retain this license including modifying reordering converting changing font or adding deleting some characters in from glyph and copy and distribute such modifications under the terms of Section provided that the following conditions are such as by offering access to copy the modifications from a designated or distributing the modifications on a medium customarily used for software interchange c If the modified fonts normally reads commands interactively when you must cause it
Definition: ARPHICPL.TXT:36
Blam::Resources::Console::ListColorsCommand
Class for the list_colors command.
Definition: list_colors.hpp:15
cls.hpp
BlamGlobalUpdateResult::InvalidType
@ InvalidType
The provided value was of an invalid type.
Blam::Resources::Console::GetCommandList
BLAM std::map< std::string, BlamConsoleCommand * > GetCommandList()
Retrieves the list of all loaded console commands.
Definition: console.cpp:228
Blam::Globals::GetGlobalTypeLabel
BLAM std::string GetGlobalTypeLabel(BlamGlobalType type)
Retrieves a string representation of a global's type, for use in UI.
Definition: globals.cpp:40
Blam::Globals::GetGlobal
BLAM BlamEngineGlobal * GetGlobal(std::string name)
Retrieves a global with the specified ID.
Definition: globals.cpp:189
Blam::Resources::Console::RunCommandLine
BLAM BlamResult RunCommandLine(std::string command_line)
Executed the provided string as a console command.
Definition: console.cpp:260
Blam::Resources::Console::ScriptDocCommand
Class for the script_doc command.
Definition: script_doc.hpp:14
reload_material_datablocks.hpp
toggle_imgui_window.hpp
Blam::Resources::Console::SentryTestCommand
A command to test Sentry functionality.
Definition: sentry_test.hpp:12
Blam::Resources::Console::ListLevelsCommand
Class for the list_levels command.
Definition: list_levels.hpp:17
Blam::Resources::Console::PrintCommand
Class for the print command.
Definition: print.hpp:18
BlamConsoleCommand::syntax
std::string syntax
The syntax information for the command. Shown to the user when using the help command with an argumen...
Definition: console.h:35
BlamConsoleCommand::type
BlamCommandType type
The type of command this is. See #Blam::Resources::Console::BlamCommandType for more information.
Definition: console.h:38
list_levels.hpp
BlamCommandType::Script
@ Script
A command that originates from a BlamScript.
ENGINE_TEXT
#define ENGINE_TEXT(string_id)
Definition: engine_text.h:7
win32_dialog_test.hpp
open_game_dir.hpp
list_colors.hpp
resolution.hpp
help.hpp
Blam::Logger::LogEventForce
BLAM void LogEventForce(std::string message)
Forcibly logs a message to the log and/or console.
Definition: aliases.cpp:262
Blam::Resources::Console::ResolutionCommand
Class for the screenres command.
Definition: resolution.hpp:14
history.hpp
quit.hpp
BlamGlobalUpdateResult::GlobalIsProtected
@ GlobalIsProtected
The specified global is protected and cannot be modified during runtime.
BlamCommandType
BlamCommandType
Used to indicate the type of command.
Definition: console.h:15
display_global_update_message
void display_global_update_message(BlamGlobalUpdateResult error_code, BlamEngineGlobal *global)
Displays an error message to inform the user why a global variable failed to update.
Definition: console.cpp:99
BlamConsoleCommand::aliases
std::vector< std::string > aliases
A list of aliases for the command. Executing any of these instead of the command name will behave the...
Definition: console.h:36
crash.hpp
Blam::Resources::Console::ReloadMaterialDatablocksCommand
Class for the cls command.
Definition: reload_material_datablocks.hpp:17
DisplayCommandError
void DisplayCommandError(BlamResult error_code, BlamConsoleCommand *command)
Displays an error message to inform the user why a command failed to run.
Definition: console.cpp:55
Blam::Globals::UpdateGlobalWrap
BLAM BlamGlobalUpdateResult UpdateGlobalWrap(std::string name, std::string new_value)
Updates a global's raw value.
Definition: globals.cpp:431
print.hpp
sentry_test.hpp
debug_menu_rebuild.hpp
Blam::Resources::Console::CreateCommandObjectCommand
Class for the create_cmd_obj command.
Definition: create_cmd_obj.hpp:17
h2help.hpp
tag_field_sizes.hpp
tag_load_force.hpp
create_cmd_obj.hpp
Blam::Resources::Console::OpenWebURLCommand
Class for the open_web_url command.
Definition: open_web_url.hpp:14
Blam::Resources::Console
Namespace for things relating to the debug console.
Definition: abort.hpp:5
Blam::Resources::Console::Cleanup
BLAM void Cleanup()
Cleans up all console command data.
Definition: console.cpp:351
BlamEngineGlobal::value_raw
std::string value_raw
The raw value of the global as a string.
Definition: globals.h:59
Blam::Resources::Console::HelpCommand
Class for the help command.
Definition: help.hpp:16
name
ARPHIC PUBLIC LICENSE Ltd Yung Chi Taiwan All rights reserved except as specified below Everyone is permitted to copy and distribute verbatim copies of this license but changing it is forbidden Preamble The licenses for most software are designed to take away your freedom to share and change it By the ARPHIC PUBLIC LICENSE specifically permits and encourages you to use this provided that you give the recipients all the rights that we gave you and make sure they can get the modifications of this software Legal Terms Font means the TrueType fonts AR PL Mingti2L AR PL KaitiM AR PL KaitiM and the derivatives of those fonts created through any modification including modifying reordering converting changing font name
Definition: ARPHICPL.TXT:16
Blam::Resources::Console::OpenGameDirectoryCommand
Class for the open_game_dir command.
Definition: open_game_dir.hpp:13
Blam::Resources::Console::RegisterCommand
BLAM std::string RegisterCommand(BlamConsoleCommand *command)
Register a new command object.
Definition: console.cpp:216