#include "angband.h"
#include "util.h"
+#include "core.h"
+#include "load.h"
+#include "bldg.h"
+#include "report.h"
+
+#include "dungeon.h"
#include "feature.h"
#include "floor-generate.h"
#include "trap.h"
#include "wild.h"
#include "patron.h"
-#include "floor-save.h"
#include "floor.h"
+#include "floor-save.h"
+#include "floor-town.h"
#include "grid.h"
#include "cmd-pet.h"
#include "dungeon-file.h"
#include "files.h"
-
+#include "player-skill.h"
+#include "player-class.h"
+#include "player-race.h"
+#include "player-personality.h"
+#include "player-sex.h"
+#include "birth.h"
+#include "world.h"
+#include "objectkind.h"
+#include "object-ego.h"
+#include "save.h"
+#include "japanese.h"
+#include "realm-song.h"
+#include "cmd-smith.h"
/*
* Maximum number of tries for selection of a proper quest monster
static bool h_older_than(byte major, byte minor, byte patch, byte extra)
{
/* Much older, or much more recent */
- if (h_ver_major < major) return (TRUE);
- if (h_ver_major > major) return (FALSE);
+ if (current_world_ptr->h_ver_major < major) return (TRUE);
+ if (current_world_ptr->h_ver_major > major) return (FALSE);
/* Distinctly older, or distinctly more recent */
- if (h_ver_minor < minor) return (TRUE);
- if (h_ver_minor > minor) return (FALSE);
+ if (current_world_ptr->h_ver_minor < minor) return (TRUE);
+ if (current_world_ptr->h_ver_minor > minor) return (FALSE);
/* Barely older, or barely more recent */
- if (h_ver_patch < patch) return (TRUE);
- if (h_ver_patch > patch) return (FALSE);
+ if (current_world_ptr->h_ver_patch < patch) return (TRUE);
+ if (current_world_ptr->h_ver_patch > patch) return (FALSE);
/* Barely older, or barely more recent */
- if (h_ver_extra < extra) return (TRUE);
- if (h_ver_extra > extra) return (FALSE);
+ if (current_world_ptr->h_ver_extra < extra) return (TRUE);
+ if (current_world_ptr->h_ver_extra > extra) return (FALSE);
/* Identical versions */
return (FALSE);
static bool z_older_than(byte x, byte y, byte z)
{
/* Much older, or much more recent */
- if (z_major < x) return (TRUE);
- if (z_major > x) return (FALSE);
+ if (current_world_ptr->z_major < x) return (TRUE);
+ if (current_world_ptr->z_major > x) return (FALSE);
/* Distinctly older, or distinctly more recent */
- if (z_minor < y) return (TRUE);
- if (z_minor > y) return (FALSE);
+ if (current_world_ptr->z_minor < y) return (TRUE);
+ if (current_world_ptr->z_minor > y) return (FALSE);
/* Barely older, or barely more recent */
- if (z_patch < z) return (TRUE);
- if (z_patch > z) return (FALSE);
+ if (current_world_ptr->z_patch < z) return (TRUE);
+ if (current_world_ptr->z_patch > z) return (FALSE);
/* Identical versions */
return (FALSE);
rd_byte(&tmp8u);
m_ptr->mtimed[MTIMED_INVULNER] = (s16b)tmp8u;
- if (!(z_major == 2 && z_minor == 0 && z_patch == 6))
+ if (!(current_world_ptr->z_major == 2 && current_world_ptr->z_minor == 0 && current_world_ptr->z_patch == 6))
rd_u32b(&m_ptr->smart);
else
m_ptr->smart = 0;
}
/*!
- * @brief 店置きのアイテムオブジェクトを読み込む / Add the item "o_ptr" to the inventory of the "Home"
+ * @brief 店置きのアイテムオブジェクトを読み込む / Add the item "o_ptr" to the p_ptr->inventory_list of the "Home"
* @param st_ptr 店舗の参照ポインタ
* @param o_ptr アイテムオブジェクト参照ポインタ
* @return なし
else rd_s16b(&p_ptr->tsuyoshi);
/* Old savefiles do not have the following fields... */
- if ((z_major == 2) && (z_minor == 0) && (z_patch == 6))
+ if ((current_world_ptr->z_major == 2) && (current_world_ptr->z_minor == 0) && (current_world_ptr->z_patch == 6))
{
p_ptr->tim_esp = 0;
p_ptr->wraith_form = 0;
/* Hack -- the two "special seeds" */
- rd_u32b(&seed_flavor);
- rd_u32b(&seed_town);
+ rd_u32b(¤t_world_ptr->seed_flavor);
+ rd_u32b(¤t_world_ptr->seed_town);
/* Special stuff */
if (z_older_than(10, 3, 13))
{
- old_battle = current_world_ptr->game_turn;
+ current_world_ptr->arena_start_turn = current_world_ptr->game_turn;
}
- else rd_s32b(&old_battle);
+ else rd_s32b(¤t_world_ptr->arena_start_turn);
if (z_older_than(10,0,3))
{
/*!
- * @brief プレイヤーの所持品情報を読み込む / Read the player inventory
+ * @brief プレイヤーの所持品情報を読み込む / Read the player p_ptr->inventory_list
* @return なし
* @details
- * Note that the inventory changed in Angband 2.7.4. Two extra
+ * Note that the p_ptr->inventory_list changed in Angband 2.7.4. Two extra
* pack slots were added and the equipment was rearranged. Note
* that these two features combine when parsing old save-files, in
* which items from the old "aux" slot are "carried", perhaps into
- * one of the two new "inventory" slots.
+ * one of the two new "p_ptr->inventory_list" slots.
*
- * Note that the inventory is "re-sorted" later by "dungeon()".
+ * Note that the p_ptr->inventory_list is "re-sorted" later by "dungeon()".
*/
static errr rd_inventory(void)
{
p_ptr->total_weight = 0;
/* No items */
- inven_cnt = 0;
- equip_cnt = 0;
+ p_ptr->inven_cnt = 0;
+ p_ptr->equip_cnt = 0;
+
+ if (p_ptr->inventory_list != NULL) C_WIPE(p_ptr->inventory_list, INVEN_TOTAL, object_type);
+ C_MAKE(p_ptr->inventory_list, INVEN_TOTAL, object_type);
/* Read until done */
while (1)
if (n >= INVEN_RARM)
{
q_ptr->marked |= OM_TOUCHED;
- object_copy(&inventory[n], q_ptr);
+ object_copy(&p_ptr->inventory_list[n], q_ptr);
/* Add the weight */
p_ptr->total_weight += (q_ptr->number * q_ptr->weight);
/* One more item */
- equip_cnt++;
+ p_ptr->equip_cnt++;
}
/* Warning -- backpack is full */
- else if (inven_cnt == INVEN_PACK)
+ else if (p_ptr->inven_cnt == INVEN_PACK)
{
- note(_("持ち物の中のアイテムが多すぎる!", "Too many items in the inventory!"));
+ note(_("持ち物の中のアイテムが多すぎる!", "Too many items in the p_ptr->inventory_list!"));
/* Fail */
return (54);
}
- /* Carry inventory */
+ /* Carry p_ptr->inventory_list */
else
{
/* Get a slot */
n = slot++;
q_ptr->marked |= OM_TOUCHED;
- object_copy(&inventory[n], q_ptr);
+ object_copy(&p_ptr->inventory_list[n], q_ptr);
/* Add the weight */
p_ptr->total_weight += (q_ptr->number * q_ptr->weight);
/* One more item */
- inven_cnt++;
+ p_ptr->inven_cnt++;
}
}
/* The dungeon is ready */
if (z_older_than(10, 3, 13) && !current_floor_ptr->dun_level && !p_ptr->inside_arena)
- character_dungeon = FALSE;
+ current_world_ptr->character_dungeon = FALSE;
else
- character_dungeon = TRUE;
+ current_world_ptr->character_dungeon = TRUE;
/* Success */
return (0);
u32b tmp32u;
u16b limit;
- cave_template_type *templates;
+ grid_template_type *templates;
/*** Wipe all current_floor_ptr->grid_array ***/
rd_u16b(&limit);
/* Allocate the "template" array */
- C_MAKE(templates, limit, cave_template_type);
+ C_MAKE(templates, limit, grid_template_type);
/* Read the templates */
for (i = 0; i < limit; i++)
{
- cave_template_type *ct_ptr = &templates[i];
+ grid_template_type *ct_ptr = &templates[i];
/* Read it */
rd_u16b(&tmp16u);
}
/* Free the "template" array */
- C_KILL(templates, limit, cave_template_type);
+ C_KILL(templates, limit, grid_template_type);
/*** Objects ***/
}
/* The dungeon is ready */
- character_dungeon = TRUE;
+ current_world_ptr->character_dungeon = TRUE;
/* Success or Error */
return err;
strip_bytes(4);
/* Hack -- decrypt */
- xor_byte = sf_extra;
+ xor_byte = current_world_ptr->sf_extra;
/* Clear the checksums */
/* Read the version number of the savefile */
/* Old savefile will be version 0.0.0.3 */
- rd_byte(&h_ver_extra);
- rd_byte(&h_ver_patch);
- rd_byte(&h_ver_minor);
- rd_byte(&h_ver_major);
+ rd_byte(¤t_world_ptr->h_ver_extra);
+ rd_byte(¤t_world_ptr->h_ver_patch);
+ rd_byte(¤t_world_ptr->h_ver_minor);
+ rd_byte(¤t_world_ptr->h_ver_major);
/* Mention the savefile version */
note(format(
_("バージョン %d.%d.%d.%d のセーブ・ファイルをロード中...", "Loading a %d.%d.%d.%d savefile..."),
- (h_ver_major > 9) ? h_ver_major - 10 : h_ver_major, h_ver_minor, h_ver_patch, h_ver_extra));
+ (current_world_ptr->h_ver_major > 9) ? current_world_ptr->h_ver_major - 10 : current_world_ptr->h_ver_major, current_world_ptr->h_ver_minor, current_world_ptr->h_ver_patch, current_world_ptr->h_ver_extra));
/* Operating system info */
- rd_u32b(&sf_system);
+ rd_u32b(¤t_world_ptr->sf_system);
/* Time of savefile creation */
- rd_u32b(&sf_when);
+ rd_u32b(¤t_world_ptr->sf_when);
/* Number of resurrections */
- rd_u16b(&sf_lives);
+ rd_u16b(¤t_world_ptr->sf_lives);
/* Number of times played */
- rd_u16b(&sf_saves);
+ rd_u16b(¤t_world_ptr->sf_saves);
/* Later use (always zero) */
}
- /* Read the inventory */
+ /* Read the p_ptr->inventory_list */
if (rd_inventory())
{
- note(_("持ち物情報を読み込むことができません", "Unable to read inventory"));
+ note(_("持ち物情報を読み込むことができません", "Unable to read p_ptr->inventory_list"));
return (21);
}
/* Set the version number to current version */
/* Never load old temporal files */
- h_ver_extra = H_VER_EXTRA;
- h_ver_patch = H_VER_PATCH;
- h_ver_minor = H_VER_MINOR;
- h_ver_major = H_VER_MAJOR;
+ current_world_ptr->h_ver_extra = H_VER_EXTRA;
+ current_world_ptr->h_ver_patch = H_VER_PATCH;
+ current_world_ptr->h_ver_minor = H_VER_MINOR;
+ current_world_ptr->h_ver_major = H_VER_MAJOR;
/* Verify the sign */
rd_u32b(&tmp32u);
old_xor_byte = xor_byte;
old_v_check = v_check;
old_x_check = x_check;
- old_h_ver_major = h_ver_major;
- old_h_ver_minor = h_ver_minor;
- old_h_ver_patch = h_ver_patch;
- old_h_ver_extra = h_ver_extra;
+ old_h_ver_major = current_world_ptr->h_ver_major;
+ old_h_ver_minor = current_world_ptr->h_ver_minor;
+ old_h_ver_patch = current_world_ptr->h_ver_patch;
+ old_h_ver_extra = current_world_ptr->h_ver_extra;
}
/* floor savefile */
xor_byte = old_xor_byte;
v_check = old_v_check;
x_check = old_x_check;
- h_ver_major = old_h_ver_major;
- h_ver_minor = old_h_ver_minor;
- h_ver_patch = old_h_ver_patch;
- h_ver_extra = old_h_ver_extra;
+ current_world_ptr->h_ver_major = old_h_ver_major;
+ current_world_ptr->h_ver_minor = old_h_ver_minor;
+ current_world_ptr->h_ver_patch = old_h_ver_patch;
+ current_world_ptr->h_ver_extra = old_h_ver_extra;
}
/* Restore old knowledge */