home · contact · privacy
Test for minimal window size no longer necessary since windows cannot shrink so far.
[plomrogue] / roguelike.c
index ee5dbe48be76fa54e3e9f7cafd2993a0c13404d6..7d535bc9221b7ea446ad2f1128570ade548ad017 100644 (file)
@@ -218,7 +218,7 @@ void draw_keys_window (struct Win * win) {
   attr_t attri;
   int y, x;
   char * keyname;
-  for (y = 0; 0 != keybindings[offset + y].name && y < win->height; y++) {
+  for (y = 0; y <= keyswindata->max && y < win->height; y++) {
     attri = 0;
     if (y == keyswindata->select - offset) {
       attri = A_REVERSE;
@@ -262,7 +262,7 @@ void init_keybindings(struct World * world) {
   c = getc(file);
   while (EOF != c) {
     if ('\n' == c) {
-      keybindings[keycount].name = calloc(commcount, sizeof(char));
+      keybindings[keycount].name = calloc(commcount + 1, sizeof(char));
       memcpy(keybindings[keycount].name, command, commcount);
       keybindings[keycount].key = key;
       keycount++;