OSDN Git Service

[Feature] 既知のユニーク・モンスター一覧表示で長いモンスター名を折り返す
authorHabu <habu1010+github@gmail.com>
Sun, 2 Oct 2022 13:30:19 +0000 (22:30 +0900)
committerHabu <habu1010+github@gmail.com>
Sun, 2 Oct 2022 13:30:19 +0000 (22:30 +0900)
知識の確認('~'コマンド)から表示できる「既知の生きているユニーク・モンスター」「既知の
撃破したユニーク・モンスター」の表示で長い名前のモンスターは右側にはみ出してしまうこと
があるので、折り返して表示するようにする。
それに伴い、モンスターのレベルや撃破した時のプレイヤーレベル・プレイ時間などの表示位置
が揃うようにする。

src/knowledge/knowledge-uniques.cpp

index 084eef9..8f7ff8a 100644 (file)
@@ -14,6 +14,7 @@
 #include "system/player-type-definition.h"
 #include "util/angband-files.h"
 #include "util/sort.h"
+#include "util/string-processor.h"
 
 struct unique_list_type {
     bool is_alive;
@@ -126,7 +127,11 @@ static void display_uniques(unique_list_type *unique_list_ptr, FILE *fff)
             buf[0] = '\0';
         }
 
-        fprintf(fff, _("     %s (レベル%d)%s\n", "     %s (level %d)%s\n"), r_ptr->name.c_str(), (int)r_ptr->level, buf);
+        const auto name = str_separate(r_ptr->name, 40);
+        fprintf(fff, _("     %-40s (レベル%3d)%s\n", "     %-40s (level %3d)%s\n"), name.front().c_str(), (int)r_ptr->level, buf);
+        for (auto i = 1U; i < name.size(); ++i) {
+            fprintf(fff, "     %s\n", name[i].c_str());
+        }
     }
 }