*/
#include "angband.h"
+#include "sort.h"
* Some "local" parameters, used to help write savefiles
*/
-static FILE *fff; /* Current save "file" */
-
-static byte xor_byte; /* Simple encryption */
-
-static u32b v_stamp = 0L; /* A simple "checksum" on the actual values */
-static u32b x_stamp = 0L; /* A simple "checksum" on the encoded bytes */
+static FILE *fff; /* Current save "file" */
+static byte xor_byte; /* Simple encryption */
+static u32b v_stamp = 0L; /* A simple "checksum" on the actual values */
+static u32b x_stamp = 0L; /* A simple "checksum" on the encoded bytes */
* @param str 書き込む文字列
* @return なし
*/
-static void wr_string(cptr str)
+static void wr_string(concptr str)
{
while (*str)
{
/*** Write only un-obvious elements ***/
wr_s16b(o_ptr->k_idx);
- /* Location */
wr_byte((byte_hack)o_ptr->iy);
wr_byte((byte_hack)o_ptr->ix);
if (flags & SAVE_MON_SUB_ALIGN) wr_byte(m_ptr->sub_align);
if (flags & SAVE_MON_CSLEEP) wr_s16b(m_ptr->mtimed[MTIMED_CSLEEP]);
- wr_byte(m_ptr->mspeed);
+ wr_byte((byte)m_ptr->mspeed);
wr_s16b(m_ptr->energy_need);
if (flags & SAVE_MON_FAST)
wr_u32b(r_ptr->r_flags6);
wr_u32b(r_ptr->r_flagsr);
-
/* Monster limit per level */
wr_byte((byte_hack)r_ptr->max_num);
/*!
- * @brief 店舗情報を書き込む / Write a "store" record
+ * @brief セーブデータに店舗情報を書き込む / Write a "store" record
* @param st_ptr 店舗情報の参照ポインタ
* @return なし
*/
/*!
- * @brief 乱数情報を書き込む / Write RNG state
- * @return なし
+ * @brief セーブデータに乱数情報を書き込む / Write RNG state
+ * @return 常に0(成功を返す)
*/
static errr wr_randomizer(void)
{
int i;
-
- /* Zero */
wr_u16b(0);
-
- /* Place */
wr_u16b(Rand_place);
- /* State */
for (i = 0; i < RAND_DEG; i++)
{
wr_u32b(Rand_state[i]);
}
- /* Success */
return (0);
}
/*** Oops ***/
- /* Oops */
for (i = 0; i < 4; i++) wr_u32b(0L);
int i;
wr_byte(previous_char.psex);
- wr_byte(previous_char.prace);
- wr_byte(previous_char.pclass);
- wr_byte(previous_char.pseikaku);
+ wr_byte((byte_hack)previous_char.prace);
+ wr_byte((byte_hack)previous_char.pclass);
+ wr_byte((byte_hack)previous_char.pseikaku);
wr_byte((byte_hack)previous_char.realm1);
wr_byte((byte_hack)previous_char.realm2);
wr_s16b(previous_char.sc);
wr_s32b(previous_char.au);
- for (i = 0; i < 6; i++) wr_s16b(previous_char.stat_max[i]);
- for (i = 0; i < 6; i++) wr_s16b(previous_char.stat_max_max[i]);
+ for (i = 0; i < A_MAX; i++) wr_s16b(previous_char.stat_max[i]);
+ for (i = 0; i < A_MAX; i++) wr_s16b(previous_char.stat_max_max[i]);
for (i = 0; i < PY_MAX_LEVEL; i++) wr_s16b((s16b)previous_char.player_hp[i]);
byte tmp8u;
wr_string(p_ptr->name);
-
wr_string(p_ptr->died_from);
-
wr_string(p_ptr->last_message ? p_ptr->last_message : "");
save_quick_start();
}
/* Race/Class/Gender/Spells */
- wr_byte(p_ptr->prace);
- wr_byte(p_ptr->pclass);
- wr_byte(p_ptr->pseikaku);
- wr_byte(p_ptr->psex);
+ wr_byte((byte_hack)p_ptr->prace);
+ wr_byte((byte_hack)p_ptr->pclass);
+ wr_byte((byte_hack)p_ptr->pseikaku);
+ wr_byte((byte_hack)p_ptr->psex);
wr_byte((byte_hack)p_ptr->realm1);
wr_byte((byte_hack)p_ptr->realm2);
- wr_byte(0); /* oops */
+ wr_byte(0);
wr_byte((byte)p_ptr->hitdie);
wr_u16b(p_ptr->expfact);
wr_s16b(p_ptr->wt);
/* Dump the stats (maximum and current) */
- for (i = 0; i < 6; ++i) wr_s16b(p_ptr->stat_max[i]);
- for (i = 0; i < 6; ++i) wr_s16b(p_ptr->stat_max_max[i]);
- for (i = 0; i < 6; ++i) wr_s16b(p_ptr->stat_cur[i]);
+ for (i = 0; i < A_MAX; ++i) wr_s16b(p_ptr->stat_max[i]);
+ for (i = 0; i < A_MAX; ++i) wr_s16b(p_ptr->stat_max_max[i]);
+ for (i = 0; i < A_MAX; ++i) wr_s16b(p_ptr->stat_cur[i]);
/* Ignore the transient stats */
for (i = 0; i < 12; ++i) wr_s16b(0);
for (i = 0; i < 108; i++) wr_s32b(p_ptr->magic_num1[i]);
for (i = 0; i < 108; i++) wr_byte(p_ptr->magic_num2[i]);
- wr_byte(p_ptr->start_race);
+ wr_byte((byte_hack)p_ptr->start_race);
wr_s32b(p_ptr->old_race1);
wr_s32b(p_ptr->old_race2);
wr_s16b(p_ptr->old_realm);
wr_s16b((s16b)max_dlv[i]);
/* More info */
- wr_s16b(0); /* oops */
- wr_s16b(0); /* oops */
- wr_s16b(0); /* oops */
- wr_s16b(0); /* oops */
+ wr_s16b(0);
+ wr_s16b(0);
+ wr_s16b(0);
+ wr_s16b(0);
wr_s16b(p_ptr->sc);
wr_s16b(p_ptr->concent);
wr_u32b(p_ptr->special_defense);
wr_byte(p_ptr->knowledge);
wr_byte(p_ptr->autopick_autoregister);
- wr_byte(0); /* oops */
+ wr_byte(0);
wr_byte((byte_hack)p_ptr->action);
wr_byte(0);
wr_byte(preserve_mode);
for (i = 0; i < 12; i++) wr_u32b(0L);
/* Ignore some flags */
- wr_u32b(0L); /* oops */
- wr_u32b(0L); /* oops */
- wr_u32b(0L); /* oops */
+ wr_u32b(0L);
+ wr_u32b(0L);
+ wr_u32b(0L);
/* Write the "object seeds" */
saved_floor_type *cur_sf_ptr;
int i;
- /* Forget the lite */
forget_lite();
-
- /* Forget the view */
forget_view();
-
- /* Forget the view */
clear_mon_lite();
/* Update lite/view */
p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
-
- /* Update monsters */
p_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW);
-
/*** Meta info ***/
/* Number of floor_id used from birth */
* Medium level player saver
* @return 成功すればtrue
* @details
- * XXX XXX XXX Angband 2.8.0 will use "fd" instead of "fff" if possible
+ * Angband 2.8.0 will use "fd" instead of "fff" if possible
*/
static bool save_player_aux(char *name)
{
- bool ok = FALSE;
-
- int fd = -1;
-
- int mode = 0644;
-
+ bool ok = FALSE;
+ int fd = -1;
+ int mode = 0644;
/* No file yet */
fff = NULL;
-
/* File type is "SAVE" */
FILE_TYPE(FILE_TYPE_SAVE);
-
/* Grab permissions */
safe_setuid_grab();
struct stat statbuf;
#endif
- cptr what = "generic";
+ concptr what = "generic";
/* Paranoia */
#if !defined(MACINTOSH) && !defined(WINDOWS)
- /* XXX XXX XXX Fix this */
+ /* Fix this */
/* Verify the existance of the savefile */
if (access(savefile, 0) < 0)
/* Oops, lock exists */
if (fkk)
{
- /* Close the file */
my_fclose(fkk);
- /* Message */
msg_print(_("セーブファイルは現在使用中です。", "Savefile is currently in use."));
msg_print(NULL);
- /* Oops */
return (FALSE);
}
#endif
- /* Okay */
if (!err)
{
/* Open the savefile */
/* What */
if (err) what = _("セーブファイルを読めません。", "Cannot read savefile");
-
- /* Close the file */
(void)fd_close(fd);
}
z_patch = vvv[2];
sf_extra = vvv[3];
-
- /* Clear screen */
Term_clear();
/* Attempt to load */
if (sf_when > (statbuf.st_ctime + 100) ||
sf_when < (statbuf.st_ctime - 100))
{
- /* Message */
what = _("無効なタイム・スタンプです", "Invalid timestamp");
- /* Oops */
err = -1;
}
}
#endif
- /* Okay */
if (!err)
{
/* Give a conversion warning */
}
else
{
- /* Message */
-#ifdef JP
- msg_format("バージョン %d.%d.%d 用のセーブ・ファイルを変換しました。",
- (z_major > 9) ? z_major-10 : z_major , z_minor, z_patch);
-#else
- msg_format("Converted a %d.%d.%d savefile.",
+ msg_format(_("バージョン %d.%d.%d 用のセーブ・ファイルを変換しました。", "Converted a %d.%d.%d savefile."),
(z_major > 9) ? z_major-10 : z_major , z_minor, z_patch);
-#endif
}
msg_print(NULL);
}
{
/* A character was loaded */
character_loaded = TRUE;
-
- /* Done */
return (TRUE);
}
/* Count lives */
sf_lives++;
- /* Done */
return (TRUE);
}
#endif
+ msg_format(_("エラー(%s)がバージョン%d.%d.%d 用セーブファイル読み込み中に発生。", "Error (%s) reading %d.%d.%d savefile."),
+ what, (z_major>9) ? z_major - 10 : z_major, z_minor, z_patch);
- /* Message */
-#ifdef JP
- msg_format("エラー(%s)がバージョン%d.%d.%d 用セーブファイル読み込み中に発生。",
- what, (z_major>9) ? z_major - 10 : z_major, z_minor, z_patch);
-#else
- msg_format("Error (%s) reading %d.%d.%d savefile.",
- what, (z_major>9) ? z_major - 10 : z_major, z_minor, z_patch);
-#endif
msg_print(NULL);
- /* Oops */
return (FALSE);
}