From: Christian Heller Date: Wed, 22 Jan 2014 04:35:14 +0000 (+0100) Subject: Simplified client control library and interaction with it. X-Git-Tag: tce~882 X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/%7B%7Bdb.prefix%7D%7D/processes?a=commitdiff_plain;h=a8097b8fef09444ebac0f1e2d3ffc4e621557b28;p=plomrogue Simplified client control library and interaction with it. --- diff --git a/src/client/command_db.c b/src/client/command_db.c index fa125c4..699eb46 100644 --- a/src/client/command_db.c +++ b/src/client/command_db.c @@ -30,7 +30,7 @@ static void copy_tokenized_string(char * line, char ** ch_ptr, char * delim) -extern struct Command * get_command_data(char * dsc_short) +extern struct Command * get_command(char * dsc_short) { struct Command * cmd_ptr = world.cmd_db.cmds; uint8_t i = 0; diff --git a/src/client/command_db.h b/src/client/command_db.h index 0f2ef77..9f82062 100644 --- a/src/client/command_db.h +++ b/src/client/command_db.h @@ -29,7 +29,7 @@ struct CommandDB /* Return Command struct for command described by its "dsc_short" member. */ -extern struct Command * get_command_data(char * dsc_short); +extern struct Command * get_command(char * dsc_short); /* Reads CommandDB from CommandDB file, line by line, until first empty line. */ extern void init_command_db(); diff --git a/src/client/control.c b/src/client/control.c index 56c41fd..7e1a596 100644 --- a/src/client/control.c +++ b/src/client/control.c @@ -4,7 +4,6 @@ #include /* uint8_t, uint16_t */ #include /* sprintf() */ #include /* strlen() */ -#include "command_db.h" /* get_command_data() */ #include "io.h" /* try_send() */ #include "keybindings.h" /* struct KeyBindingDB, get_command_to_keycode(), * get_keycode_to_command(), mod_selected_keyb(), @@ -23,18 +22,6 @@ -/* If "keycode" matches "match" in get_available_keycode_to_command(), execute - * "f" with provided char arguments and return 1; else only return 0. - */ -static uint8_t try_cmd_0args(int keycode, char * match, void (* f) ()); -static uint8_t try_cmd_1args(int keycode, char * match, - void (* f) (char), char c); -static uint8_t try_cmd_2args(int keycode, char * match, - void (* f) (char, char), char c1, char c2); - -/* Return keycode to "command" if it is available in current window config. */ -static uint16_t get_available_keycode_to_command(char * command); - /* Return pointer to global keybindings or to keybindings for wingeometry config * (c = "g") or winkeys config (c = "k") or active window's keybindings ("w"). */ @@ -44,68 +31,25 @@ static struct KeyBindingDB * select_keybindingdb_pointer(char c); static void wrap_mod_selected_keyb(char c); static void wrap_mv_kb_mod(char c1, char c2); +/* If "command"'s .dsc_short fits "match", apply "f" with provided char + * arguments and return 1; else, return 0. + */ +static uint8_t try_0args(struct Command * command, char * match, void (* f) ()); +static uint8_t try_1args(struct Command * command, char * match, + void (* f) (char), char c); +static uint8_t try_2args(struct Command * command, char * match, + void (* f) (char, char), char c1, char c2); + +/* Try if "command" matches a hard-coded list of client-only commands and, if + * successful, execute the match and return 1. Else, return 0. + */ +static uint8_t try_client_commands(struct Command * command); - -static uint8_t try_cmd_0args(int keycode, char * match, void (* f) ()) -{ - if (keycode == get_available_keycode_to_command(match)) - { - f(); - return 1; - } - return 0; -} - - - -static uint8_t try_cmd_1args(int keycode, char * match, - void (* f) (char), char c) -{ - if (keycode == get_available_keycode_to_command(match)) - { - f(c); - return 1; - } - return 0; -} - - - -static uint8_t try_cmd_2args(int keycode, char * match, - void (* f) (char, char), char c1, char c2) -{ - if (keycode == get_available_keycode_to_command(match)) - { - f(c1, c2); - return 1; - } - return 0; -} - - - -static uint16_t get_available_keycode_to_command(char * command) -{ - uint16_t keycode = get_keycode_to_command(world.kb_global.kbs, command); - if (0 != keycode || 0 == world.wmeta.active) - { - return keycode; - } - struct WinConf * wc = get_winconf_by_win(world.wmeta.active); - if (0 == wc->view) - { - keycode = get_keycode_to_command(wc->kb.kbs, command); - } - else if (1 == wc->view) - { - keycode = get_keycode_to_command(world.kb_wingeom.kbs, command); - } - else if (2 == wc->view) - { - keycode = get_keycode_to_command(world.kb_winkeys.kbs, command); - } - return keycode; -} +/* Try out "command" as one for server messaging; sending is .server_msg, + * followed by either a string representing "command"'s .arg, or, if .arg is + * 'i', world.player_inventory_select. Return 1 on success, 0 on failure. + */ +static uint8_t try_server_commands(struct Command * command); @@ -145,27 +89,22 @@ static void wrap_mv_kb_mod(char c1, char c2) -extern uint8_t player_control(int key) +static uint8_t try_0args(struct Command * command, char * match, void (* f) ()) { - char * cmd = get_command_to_keycode(world.kb_global.kbs, key); - if (NULL == cmd && 0 != world.wmeta.active) + if (!strcmp(command->dsc_short, match)) { - struct WinConf * wc = get_winconf_by_win(world.wmeta.active); - cmd = get_command_to_keycode(wc->kb.kbs, key); + f(); + return 1; } - if (NULL != cmd) + return 0; +} + +static uint8_t try_1args(struct Command * command, char * match, + void (* f) (char), char c) +{ + if (!strcmp(command->dsc_short, match)) { - struct Command * command_data = get_command_data(cmd); - uint8_t arg = (uint8_t) command_data->arg; - if ('i' == arg) - { - arg = world.player_inventory_select; - } - uint8_t command_size = strlen(command_data->server_msg); - uint8_t arg_size = 3; - char msg[command_size + 1 + arg_size + 1]; - sprintf(msg, "%s %d", command_data->server_msg, arg); - try_send(msg); + f(c); return 1; } return 0; @@ -173,17 +112,12 @@ extern uint8_t player_control(int key) -extern uint8_t wingeom_control(int key) +static uint8_t try_2args(struct Command * command, char * match, + void (* f) (char, char), char c1, char c2) { - if ( try_cmd_1args(key, "to_height_t", toggle_win_size_type, 'y') - || try_cmd_1args(key, "to_width_t", toggle_win_size_type, 'x') - || try_cmd_1args(key, "grow_h", growshrink_active_window, '*') - || try_cmd_1args(key, "shri_h", growshrink_active_window, '_') - || try_cmd_1args(key, "grow_v", growshrink_active_window, '+') - || try_cmd_1args(key, "shri_v", growshrink_active_window, '-') - || try_cmd_1args(key, "shift_f", shift_active_win, 'f') - || try_cmd_1args(key, "shift_b", shift_active_win, 'b')) + if (!strcmp(command->dsc_short, match)) { + f(c1, c2); return 1; } return 0; @@ -191,12 +125,68 @@ extern uint8_t wingeom_control(int key) -extern uint8_t winkeyb_control(int key) +static uint8_t try_client_commands(struct Command * command) +{ + return ( try_0args(command, "winconf", toggle_winconfig) + || try_0args(command, "reload_conf", reload_interface_conf) + || try_0args(command, "save_conf", save_interface_conf) + || try_0args(command, "map_c", map_center) + || try_1args(command, "scrl_r", scroll_pad, '+') + || try_1args(command, "scrl_l", scroll_pad, '-') + || try_1args(command, "to_a_keywin", toggle_window, 'k') + || try_1args(command, "to_g_keywin", toggle_window, '0') + || try_1args(command, "to_wg_keywin", toggle_window, '1') + || try_1args(command, "to_wk_keywin", toggle_window, '2') + || try_1args(command, "to_mapwin", toggle_window, 'm') + || try_1args(command, "to_infowin", toggle_window, 'i') + || try_1args(command, "to_inv", toggle_window, 'c') + || try_1args(command, "to_logwin", toggle_window, 'l') + || try_1args(command, "cyc_win_f", cycle_active_win, 'f') + || try_1args(command, "cyc_win_b", cycle_active_win, 'b') + || try_1args(command, "g_keys_m", wrap_mod_selected_keyb, 'G') + || try_1args(command, "wg_keys_m", wrap_mod_selected_keyb, 'g') + || try_1args(command, "wk_keys_m", wrap_mod_selected_keyb, 'k') + || try_1args(command, "inv_u", nav_inventory, 'u') + || try_1args(command, "inv_d", nav_inventory, 'd') + || try_1args(command, "map_u", map_scroll, 'N') + || try_1args(command, "map_d", map_scroll, 'S') + || try_1args(command, "map_r", map_scroll, 'E') + || try_1args(command, "map_l", map_scroll, 'W') + || try_1args(command, "to_height_t", toggle_win_size_type, 'y') + || try_1args(command, "to_width_t", toggle_win_size_type, 'x') + || try_1args(command, "grow_h", growshrink_active_window, '*') + || try_1args(command, "shri_h", growshrink_active_window, '_') + || try_1args(command, "grow_v", growshrink_active_window, '+') + || try_1args(command, "shri_v", growshrink_active_window, '-') + || try_1args(command, "shift_f", shift_active_win, 'f') + || try_1args(command, "shift_b", shift_active_win, 'b') + || try_1args(command, "w_keys_m", wrap_mod_selected_keyb, 'w') + || try_2args(command, "w_keys_u", wrap_mv_kb_mod, 'w', 'u') + || try_2args(command, "w_keys_d", wrap_mv_kb_mod, 'w', 'd') + || try_2args(command, "g_keys_u", wrap_mv_kb_mod, 'G', 'u') + || try_2args(command, "g_keys_d", wrap_mv_kb_mod, 'G', 'd') + || try_2args(command, "wg_keys_u", wrap_mv_kb_mod, 'g', 'u') + || try_2args(command, "wg_keys_d", wrap_mv_kb_mod, 'g', 'd') + || try_2args(command, "wk_keys_u", wrap_mv_kb_mod, 'k', 'u') + || try_2args(command, "wk_keys_d", wrap_mv_kb_mod, 'k', 'd')); +} + + + +static uint8_t try_server_commands(struct Command * command) { - if ( try_cmd_1args(key, "w_keys_m", wrap_mod_selected_keyb, 'w') - || try_cmd_2args(key, "w_keys_u", wrap_mv_kb_mod, 'w', 'u') - || try_cmd_2args(key, "w_keys_d", wrap_mv_kb_mod, 'w', 'd')) + if (command->server_msg) { + uint8_t arg = (uint8_t) command->arg; + if ('i' == arg) + { + arg = world.player_inventory_select; + } + uint8_t command_size = strlen(command->server_msg); + uint8_t arg_size = 3; + char msg[command_size + 1 + arg_size + 1]; + sprintf(msg, "%s %d", command->server_msg, arg); + try_send(msg); return 1; } return 0; @@ -204,43 +194,39 @@ extern uint8_t winkeyb_control(int key) -extern uint8_t meta_control(int key) +extern uint8_t try_key(uint16_t key) { - uint8_t ret = 2 * (key == get_available_keycode_to_command("quit")); - if ( (0 == ret) - && ( try_cmd_0args(key, "winconf", toggle_winconfig) - || try_cmd_0args(key, "reload_conf", reload_interface_conf) - || try_cmd_0args(key, "save_conf", save_interface_conf) - || try_cmd_0args(key, "map_c", map_center) - || try_cmd_1args(key, "scrl_r", scroll_pad, '+') - || try_cmd_1args(key, "scrl_l", scroll_pad, '-') - || try_cmd_1args(key, "to_a_keywin", toggle_window, 'k') - || try_cmd_1args(key, "to_g_keywin", toggle_window, '0') - || try_cmd_1args(key, "to_wg_keywin", toggle_window, '1') - || try_cmd_1args(key, "to_wk_keywin", toggle_window, '2') - || try_cmd_1args(key, "to_mapwin", toggle_window, 'm') - || try_cmd_1args(key, "to_infowin", toggle_window, 'i') - || try_cmd_1args(key, "to_inv", toggle_window, 'c') - || try_cmd_1args(key, "to_logwin", toggle_window, 'l') - || try_cmd_1args(key, "cyc_win_f", cycle_active_win, 'f') - || try_cmd_1args(key, "cyc_win_b", cycle_active_win, 'b') - || try_cmd_1args(key, "g_keys_m", wrap_mod_selected_keyb, 'G') - || try_cmd_1args(key, "wg_keys_m", wrap_mod_selected_keyb, 'g') - || try_cmd_1args(key, "wk_keys_m", wrap_mod_selected_keyb, 'k') - || try_cmd_1args(key, "inv_u", nav_inventory, 'u') - || try_cmd_1args(key, "inv_d", nav_inventory, 'd') - || try_cmd_1args(key, "map_u", map_scroll, 'N') - || try_cmd_1args(key, "map_d", map_scroll, 'S') - || try_cmd_1args(key, "map_r", map_scroll, 'E') - || try_cmd_1args(key, "map_l", map_scroll, 'W') - || try_cmd_2args(key, "g_keys_u", wrap_mv_kb_mod, 'G', 'u') - || try_cmd_2args(key, "g_keys_d", wrap_mv_kb_mod, 'G', 'd') - || try_cmd_2args(key, "wg_keys_u", wrap_mv_kb_mod, 'g', 'u') - || try_cmd_2args(key, "wg_keys_d", wrap_mv_kb_mod, 'g', 'd') - || try_cmd_2args(key, "wk_keys_u", wrap_mv_kb_mod, 'k', 'u') - || try_cmd_2args(key, "wk_keys_d", wrap_mv_kb_mod, 'k', 'd'))) + struct Command * command = get_command_to_keycode(world.kb_global.kbs, key); + if (!command) { - ret = 1; + struct WinConf * wc = get_winconf_by_win(world.wmeta.active); + if (0 == wc->view) + { + command = get_command_to_keycode(wc->kb.kbs, key); + } + else if (1 == wc->view) + { + command = get_command_to_keycode(world.kb_wingeom.kbs, key); + } + else if (2 == wc->view) + { + command = get_command_to_keycode(world.kb_winkeys.kbs, key); + } } - return ret; + if (command) + { + if (try_client_commands(command)) + { + return 1; + } + else if (!strcmp("quit", command->dsc_short)) + { + return 2; + } + else if (try_server_commands(command)) + { + return 1; + } + } + return 0; } diff --git a/src/client/control.h b/src/client/control.h index 56d33c3..6cc251a 100644 --- a/src/client/control.h +++ b/src/client/control.h @@ -6,30 +6,15 @@ #ifndef CONTROL_H #define CONTROL_H -#include /* uint8_t */ +#include /* uint8_t, uint16_t */ -/* Tries to call by "key" for player actions triggering messages to the server. - * The appropriate Command struct's .server_msg will be sent, followed by a " ", - * followed by either a string representation of the numerical value of the - * Command struct's .arg, or, if .arg == 'i', world.player_inventory_select. - * Returns 1 on success, 0 on failure. +/* Try to match "key" to the Command DB and execute appropriate actions if + * successful. Return 0 on failure, 2 for calling a "quit" comand (to be + * handled externally) and 1 for calling any other command. */ -extern uint8_t player_control(int key); - -/* Try to call by "key" actions for active window's keybindings/geometry config - * view. Return 1 on success, 0 on failure. - */ -extern uint8_t wingeom_control(int key); -extern uint8_t winkeyb_control(int key); - -/* Try to call by "key" basic window and game management actions that do not - * send a message to the server and do not change individual windows' - * keybindings or geometries. Returns 0 on failure, 2 for calling a "quit" - * action (to be handled externally) and 1 for calling any other action. - */ -extern uint8_t meta_control(int key); +extern uint8_t try_key(uint16_t key); diff --git a/src/client/draw_wins.c b/src/client/draw_wins.c index 1ad1ab2..4a88038 100644 --- a/src/client/draw_wins.c +++ b/src/client/draw_wins.c @@ -6,8 +6,7 @@ #include /* for sprintf() */ #include /* free() */ #include /* strlen(), strtok() */ -#include "../common/try_malloc.h" /* for try_malloc() */ -#include "command_db.h" /* get_command_data() */ +#include "../common/try_malloc.h" /* try_malloc() */ #include "keybindings.h" /* struct KeyBinding, get_keyname_to_keycode() */ #include "wincontrol.h" /* struct WinConf, get_winconf_by_win() */ #include "windows.h" /* struct Win */ @@ -237,11 +236,10 @@ static char * get_kb_line_and_iterate(struct KeyBinding ** kb_pp) char * f_name = "get_kb_line_and_iterate()"; struct KeyBinding * kb_p = * kb_pp; char * keyname = get_keyname_to_keycode(kb_p->key); - struct Command * command_data = get_command_data(kb_p->command); - char * cmd_dsc = command_data->dsc_long; - uint16_t size = 9 + 1 + strlen(cmd_dsc) + 1; + struct Command * command = get_command_to_keycode(kb_p, kb_p->key); + uint16_t size = 9 + 1 + strlen(command->dsc_long) + 1; char * line = try_malloc(size, f_name); - sprintf(line, "%-9s %s", keyname, cmd_dsc); + sprintf(line, "%-9s %s", keyname, command->dsc_long); free(keyname); * kb_pp = kb_p->next; return line; diff --git a/src/client/io.c b/src/client/io.c index 3284389..2f7d18a 100644 --- a/src/client/io.c +++ b/src/client/io.c @@ -16,11 +16,8 @@ #include "../common/readwrite.h" /* try_fopen(), try_fclose(), try_fgets(), * try_fgetc() */ -#include "control.h" /* meta_control(), player_control(), wingeom_control(), - * winkeyb_control() - */ +#include "control.h" /* try_key() */ #include "map_window.h" /* for map_center() */ -#include "wincontrol.h" /* WinConf struct, get_winconf_by_win() */ #include "windows.h" /* draw_all_wins() */ #include "world.h" /* world global */ @@ -268,21 +265,11 @@ extern char * io_loop() int key = getch(); if (ERR != key) { - change_in_client = meta_control(key); + change_in_client = try_key((uint16_t) key); if (2 == change_in_client) { break; } - if (!change_in_client) - { - change_in_client = player_control(key); - } - if (!change_in_client) - { - struct WinConf * wc = get_winconf_by_win(world.wmeta.active); - change_in_client = (1 == wc->view && wingeom_control(key)) - || (2 == wc->view && winkeyb_control(key)); - } } } try_send("QUIT"); diff --git a/src/client/keybindings.c b/src/client/keybindings.c index 709d5a0..ab34d24 100644 --- a/src/client/keybindings.c +++ b/src/client/keybindings.c @@ -5,7 +5,7 @@ #include /* FILE, sprintf(), snprintf() */ #include /* uint8_t, uint16_t, uint32_t */ #include /* free(), atoi() */ -#include /* strlen(), strchr(), strcmp(), memcpy() */ +#include /* strlen(), strchr() */ #include "../common/readwrite.h" /* try_fopen(), textfile_sizes(), try_fgets(), * try_fclose(), try_fclose_unlink_rename(), * try_fwrite() @@ -77,7 +77,8 @@ static uint8_t try_keycode(uint16_t keycode_given, char * keyname, -extern char * get_command_to_keycode(struct KeyBinding * kb_p, uint16_t key) +extern struct Command * get_command_to_keycode(struct KeyBinding * kb_p, + uint16_t key) { while (0 != kb_p) { @@ -92,21 +93,6 @@ extern char * get_command_to_keycode(struct KeyBinding * kb_p, uint16_t key) -extern uint16_t get_keycode_to_command(struct KeyBinding * kb_p, char * command) -{ - while (0 != kb_p) - { - if (0 == strcmp(kb_p->command, command)) - { - return kb_p->key; - } - kb_p = kb_p->next; - } - return 0; -} - - - extern char * get_keyname_to_keycode(uint16_t keycode) { char * f_name = "get_name_to_keycode()"; @@ -168,9 +154,8 @@ extern void init_keybindings(char * path, struct KeyBindingDB * kbd) kb_p->next = 0; kb_p->key = atoi(command); cmdptr = strchr(command, ' ') + 1; - kb_p->command = try_malloc(strlen(cmdptr), f_name); - memcpy(kb_p->command, cmdptr, strlen(cmdptr) - 1); - kb_p->command[strlen(cmdptr) - 1] = '\0'; + cmdptr[strlen(cmdptr) - 1] = '\0'; + kb_p->command = get_command(cmdptr); loc_last_ptr = & kb_p->next; } try_fclose(file, f_name); @@ -190,9 +175,9 @@ extern void save_keybindings(char * path, struct KeyBindingDB * kbd) struct KeyBinding * kb_p = kbd->kbs; while (0 != kb_p) { - if (strlen(kb_p->command) > linemax) + if (strlen(kb_p->command->dsc_short) > linemax) { - linemax = strlen(kb_p->command); + linemax = strlen(kb_p->command->dsc_short); } kb_p = kb_p->next; } @@ -201,7 +186,7 @@ extern void save_keybindings(char * path, struct KeyBindingDB * kbd) kb_p = kbd->kbs; while (0 != kb_p) { - snprintf(line, linemax, "%d %s\n", kb_p->key, kb_p->command); + snprintf(line, linemax, "%d %s\n", kb_p->key, kb_p->command->dsc_short); try_fwrite(line, sizeof(char), strlen(line), file, f_name); kb_p = kb_p->next; } @@ -221,7 +206,6 @@ extern void free_keybindings(struct KeyBinding * kb_start) { free_keybindings(kb_p); } - free(kb_start->command); free(kb_start); } diff --git a/src/client/keybindings.h b/src/client/keybindings.h index ea09d65..e288203 100644 --- a/src/client/keybindings.h +++ b/src/client/keybindings.h @@ -7,14 +7,15 @@ #define KEYBINDINGS_H #include /* uint8_t, uint16_t */ +struct Command; struct KeyBinding { struct KeyBinding * next; - uint16_t key; /* keycode */ - char * command; /* name of command / functionality bound to keycode */ + uint16_t key; /* keycode */ + struct Command * command; /* command in command DB to which key is bound */ }; struct KeyBindingDB @@ -26,12 +27,9 @@ struct KeyBindingDB -/* Return name of command / functionality bound to keycode; NULL on failure. */ -extern char * get_command_to_keycode(struct KeyBinding * kb_p, uint16_t key); - -/* Return keycode bound to "command". */ -extern uint16_t get_keycode_to_command(struct KeyBinding * keybindings, - char * command); +/* Return command bound to keycode; NULL on failure. */ +extern struct Command * get_command_to_keycode(struct KeyBinding * kb_p, + uint16_t key); /* Return human-readable name (of maximum 9 chars) for "keycode" as matched by * ncurses.h; if none is found, return "UNKNOWN". diff --git a/src/client/main.c b/src/client/main.c index 26ad728..6a71592 100644 --- a/src/client/main.c +++ b/src/client/main.c @@ -26,8 +26,8 @@ int main() /* Initialize the whole interface. */ init_win_meta(); keypad(world.wmeta.screen, TRUE); - init_command_db(); - load_interface_conf(); + init_command_db(); /* The command DB needs to be initialized before */ + load_interface_conf(); /* the interface, whose keybindings depend on it. */ /* This is where most everything happens. */ char * quit_msg = io_loop(); diff --git a/src/client/wincontrol.c b/src/client/wincontrol.c index eda233b..b241eba 100644 --- a/src/client/wincontrol.c +++ b/src/client/wincontrol.c @@ -117,9 +117,8 @@ static void init_winconf_from_file(char id, struct WinConf * winconf) kb_p->next = 0; kb_p->key = atoi(command); cmdptr = strchr(command, ' ') + 1; - kb_p->command = try_malloc(strlen(cmdptr), context); - memcpy(kb_p->command, cmdptr, strlen(cmdptr) - 1); - kb_p->command[strlen(cmdptr) - 1] = '\0'; + cmdptr[strlen(cmdptr) - 1] = '\0'; + kb_p->command = get_command(cmdptr); loc_last_ptr = & kb_p->next; } @@ -174,9 +173,9 @@ static void save_win_config(char id) struct KeyBinding * kb_p = wc->kb.kbs; while (0 != kb_p) { - if (strlen(kb_p->command) > linemax) + if (strlen(kb_p->command->dsc_short) > linemax) { - linemax = strlen(kb_p->command); + linemax = strlen(kb_p->command->dsc_short); } kb_p = kb_p->next; } @@ -185,7 +184,7 @@ static void save_win_config(char id) kb_p = wc->kb.kbs; while (0 != kb_p) { - sprintf(kb_line, "%d %s\n", kb_p->key, kb_p->command); + sprintf(kb_line, "%d %s\n", kb_p->key, kb_p->command->dsc_short); try_fwrite(kb_line, sizeof(char), strlen(kb_line), file, f_name); kb_p = kb_p->next; } diff --git a/src/server/map_object_actions.c b/src/server/map_object_actions.c index f7bdcb4..37e113c 100644 --- a/src/server/map_object_actions.c +++ b/src/server/map_object_actions.c @@ -277,7 +277,7 @@ extern uint8_t get_moa_id_by_name(char * name) } moa = moa->next; } - exit_err(NULL == moa, "get_moa_id_name() did not find map object action."); + exit_err(NULL==moa, "get_moa_id_by_name() did not find map object action."); return moa->id; }