mirror of https://github.com/basinserver/basin/
Typedef bs
This commit is contained in:
parent
caf30fe11c
commit
0368b40215
|
@ -73,14 +73,16 @@ void init_base_commands() {
|
||||||
registerCommand("spawn", &command_spawn);
|
registerCommand("spawn", &command_spawn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef void (*command_callback)(struct player* player, char** args, size_t args_count);
|
||||||
|
|
||||||
struct command {
|
struct command {
|
||||||
char* command;
|
char* command;
|
||||||
void (*callback)(struct player* player, char** args, size_t args_count);
|
command_callback callback;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct collection* registered_commands;
|
struct collection* registered_commands;
|
||||||
|
|
||||||
void registerCommand(char* command, void (*callback)(struct player* player, char** args, size_t args_count)) {
|
void registerCommand(char* command, command_callback callback) {
|
||||||
if (registered_commands == NULL) registered_commands = new_collection(16, 0);
|
if (registered_commands == NULL) registered_commands = new_collection(16, 0);
|
||||||
struct command* com = xmalloc(sizeof(struct command));
|
struct command* com = xmalloc(sizeof(struct command));
|
||||||
com->command = xstrdup(command, 0);
|
com->command = xstrdup(command, 0);
|
||||||
|
|
Loading…
Reference in New Issue