OSDN Git Service

[Fix] *.rawの生成条件にαバージョンやセーブファイルバージョンの変更が含まれていない
authoriks <iks3@users.noreply.github.com>
Wed, 17 Mar 2021 15:28:15 +0000 (00:28 +0900)
committeriks <iks3@users.noreply.github.com>
Wed, 17 Mar 2021 15:28:15 +0000 (00:28 +0900)
src/main/angband-headers.h
src/main/info-initializer.cpp

index 9951d0c..24720cd 100644 (file)
@@ -9,28 +9,31 @@ typedef struct angband_header angband_header;
 typedef errr (*parse_info_txt_func)(char *buf, angband_header *head);
 
 struct angband_header {
-    byte v_major; /* Version -- major */
-    byte v_minor; /* Version -- minor */
-    byte v_patch; /* Version -- patch */
-    byte checksum; /* Version -- extra */
+    byte v_major; //!< Major version
+    byte v_minor; //!< Minor version
+    byte v_patch; //!< Patch version
+    byte checksum; //!< Checksum of "info" records
 
-    u16b info_num; /* Number of "info" records */
-    int info_len; /* Size of each "info" record */
-    u16b head_size; /* Size of the "header" in bytes */
+    u16b info_num; //!< このinfoのデータ数
+    int info_len; //!< このinfoの総サイズ
+    u16b head_size; //!< このinfoのヘッダサイズ
 
-    STR_OFFSET info_size; /* Size of the "info" array in bytes */
-    STR_OFFSET name_size; /* Size of the "name" array in bytes */
-    STR_OFFSET text_size; /* Size of the "text" array in bytes */
-    STR_OFFSET tag_size; /* Size of the "tag" array in bytes */
+    STR_OFFSET info_size; //!< info配列サイズ
+    STR_OFFSET name_size; //!< 名前文字列群サイズ(総文字長)
+    STR_OFFSET text_size; //!< フレーバー文字列群サイズ(総文字長)
+    STR_OFFSET tag_size; //!< タグ文字列群サイズ(総文字長)
 
-    void *info_ptr;
-    char *name_ptr;
-    char *text_ptr;
-    char *tag_ptr;
+    void *info_ptr; //!< info配列へのポインタ
+    char *name_ptr; //!< 名前文字列群へのポインタ
+    char *text_ptr; //!< フレーバー文字列群へのポインタ
+    char *tag_ptr; //!< タグ文字列群へのポインタ
 
-    parse_info_txt_func parse_info_txt;
+    parse_info_txt_func parse_info_txt; //!< Pointer to parser callback function
 
-    void (*retouch)(angband_header *head);
+    void (*retouch)(angband_header *head); //!< 設定再読み込み用?
+
+    byte v_extra; ///< Extra version for Alpha, Beta
+    byte v_savefile; ///< Savefile version
 };
 
 extern angband_header f_head;
index f38eccd..4aee7a9 100644 (file)
@@ -50,11 +50,12 @@ errr init_misc(player_type *player_ptr) { return parse_fixed_map(player_ptr, "mi
 static errr init_info_raw(int fd, angband_header *head)
 {
     angband_header test;
-    if (fd_read(fd, (char *)(&test), sizeof(angband_header)) || (test.v_major != head->v_major) || (test.v_minor != head->v_minor)
-        || (test.v_patch != head->v_patch) || (test.info_num != head->info_num) || (test.info_len != head->info_len) || (test.head_size != head->head_size)
-        || (test.info_size != head->info_size)) {
+    if (fd_read(fd, (char *)(&test), sizeof(angband_header))
+        || (test.v_major != head->v_major) || (test.v_minor != head->v_minor) || (test.v_patch != head->v_patch)
+        || (test.v_extra != head->v_extra) || (test.v_savefile != head->v_savefile)
+        || (test.head_size != head->head_size) || (test.info_size != head->info_size)
+        || (test.info_num != head->info_num) || (test.info_len != head->info_len))
         return -1;
-    }
 
     *head = test;
     C_MAKE(head->info_ptr, head->info_size, char);
@@ -112,6 +113,9 @@ static void init_header(angband_header *head, IDX num, int len)
 
     head->head_size = sizeof(angband_header);
     head->info_size = head->info_num * head->info_len;
+
+    head->v_extra = FAKE_VER_EXTRA;
+    head->v_savefile = SAVEFILE_VERSION;
 }
 
 /*!