From: Christian Heller Date: Mon, 10 Mar 2014 10:18:30 +0000 (+0100) Subject: Some variable / struct member renaming for greater clarity. X-Git-Tag: tce~830 X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/todo?a=commitdiff_plain;h=65d60eba28c8e3128e1603e577c1436a2182f6bd;p=plomrogue Some variable / struct member renaming for greater clarity. --- diff --git a/src/client/draw_wins.c b/src/client/draw_wins.c index 129148c..59b7c3a 100644 --- a/src/client/draw_wins.c +++ b/src/client/draw_wins.c @@ -235,8 +235,8 @@ 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 = get_command_to_keycode(kb_p, kb_p->key); + char * keyname = get_keyname_to_keycode(kb_p->keycode); + struct Command * command = get_command_to_keycode(kb_p, kb_p->keycode); uint16_t size = 9 + 1 + strlen(command->dsc_long) + 1; char * line = try_malloc(size, f_name); sprintf(line, "%-9s %s", keyname, command->dsc_long); diff --git a/src/client/keybindings.c b/src/client/keybindings.c index 14d603b..bad527f 100644 --- a/src/client/keybindings.c +++ b/src/client/keybindings.c @@ -105,11 +105,11 @@ static uint8_t try_keycode(uint16_t keycode_given, char * keyname, extern struct Command * get_command_to_keycode(struct KeyBinding * kb_p, - uint16_t key) + uint16_t keycode) { while (0 != kb_p) { - if (key == kb_p->key) + if (keycode == kb_p->keycode) { return kb_p->command; } @@ -178,7 +178,7 @@ extern void write_keybindings_to_file(FILE * file, struct KeyBindingDB * kbd) kb_p = kbd->kbs; while (0 != kb_p) { - sprintf(line, "%d %s\n", kb_p->key, kb_p->command->dsc_short); + sprintf(line, "%d %s\n", kb_p->keycode, kb_p->command->dsc_short); try_fwrite(line, sizeof(char), strlen(line), file, f_name); kb_p = kb_p->next; } @@ -222,7 +222,7 @@ extern void read_keybindings_from_file(char * line, uint32_t linemax, kb_p->command = get_command(ptr_space + 1); err_line(!(kb_p->command), line, context, err_cmd); kb_p->next = 0; - kb_p->key = atoi(line); + kb_p->keycode = atoi(line); loc_last_ptr = & kb_p->next; } } @@ -251,12 +251,12 @@ extern void mod_selected_keyb(char kb_c) kbd->edit = 1; draw_all_wins(); cbreak(); - int key = getch(); + int keycode = getch(); halfdelay(world.halfdelay); - if (key < 1000) + if (keycode < 1000) { struct KeyBinding * kb_p = get_keyb_of_n(kbd->kbs, kbd->select); - kb_p->key = key; + kb_p->keycode = keycode; } kbd->edit = 0; } diff --git a/src/client/keybindings.h b/src/client/keybindings.h index ff89a4c..0d426e3 100644 --- a/src/client/keybindings.h +++ b/src/client/keybindings.h @@ -15,7 +15,7 @@ struct Command; struct KeyBinding { struct KeyBinding * next; - uint16_t key; /* keycode */ + uint16_t keycode; struct Command * command; /* command in command DB to which key is bound */ }; @@ -30,7 +30,7 @@ struct KeyBindingDB /* Return command bound to keycode; NULL on failure. */ extern struct Command * get_command_to_keycode(struct KeyBinding * kb_p, - uint16_t key); + uint16_t keycode); /* Return human-readable name (of maximum 9 chars) for "keycode" as matched by * ncurses.h; if none is found, return "UNKNOWN".