 |
Blamite Game Engine - blam!
00453.06.08.26.0624.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>
18 description =
"saves a file called hs_doc.txt with parameters for all script commands and globals.";
20 syntax =
"script_doc [quiet]";
25 BlamResult
Execute(std::vector<std::string> arguments)
29 if (arguments.size() > 0)
31 if (arguments[0] ==
"quiet")
37 std::string doc_contents =
"";
41 doc_contents +=
"== Built-in Commands ==";
42 doc_contents +=
"\n\n\n\n";
45 std::map<std::string, BlamConsoleCommand*>::iterator it;
47 for (it = commands.begin(); it != commands.end(); it++)
53 std::string syntax_line =
"(";
55 syntax_line += command->
name;
60 syntax_line += command->
syntax;
65 doc_contents += syntax_line;
69 if (command->
aliases.size() > 0)
71 doc_contents +=
"\n\n";
73 std::string aliases_line =
"aliases: [";
75 for (
int i = 0; i < command->
aliases.size(); i++)
77 std::string alias = command->
aliases.at(i);
79 aliases_line += alias;
81 if (i != command->
aliases.size() - 1)
89 doc_contents += aliases_line;
95 doc_contents +=
"\n\n";
101 doc_contents +=
"\n\n";
102 doc_contents +=
"NETWORK SAFE: Unspecified (networking is not available yet)";
105 doc_contents +=
"\n\n\n\n";
111 doc_contents +=
"== Commands ==";
112 doc_contents +=
"\n\n\n\n";
119 doc_contents +=
"== Script Globals ==";
120 doc_contents +=
"\n\n\n\n";
123 std::map<std::string, BlamEngineGlobal>::iterator it;
131 if (it->second.read_only)
133 global_line +=
" [protected]";
136 doc_contents += global_line;
139 if (it->second.info !=
"")
141 doc_contents +=
"\n";
142 doc_contents += it->second.info;
145 doc_contents +=
"\n\n";
151 BlamStrings::Utils::IO::CreateNewFile(file_path, doc_contents);
155 BlamStrings::Utils::IO::OpenFile(file_path);
160 return BlamResult::Success_OK;
ScriptDocCommand()
Definition: script_doc.hpp:15
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:25
Class used to represent a console command.
Definition: console.h:33
#define USER_DATA_PATH(path)
Macro to quickly access a user data folder.
Definition: config.h:41
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:239
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:12
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
@ DataRoot
The root of all user data. Defaults to BlamStrings::Utils::IO::GetEngineDataRoot().
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.