Roguelike
 All Classes Namespaces Functions Variables Typedefs Friends Pages
debug.h
1 
22 #ifndef _DEBUG_H
23 #define _DEBUG_H
24 
25 #include <string>
26 #include <vector>
27 #include <game.h>
28 #include <helper.h>
29 #include <map>
30 
31 class DebugConsole;
32 
33 typedef void (DebugConsole::*function)(std::vector<string>, std::vector<int>);
34 
35 
39 enum DEBUG_MESSAGES
40 {
41  GENERAL_ERROR,
42  NUM_ARG_ERROR,
43  TYPE_ARG_ERROR,
44  HELP,
45  HELP_SPAWN,
46  HELP_LIST,
47  HELP_KILLALL,
48  HELP_TELEPORT,
49  LIST_ENEMYTYPE,
50  COMPLETE
51 };
52 
53 static std::string db_messages[10] = {
54  "I'm sorry, I couldn't understand that command.",
55  "Too few arguments.",
56  "Incorrect argument types.",
57  "Commands: spawn, help, list, killall. Type 'help <command>' for how to use a command.",
58  "Spawn enemies. Args: chunk_x, chunk_y, x, y, depth, type of enemy, times to run command.",
59  "List available something. Options are: enemytype, coords",
60  "Kill all the enemies. Like, all of them.",
61  "Teleports the player. Args: chunk_x, chunk_y, x, y",
62  "EnemyTypes--1: Kobold, 2: Rabbit",
63  "Done."
64 };
65 
67 {
68  private:
69 
73  std::vector<std::string> buffer;
74 
83 
88 
92  std::string debug_message;
93 
98 
104  std::map<std::string, function> func_map;
105 
106  public:
110  DebugConsole();
111 
116  DebugConsole(Game* _game);
123  void run_command(std::string input);
124 
129  std::string get_message();
130 
138  std::string input_from_buffer(int direction);
139 
145  void help(std::vector<std::string> command, std::vector<int> args);
146 
152  void list(std::vector<std::string> command, std::vector<int> args);
153 
159  void killall(std::vector<std::string> command, std::vector<int> args);
160 
166  void spawn(std::vector<std::string> command, std::vector<int> args);
167 
173  void teleport(std::vector<std::string> command, std::vector<int> args);
174 };
175 
176 #endif
void spawn(std::vector< std::string > command, std::vector< int > args)
Definition: debug.cpp:152
std::string debug_message
Definition: debug.h:92
int current_place
Definition: debug.h:82
std::map< std::string, function > func_map
Definition: debug.h:104
Definition: debug.h:66
std::string input_from_buffer(int direction)
Definition: debug.cpp:184
DebugConsole()
Definition: debug.cpp:24
void list(std::vector< std::string > command, std::vector< int > args)
Definition: debug.cpp:116
Definition: game.h:49
void teleport(std::vector< std::string > command, std::vector< int > args)
Definition: debug.cpp:168
int buffer_size
Definition: debug.h:87
Game * game
Definition: debug.h:97
void run_command(std::string input)
Definition: debug.cpp:46
int buffer_place
Definition: debug.h:78
void help(std::vector< std::string > command, std::vector< int > args)
Definition: debug.cpp:88
void killall(std::vector< std::string > command, std::vector< int > args)
Definition: debug.cpp:142
std::vector< std::string > buffer
Definition: debug.h:73
std::string get_message()
Definition: debug.cpp:180