OSDN Git Service

[Fix] Linx/Mac版で徳の実値表示がおかしい
authoriks <iks3@users.noreply.github.com>
Thu, 8 Apr 2021 13:54:10 +0000 (22:54 +0900)
committeriks <iks3@users.noreply.github.com>
Thu, 8 Apr 2021 13:54:10 +0000 (22:54 +0900)
src/io-dump/character-dump.cpp
src/knowledge/knowledge-self.cpp
src/player-info/avatar.cpp
src/player/player-status.cpp
src/player/player-status.h
src/view/display-player.cpp
src/view/display-self-info.cpp

index 960e52f..c26514c 100644 (file)
@@ -38,6 +38,7 @@
 #include "util/sort.h"
 #include "view/display-messages.h"
 #include "world/world.h"
+#include <string>
 
 /*!
  * @brief プレイヤーのペット情報をファイルにダンプする
@@ -438,7 +439,8 @@ static void dump_aux_virtues(player_type *creature_ptr, FILE *fff)
             fprintf(fff, "%s ???\n", stat_names[v_nr]);
     }
 
-    fprintf(fff, _("\n属性 : %s\n", "\nYour alignment : %s\n"), your_alignment(creature_ptr));
+    std::string alg = your_alignment(creature_ptr);
+    fprintf(fff, _("\n属性 : %s\n", "\nYour alignment : %s\n"), alg.c_str());
     fprintf(fff, "\n");
     dump_virtues(creature_ptr, fff);
 }
index 079fe54..721cb9e 100644 (file)
@@ -21,6 +21,7 @@
 #include "util/buffer-shaper.h"
 #include "util/int-char-converter.h"
 #include "world/world.h"
+#include <string>
 
 /*
  * List virtues & status
@@ -32,7 +33,8 @@ void do_cmd_knowledge_virtues(player_type *creature_ptr)
     if (!open_temporary_file(&fff, file_name))
         return;
 
-    fprintf(fff, _("現在の属性 : %s\n\n", "Your alignment : %s\n\n"), your_alignment(creature_ptr));
+    std::string alg = your_alignment(creature_ptr);
+    fprintf(fff, _("現在の属性 : %s\n\n", "Your alignment : %s\n\n"), alg.c_str());
     dump_virtues(creature_ptr, fff);
     angband_fclose(fff);
     (void)show_file(creature_ptr, TRUE, file_name, _("八つの徳", "Virtues"), 0, 0);
index 69aa538..22c2cf6 100644 (file)
@@ -525,7 +525,7 @@ void dump_virtues(player_type *creature_ptr, FILE *out_file)
         GAME_TEXT vir_name[20];
         int tester = creature_ptr->virtues[v_nr];
         strcpy(vir_name, virtue[(creature_ptr->vir_types[v_nr]) - 1]);
-        concptr vir_val = show_actual_value ? format(_("(%d)", " (%d)"), tester) : "";
+        concptr vir_val = show_actual_value ? format(" (%d)", tester) : "";
         if (creature_ptr->vir_types[v_nr] == 0 || creature_ptr->vir_types[v_nr] > MAX_VIRTUE)
             fprintf(out_file, _("おっと。%sの情報なし。", "Oops. No info about %s."), vir_name);
 
index 4a71f2a..13dc4bc 100644 (file)
@@ -178,11 +178,11 @@ concptr alignment_label(player_type *creature_ptr)
  * @param creature_ptr 算出するクリーチャーの参照ポインタ。
  * @return アライメントの表記を返す。
  */
-concptr your_alignment(player_type *creature_ptr)
+concptr your_alignment(player_type *creature_ptr, bool with_value)
 {
     auto s = alignment_label(creature_ptr);
-    if (show_actual_value)
-        return format(_("%s(%ld)", "%s (%ld)"), s, creature_ptr->align);
+    if (with_value || show_actual_value)
+        return format(_("%s(%ld)", "%s (%ld)"), s, static_cast<long>(creature_ptr->align));
 
     return s;
 }
index daf1ae5..62bd2b5 100644 (file)
@@ -471,7 +471,7 @@ typedef struct player_type {
 
 extern player_type *p_ptr;
 
-extern concptr your_alignment(player_type *creature_ptr);
+extern concptr your_alignment(player_type *creature_ptr, bool with_value = false);
 extern int weapon_exp_level(int weapon_exp);
 extern int riding_exp_level(int riding_exp);
 extern int spell_exp_level(int spell_exp);
index 36ae037..e80984b 100644 (file)
@@ -36,6 +36,7 @@
 #include "view/display-player-stat-info.h"
 #include "view/display-util.h"
 #include "world/world.h"
+#include <string>
 
 /*!
  * @brief
@@ -125,7 +126,8 @@ static void display_phisique(player_type *creature_ptr)
     display_player_one_line(ENTRY_WEIGHT, format("%d", (int)creature_ptr->wt), TERM_L_BLUE);
     display_player_one_line(ENTRY_SOCIAL, format("%d", (int)creature_ptr->sc), TERM_L_BLUE);
 #endif
-    display_player_one_line(ENTRY_ALIGN, format("%s", your_alignment(creature_ptr)), TERM_L_BLUE);
+    std::string alg = your_alignment(creature_ptr);
+    display_player_one_line(ENTRY_ALIGN, format("%s", alg.c_str()), TERM_L_BLUE);
 }
 
 /*!
index 55266b4..4b85111 100644 (file)
@@ -5,6 +5,7 @@
 #include "player/player-race.h"
 #include "player/player-status-table.h"
 #include "term/screen-processor.h"
+#include <string>
 
 void display_life_rating(player_type *creature_ptr, self_info_type *self_ptr)
 {
@@ -32,7 +33,8 @@ void display_max_base_status(player_type *creature_ptr, self_info_type *self_ptr
 void display_virtue(player_type *creature_ptr, self_info_type *self_ptr)
 {
     self_ptr->info[self_ptr->line++] = "";
-    sprintf(self_ptr->plev_buf, _("現在の属性 : %s(%ld)", "Your alignment : %s(%ld)"), your_alignment(creature_ptr), (long int)creature_ptr->align);
+    std::string alg = your_alignment(creature_ptr, true);
+    sprintf(self_ptr->plev_buf, _("現在の属性 : %s", "Your alignment : %s"), alg.c_str());
     strcpy(self_ptr->buf[1], self_ptr->plev_buf);
     self_ptr->info[self_ptr->line++] = self_ptr->buf[1];
     for (int v_nr = 0; v_nr < 8; v_nr++) {