X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=src%2Fdraw_wins.c;h=b15e1742d75aab610c6e29e97c34159c28a0f4ba;hb=b705b99b02a5eeb2b76605fe9b11eb6d5411d6e3;hp=1b4f0ac4ae0fcea6f5c2ea4508abb4bb03eea5d3;hpb=49e001a2f811ba328819f21e84b25567cfa9de05;p=plomrogue diff --git a/src/draw_wins.c b/src/draw_wins.c index 1b4f0ac..b15e174 100644 --- a/src/draw_wins.c +++ b/src/draw_wins.c @@ -12,6 +12,7 @@ #include "map.h" /* for Map struct */ #include "main.h" /* for World struct */ #include "rexit.h" /* for err_exit() */ +#include "command_db.h" /* for get_command_longdesc() */ @@ -211,7 +212,7 @@ extern void draw_info_win(struct Win * win) char * dsc_hitpoints = "\nHitpoints: "; char * dsc_score = "\nScore: "; uint16_t maxl = strlen(dsc_turn) + strlen(dsc_hitpoints) + strlen(dsc_score) - + 10 + 5 + 10; /* max strlens of numbers to be used */ + + 10 + 5 + 10; /* max strlens of numbers to be used */ char * text = malloc(maxl + 1); sprintf(text, "%s%d%s%d%s%d", dsc_turn, world->turn, @@ -233,6 +234,7 @@ extern void draw_keys_win(struct Win * win) char * keydesc = malloc(keydescwidth), * keyname; char * err_hint = "Trouble with draw_scroll_hint() in draw_keys_win()."; attr_t attri; + char * cmd_dsc; for (y = 0; y <= world->keyswindata->max && y < win->frame.size.y; y++) { if (0 == y && offset > 0) @@ -263,19 +265,19 @@ extern void draw_keys_win(struct Win * win) keyname = get_keyname(world->keybindings[y + offset].key); snprintf(keydesc, keydescwidth, "%-9s", keyname); free(keyname); + cmd_dsc = get_command_longdsc(world, + world->keybindings[y + offset].name); for (x = 0; x < win->frame.size.x; x++) { if (x < strlen(keydesc)) { mvwaddch(win->frame.curses_win, y, x, keydesc[x] | attri); } - else if (strlen(keydesc) < x - && x < strlen(world->keybindings[y + offset].name) - + strlen(keydesc) + 1) + else if ( strlen(keydesc) < x + && x < strlen(cmd_dsc) + strlen(keydesc) + 1) { mvwaddch(win->frame.curses_win, y, x, - world->keybindings[y + offset] - .name[x - strlen(keydesc) - 1] | attri); + cmd_dsc[x - strlen(keydesc) - 1] | attri); } else {