home · contact · privacy
Client: Fit interface_conf to new config file style. Also, refactorings.
[plomrogue] / src / client / command_db.h
1 /* src/client/command_db.h
2  *
3  * The Command DB collects the commands available to the user by internal name,
4  * description and, optionally, components of a message to send to the server
5  * when calling it.
6  */
7
8 #ifndef COMMAND_DB_H
9 #define COMMAND_DB_H
10
11 #include <stdint.h> /* uint8_t */
12
13
14
15 struct Command
16 {
17     char * dsc_short; /* short name of command to be used internally */
18     char * dsc_long; /* long description of command to be shown to the user */
19     char * server_msg; /* optionally start string of message to send to server*/
20     char arg; /* defines server message suffix by player_control() convention */
21 };
22
23 struct CommandDB
24 {
25     struct Command * cmds; /* memory area for sequence of all Command structs */
26     uint8_t n;             /* number of Command structs in database */
27 };
28
29
30
31 /* Return Command struct for command described by its "dsc_short" member. Return
32  * NULL if no such command is found.
33  */
34 extern struct Command * get_command(char * dsc_short);
35
36 /* Read in CommandDB config file. */
37 extern void init_command_db();
38
39 /* Free all memory allocated with init_command_db. */
40 extern void free_command_db();
41
42
43
44 #endif