Elaztek Developer Hub
Blamite Game Engine - blam!  00423.10.27.24.0533.blamite
The core library for the Blamite Game Engine.
help.hpp
Go to the documentation of this file.
1 #include "../console.h"
2 
3 #include <set>
4 
6 
8 {
17  {
18  public:
20  {
21  name = "help";
22  description = "Shows a list of commands.";
23 
25  }
26 
27  BlamResult Execute(std::vector<std::string> arguments)
28  {
29  using namespace Blam::Logger;
30 
31  // blank line
32  LogEventForce("", WSV_NONE);
33 
34  std::set<std::string> command_list;
35 
36  std::map<std::string, BlamConsoleCommand*> map = Blam::Resources::Console::GetCommandList();
37  std::map<std::string, BlamConsoleCommand*>::iterator it;
38 
39  for (it = map.begin(); it != map.end(); it++)
40  {
41  command_list.insert(it->second->name);
42  }
43 
44  std::set<std::string>::iterator list_it;
45 
46  for (list_it = command_list.begin(); list_it != command_list.end(); list_it++)
47  {
48  std::string cmd_name = *list_it;
49 
50  Blam::Logger::LogEventForce(cmd_name, WSV_NONE);
51  }
52 
53  return BlamResult::Success_OK;
54  }
55  };
56 }
command_list
std::map< std::string, BlamConsoleCommand * > command_list
The list of all loaded console commands.
Definition: console.cpp:51
Blam::Resources::Console::HelpCommand::HelpCommand
HelpCommand()
Definition: help.hpp:19
BlamConsoleCommand::description
std::string description
An optional description of the command. Shown when using the classify command.
Definition: console.h:36
logger.h
BlamConsoleCommand
Class used to represent a console command.
Definition: console.h:33
BlamConsoleCommand::name
std::string name
The name of the console command.
Definition: console.h:35
Blam::Resources::Console::GetCommandList
BLAM std::map< std::string, BlamConsoleCommand * > GetCommandList()
Retrieves the list of all loaded console commands.
Definition: console.cpp:232
Blam::Resources::Console::HelpCommand::Execute
BlamResult Execute(std::vector< std::string > arguments)
Called upon command execution.
Definition: help.hpp:27
BlamConsoleCommand::type
BlamCommandType type
The type of command this is. See #Blam::Resources::Console::BlamCommandType for more information.
Definition: console.h:40
Blam::Logger::LogEventForce
BLAM void LogEventForce(std::string message)
Forcibly logs a message to the log and/or console.
Definition: aliases.cpp:262
Blam::Logger
Namespace containing things related to the Blamite Logger.
Definition: logger.h:200
Blam::Resources::Console
Namespace for things relating to the debug console.
Definition: abort.hpp:5
Blam::Resources::Console::HelpCommand
Class for the help command.
Definition: help.hpp:16
BlamCommandType::Builtin
@ Builtin
A command that is hard-coded into the engine.