 |
Blamite Game Engine - blam!
00423.10.27.24.0533.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>
20 description =
"saves a file called hs_doc.txt with parameters for all script commands and globals.";
22 syntax =
"script_doc [quiet]";
27 BlamResult
Execute(std::vector<std::string> arguments)
31 if (arguments.size() > 0)
33 if (arguments[0] ==
"quiet")
39 std::string doc_contents =
"";
43 doc_contents +=
"== Built-in Commands ==";
44 doc_contents +=
"\n\n\n\n";
47 std::map<std::string, BlamConsoleCommand*>::iterator it;
49 for (it = commands.begin(); it != commands.end(); it++)
55 std::string syntax_line =
"(";
57 syntax_line += command->
name;
62 syntax_line += command->
syntax;
67 doc_contents += syntax_line;
71 if (command->
aliases.size() > 0)
73 doc_contents +=
"\n\n";
75 std::string aliases_line =
"aliases: [";
77 for (
int i = 0; i < command->
aliases.size(); i++)
79 std::string alias = command->
aliases.at(i);
81 aliases_line += alias;
83 if (i != command->
aliases.size() - 1)
91 doc_contents += aliases_line;
97 doc_contents +=
"\n\n";
103 doc_contents +=
"\n\n";
104 doc_contents +=
"NETWORK SAFE: Unspecified (networking is not available yet)";
107 doc_contents +=
"\n\n\n\n";
113 doc_contents +=
"== Commands ==";
114 doc_contents +=
"\n\n\n\n";
121 doc_contents +=
"== Script Globals ==";
122 doc_contents +=
"\n\n\n\n";
125 std::map<std::string, BlamEngineGlobal>::iterator it;
133 if (it->second.read_only)
135 global_line +=
" [protected]";
138 doc_contents += global_line;
141 if (it->second.info !=
"")
143 doc_contents +=
"\n";
144 doc_contents += it->second.info;
147 doc_contents +=
"\n\n";
151 std::string file_path = *
ENGINE_CFG->GetString(
"paths",
"game_data_root") +
"/hs_doc.txt";
153 BlamStrings::Utils::IO::CreateNewFile(file_path, doc_contents);
157 BlamStrings::Utils::IO::OpenFile(file_path);
162 return BlamResult::Success_OK;
ScriptDocCommand()
Definition: script_doc.hpp:17
std::string description
An optional description of the command. Shown when using the classify command.
Definition: console.h:36
BlamResult Execute(std::vector< std::string > arguments)
Called upon command execution.
Definition: script_doc.hpp:27
Class used to represent a console command.
Definition: console.h:33
#define ENGINE_CFG
Macro to allow quicker access to the main configuration file.
Definition: config.h:20
std::string name
The name of the console command.
Definition: console.h:35
BLAM std::map< std::string, BlamConsoleCommand * > GetCommandList()
Retrieves the list of all loaded console commands.
Definition: console.cpp:232
BLAM std::string GetGlobalTypeLabel(BlamGlobalType type)
Retrieves a string representation of a global's type, for use in UI.
Definition: globals.cpp:40
Class for the script_doc command.
Definition: script_doc.hpp:14
std::string syntax
The syntax information for the command. Shown to the user when using the help command with an argumen...
Definition: console.h:37
BlamCommandType type
The type of command this is. See #Blam::Resources::Console::BlamCommandType for more information.
Definition: console.h:40
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:38
Namespace for things relating to the debug console.
Definition: abort.hpp:5
BLAM std::map< std::string, BlamEngineGlobal > * GetGlobalsList()
Retrieves the list of loaded globals.
Definition: globals.cpp:22
@ Builtin
A command that is hard-coded into the engine.