Modified the WMUD_COMMAND macro
The WMUD_COMMAND macro now automatically prefixes command handlers with gcmd_. It is convenient.
This commit is contained in:
parent
570d31ad4c
commit
74e84919d7
@ -24,9 +24,7 @@
|
||||
#include "networking.h"
|
||||
#include "main.h"
|
||||
|
||||
#define IS_SPACE(c) (g_ascii_isspace((c)) || (!(c)))
|
||||
|
||||
WMUD_COMMAND(gcmd_quit);
|
||||
WMUD_COMMAND(quit);
|
||||
|
||||
static wmudCommand command_list[] = {
|
||||
{ "quit", gcmd_quit },
|
||||
@ -87,7 +85,7 @@ wmud_interpret_game_command(wmudClient *client)
|
||||
start++;
|
||||
break;
|
||||
}
|
||||
else if (!IS_SPACE(*start))
|
||||
else if (g_ascii_isspace(*start) || (!*start))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -30,7 +30,13 @@
|
||||
* Command handler function type
|
||||
*/
|
||||
typedef void (*wmudCommandFunc)(wmudClient *client, gchar *command, GSList *token_list);
|
||||
#define WMUD_COMMAND(name) void name(wmudClient *client, gchar *command, GSList *token_list)
|
||||
/**
|
||||
* WMUD_COMMAND:
|
||||
* @name: the name of the command. Should be in lowercase
|
||||
*
|
||||
* Shorthand to create the function header for command handlers
|
||||
*/
|
||||
#define WMUD_COMMAND(name) void gcmd_ ## name(wmudClient *client, gchar *command, GSList *token_list)
|
||||
|
||||
/**
|
||||
* wmudCommand:
|
||||
|
Loading…
Reference in New Issue
Block a user