OSDN Git Service

Merge branch 'refactor-fix/For2.2.2-habu' into For2.2.2-Refactoring
authordeskull <deskull@users.sourceforge.jp>
Mon, 20 Apr 2020 15:22:27 +0000 (00:22 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Mon, 20 Apr 2020 15:22:27 +0000 (00:22 +0900)
1  2 
Hengband_vcs2017/Hengband/Hengband.vcxproj
Hengband_vcs2017/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/cmd/cmd-dump.c
src/object2.c
src/store.c

diff --cc src/Makefile.am
Simple merge
  #include "angband.h"
  #include "cmd/cmd-draw.h"
  #include "cmd/cmd-dump.h"
 +#include "cmd/cmd-inventory.h"
  #include "cmd/lighting-level-table.h"
  #include "cmd/cmd-visuals.h"
- #include "term.h"
+ #include "gameterm.h"
  #include "core.h" // 暫定。後で消す.
  #include "core/show-file.h"
  #include "io/read-pref-file.h"
@@@ -83,131 -82,7 +83,130 @@@ static SYMBOL_CODE char_idx_feat[F_LIT_
  // Encode the screen colors
  static char hack[17] = "dwsorgbuDWvyRGBU";
  
 +/*!
 + * @brief prefファイルを選択して処理する /
 + * Ask for a "user pref line" and process it
 + * @brief prf出力内容を消去する /
 + * Remove old lines automatically generated before.
 + * @param orig_file 消去を行うファイル名
 + */
 +static void remove_auto_dump(concptr orig_file, concptr auto_dump_mark)
 +{
 +      FILE *tmp_fff, *orig_fff;
 +      char tmp_file[1024];
 +      char buf[1024];
 +      bool between_mark = FALSE;
 +      bool changed = FALSE;
 +      int line_num = 0;
 +      long header_location = 0;
 +      char header_mark_str[80];
 +      char footer_mark_str[80];
 +
 +      sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
 +      sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
 +      size_t mark_len = strlen(footer_mark_str);
 +      orig_fff = my_fopen(orig_file, "r");
 +      if (!orig_fff) return;
 +
 +      tmp_fff = my_fopen_temp(tmp_file, 1024);
 +      if (!tmp_fff)
 +      {
 +              msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), tmp_file);
 +              msg_print(NULL);
 +              return;
 +      }
 +
 +      while (TRUE)
 +      {
 +              if (my_fgets(orig_fff, buf, sizeof(buf)))
 +              {
 +                      if (between_mark)
 +                      {
 +                              fseek(orig_fff, header_location, SEEK_SET);
 +                              between_mark = FALSE;
 +                              continue;
 +                      }
 +                      else
 +                      {
 +                              break;
 +                      }
 +              }
 +
 +              if (!between_mark)
 +              {
 +                      if (!strcmp(buf, header_mark_str))
 +                      {
 +                              header_location = ftell(orig_fff);
 +                              line_num = 0;
 +                              between_mark = TRUE;
 +                              changed = TRUE;
 +                      }
 +                      else
 +                      {
 +                              fprintf(tmp_fff, "%s\n", buf);
 +                      }
 +
 +                      continue;
 +              }
 +
 +              if (!strncmp(buf, footer_mark_str, mark_len))
 +              {
 +                      int tmp;
 +                      if (!sscanf(buf + mark_len, " (%d)", &tmp)
 +                              || tmp != line_num)
 +                      {
 +                              fseek(orig_fff, header_location, SEEK_SET);
 +                      }
 +
 +                      between_mark = FALSE;
 +                      continue;
 +              }
 +
 +              line_num++;
 +      }
 +
 +      my_fclose(orig_fff);
 +      my_fclose(tmp_fff);
 +
 +      if (changed)
 +      {
 +              tmp_fff = my_fopen(tmp_file, "r");
 +              orig_fff = my_fopen(orig_file, "w");
 +              while (!my_fgets(tmp_fff, buf, sizeof(buf)))
 +                      fprintf(orig_fff, "%s\n", buf);
 +
 +              my_fclose(orig_fff);
 +              my_fclose(tmp_fff);
 +      }
 +
 +      fd_kill(tmp_file);
 +}
 +
 +
 +#ifdef JP
 +#else
 +/*!
 + * @brief Return suffix of ordinal number
 + * @param num number
 + * @return pointer of suffix string.
 + */
 +concptr get_ordinal_number_suffix(int num)
 +{
 +      num = ABS(num) % 100;
 +      switch (num % 10)
 +      {
 +      case 1:
 +              return (num == 11) ? "th" : "st";
 +      case 2:
 +              return (num == 12) ? "th" : "nd";
 +      case 3:
 +              return (num == 13) ? "th" : "rd";
 +      default:
 +              return "th";
 +      }
 +}
 +#endif
  
  /*!
   * @brief 画面を再描画するコマンドのメインルーチン
   * Hack -- redraw the screen
diff --cc src/object2.c
Simple merge
diff --cc src/store.c
Simple merge