 |
Blamite Game Engine - blam!
00272.10.26.20.0001.blamite
The core library for the Blamite Game Engine.
|
Go to the documentation of this file. 1 #include "../console.h"
3 #include <Strings/components/utils/io/io.h>
19 description =
"saves a file called hs_doc.txt with parameters for all script commands and globals.";
32 std::string doc_contents =
"";
36 doc_contents +=
"== Built-in Commands ==";
37 doc_contents +=
"\n\n\n\n";
40 std::map<std::string, Blam::Console::ConsoleCommand*>::iterator it;
42 for (it = commands.begin(); it != commands.end(); it++)
48 std::string syntax_line =
"(";
50 syntax_line += command->
name;
55 syntax_line += command->
syntax;
60 doc_contents += syntax_line;
64 if (command->
aliases.size() > 0)
66 doc_contents +=
"\n\n";
68 std::string aliases_line =
"aliases: [";
70 for (
int i = 0; i < command->
aliases.size(); i++)
72 std::string alias = command->
aliases.at(i);
74 aliases_line += alias;
76 if (i != command->
aliases.size() - 1)
84 doc_contents += aliases_line;
90 doc_contents +=
"\n\n";
95 doc_contents +=
"\n\n\n\n";
101 doc_contents +=
"== Commands ==";
102 doc_contents +=
"\n\n\n\n";
111 doc_contents +=
"== Script Globals ==";
112 doc_contents +=
"\n\n\n\n";
115 std::map<std::string, EngineGlobal>::iterator it;
121 std::string global_line =
"(" + it->second.name +
" <" +
GetGvarTypeLabel(it->second.type) +
">)";
123 if (it->second.read_only)
125 global_line +=
" [protected]";
128 doc_contents += global_line;
131 if (it->second.info !=
"")
133 doc_contents +=
"\n";
134 doc_contents += it->second.info;
137 doc_contents +=
"\n\n";
143 BlamStrings::Utils::IO::CreateNewFile(file_path, doc_contents);
145 WinExec(std::string(
"notepad " + file_path).c_str(), SW_SHOWDEFAULT);
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:75
BLAM std::map< std::string, ConsoleCommand * > GetCommandList()
Retrieves the list of all loaded console commands.
Definition: console.cpp:150
std::string description
An optional description of the command. Shown when using the classify command.
Definition: console.h:73
CommandType type
The type of command this is. See Blam::Console::CommandType for more information.
Definition: console.h:77
CommandStatus
Indicates the return state of a console command.
Definition: console.h:28
BLAM ConfigFile * GetConfig(std::string filename)
Retrieves the specified configuration file.
Definition: config.cpp:232
~ScriptDocCommand()
Definition: script_doc.hpp:25
Namespace containing things relating to game engine globals.
Definition: globals.h:193
CommandStatus onCommand(std::vector< std::string > arguments)
Called upon command execution.
Definition: script_doc.hpp:30
@ Builtin
A command that is hard-coded into the engine.
Definition: console.h:41
std::string name
The name of the console command.
Definition: console.h:70
std::map< std::string, EngineGlobal > globals
The list of loaded globals.
Definition: globals.cpp:20
BLAM std::map< std::string, EngineGlobal > * GetGlobalsList()
Retrieves the list of loaded globals.
Definition: globals.cpp:22
Namespace for things relating to the debug console.
Definition: abort.hpp:5
Class used to represent a console command.
Definition: console.h:50
#define CMD_OK
Macro for OK command status. See Blam::Console::Ok for more details.
Definition: console.h:9
Class for the script_doc command.
Definition: script_doc.hpp:13
BLAM std::string GetGvarTypeLabel(GvarType type)
Retrieves a string representation of a global's type, for use in UI.
Definition: globals.cpp:40
std::string syntax
The syntax information for the command. Shown to the user when using the help command with an argumen...
Definition: console.h:74
ScriptDocCommand()
Definition: script_doc.hpp:16
std::string GetString(std::string option)
Retrieves the specified config option's value as a string.
Definition: config_accessors.cpp:10