From 7c90bc6b6624afc872eb29699b0ad01630bffba0 Mon Sep 17 00:00:00 2001 From: taotao54321 Date: Wed, 17 Feb 2021 22:17:23 +0900 Subject: [PATCH] =?utf8?q?[Fix]=20=E3=83=A2=E3=83=B3=E3=82=B9=E3=82=BF?= =?utf8?q?=E3=83=BC=E3=83=AA=E3=82=B9=E3=83=88=E3=82=A6=E3=82=A3=E3=83=B3?= =?utf8?q?=E3=83=89=E3=82=A6=E3=81=AE=E8=A1=8C=E6=95=B0=E4=B8=8D=E8=B6=B3?= =?utf8?q?=E5=88=A4=E5=AE=9A=E3=81=AE=20off-by-one=20=E3=82=A8=E3=83=A9?= =?utf8?q?=E3=83=BC=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/window/display-sub-windows.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/window/display-sub-windows.c b/src/window/display-sub-windows.c index cebf391af..2f5c79aa5 100644 --- a/src/window/display-sub-windows.c +++ b/src/window/display-sub-windows.c @@ -150,19 +150,22 @@ void print_monster_list(floor_type *floor_ptr, pos_list *plist, TERM_LEN x, TERM continue; //表示処理を次に回す } - // print last mons info + // last_mons と m_ptr が(見た目が)異なるなら、last_mons とその数を出力。 + // m_ptr を新たな last_mons とする。 print_monster_line(x, line++, last_mons, n_same); n_same = 1; last_mons = m_ptr; - if (line - y - 1 == max_lines) + + // 行数が足りなくなったら中断。 + if (line - y == max_lines) break; } - if (line - y - 1 == max_lines && i != plist->n) { - term_erase(0, line, 255); - term_gotoxy(x, line); + if (i != plist->n) { + // 行数が足りなかった場合、最終行にその旨表示。 term_addstr(-1, TERM_WHITE, "-- and more --"); } else { + // 行数が足りていれば last_mons とその数を出力し、残りの行をクリア。 if (last_mons) print_monster_line(x, line++, last_mons, n_same); for (; line < max_lines; line++) -- 2.11.0