p_ptr->arena_number = 0;
p_ptr->inside_arena = FALSE;
p_ptr->inside_quest = 0;
- p_ptr->leftbldg = FALSE;
for (i = 0; i < MAX_MANE; i++)
{
p_ptr->mane_spell[i] = -1;
if (get_check("Do you fight? "))
#endif
{
- p_ptr->leftbldg = TRUE;
p_ptr->exit_bldg = FALSE;
reset_tim_flags();
- /* Save the surface floor to preserve pets */
- prepare_change_floor_mode(CFM_SAVE_SURFACE);
+ /* Save the surface floor as saved floor */
+ /* prepare_change_floor_mode(0); */
p_ptr->inside_arena = TRUE;
p_ptr->leaving = TRUE;
}
else
{
- p_ptr->leftbldg = TRUE;
p_ptr->exit_bldg = FALSE;
reset_tim_flags();
- /* Save the surface floor to preserve pets */
- prepare_change_floor_mode(CFM_SAVE_SURFACE);
+ /* Save the surface floor as saved floor */
+ /* prepare_change_floor_mode(0); */
p_ptr->inside_arena = TRUE;
p_ptr->leaving = TRUE;
battle_odds = MAX(wager+1, wager * battle_odds / 100);
kakekin = wager;
p_ptr->au -= wager;
- p_ptr->leftbldg = TRUE;
reset_tim_flags();
- /* Save the surface floor to preserve pets */
- prepare_change_floor_mode(CFM_SAVE_SURFACE);
+ /* Save the surface floor as saved floor */
+ /* prepare_change_floor_mode(0); */
p_ptr->inside_battle = TRUE;
p_ptr->leaving = TRUE;
#endif
}
}
-
- p_ptr->leftbldg = TRUE;
}
break;
}
}
}
- p_ptr->leftbldg = TRUE;
+
+ /* Clear all saved floors */
+ prepare_change_floor_mode(CFM_CLEAR_ALL);
+
p_ptr->leaving = TRUE;
leave_bldg = TRUE;
p_ptr->teleport_town = TRUE;
leave_quest_check();
+ if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM) dun_level = 1;
p_ptr->inside_quest = cave[py][px].special;
- if(quest[leaving_quest].type != QUEST_TYPE_RANDOM) dun_level = 1;
- p_ptr->leftbldg = TRUE;
+
+ /* Clear all saved floors */
+ prepare_change_floor_mode(CFM_CLEAR_ALL);
+
p_ptr->leaving = TRUE;
}
}
}
else if ((which == 2) && p_ptr->inside_arena)
{
- /* Restore the surface floor to preserve pets */
- prepare_change_floor_mode(CFM_SAVE_SURFACE | CFM_NO_RETURN);
+ /* Don't save the arena as saved floor */
+ prepare_change_floor_mode(CFM_NO_RETURN);
p_ptr->inside_arena = FALSE;
p_ptr->leaving = TRUE;
}
else if (p_ptr->inside_battle)
{
- /* Restore the surface floor to preserve pets */
- prepare_change_floor_mode(CFM_SAVE_SURFACE | CFM_NO_RETURN);
+ /* Don't save the arena as saved floor */
+ prepare_change_floor_mode(CFM_NO_RETURN);
p_ptr->leaving = TRUE;
p_ptr->inside_battle = FALSE;
/* Reinit wilderness to activate quests ... */
if (reinit_wilderness)
+ {
+ /* Clear all saved floors */
+ prepare_change_floor_mode(CFM_CLEAR_ALL);
+
p_ptr->leaving = TRUE;
+ }
/* Hack -- Decrease "icky" depth */
character_icky--;
ambush_flag = FALSE;
}
- p_ptr->leftbldg = TRUE;
+ /* Clear all saved floors */
+ prepare_change_floor_mode(CFM_CLEAR_ALL);
+
p_ptr->leaving = TRUE;
energy_use = 100;
dun_level = 0;
p_ptr->oldpx = 0;
p_ptr->oldpy = 0;
+
+ /* Clear all saved floors */
+ prepare_change_floor_mode(CFM_CLEAR_ALL);
+
p_ptr->leaving = TRUE;
}
dun_level = 0;
}
+ /* Clear all saved floors */
+ prepare_change_floor_mode(CFM_CLEAR_ALL);
+
/* Leaving */
p_ptr->leaving = TRUE;
- p_ptr->leftbldg = TRUE;
p_ptr->oldpx = 0;
p_ptr->oldpy = 0;
if (autosave_l) do_cmd_save_game(TRUE);
- if (p_ptr->inside_quest)
+ /* For a random quest */
+ if (p_ptr->inside_quest &&
+ quest[p_ptr->inside_quest].type == QUEST_TYPE_RANDOM)
{
leave_quest_check();
- if (quest[leaving_quest].type != QUEST_TYPE_RANDOM)
- {
- p_ptr->inside_quest = c_ptr->special;
- dun_level = 0;
- }
- else
- {
- p_ptr->inside_quest = 0;
- }
+ p_ptr->inside_quest = 0;
+ }
+ /* For a fixed quest */
+ if (p_ptr->inside_quest &&
+ quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM)
+ {
+ leave_quest_check();
+
+ p_ptr->inside_quest = c_ptr->special;
+ dun_level = 0;
up_num = 0;
}
+
+ /* For normal dungeon and random quest */
else
{
/* New depth */
dun_level = 0;
}
+ /* Clear all saved floors */
+ prepare_change_floor_mode(CFM_CLEAR_ALL);
+
/* Leaving */
p_ptr->leaving = TRUE;
- p_ptr->leftbldg = TRUE;
p_ptr->oldpx = 0;
p_ptr->oldpy = 0;
dun_level = 0;
p_ptr->oldpx = 0;
p_ptr->oldpy = 0;
+
+ /* Clear all saved floors */
+ prepare_change_floor_mode(CFM_CLEAR_ALL);
+
p_ptr->leaving = TRUE;
}
}
{
if (autosave_l) do_cmd_save_game(TRUE);
+ /* Clear all saved floors */
+ prepare_change_floor_mode(CFM_CLEAR_ALL);
+
/* Leaving */
p_ptr->leaving = TRUE;
}
#define CFM_RAND_CONNECT 0x0040 /* Connect with random stairs */
#define CFM_CLEAR_ALL 0x0080 /* Reach to the surface/Recall/Alter reality */
#define CFM_NO_RETURN 0x0100 /* Flee from random quest etc... */
-#define CFM_SAVE_SURFACE 0x0200 /* Save surface level (for arena) */
/*
/* Change level */
dun_level = command_arg;
- prepare_change_floor_mode(CFM_CLEAR_ALL);
leave_quest_check();
if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE,0,NULL);
p_ptr->inside_quest = 0;
- p_ptr->leftbldg = FALSE;
energy_use = 0;
+ /* Clear all saved floors */
+ prepare_change_floor_mode(CFM_CLEAR_ALL);
+
/* Leaving */
p_ptr->leaving = TRUE;
}
dun_level = 0;
dungeon_type = 0;
- prepare_change_floor_mode(CFM_CLEAR_ALL);
leave_quest_check();
p_ptr->inside_quest = 0;
+
+ /* Clear all saved floors */
+ prepare_change_floor_mode(CFM_CLEAR_ALL);
+
p_ptr->leaving = TRUE;
}
else
}
p_ptr->wild_mode = FALSE;
+ /* Clear all saved floors */
prepare_change_floor_mode(CFM_CLEAR_ALL);
/* Leaving */
msg_print("The world changes!");
#endif
+ /* Clear all saved floors */
prepare_change_floor_mode(CFM_CLEAR_ALL);
/* Leaving */
/* Leaving */
p_ptr->wild_mode = FALSE;
+
+ /* Clear all saved floors */
+ prepare_change_floor_mode(CFM_CLEAR_ALL);
+
p_ptr->leaving = TRUE;
#ifdef JP
chg_virtue(V_SACRIFICE, 10);
+ /* Clear all saved floors */
+ prepare_change_floor_mode(CFM_CLEAR_ALL);
+
/* Leaving */
p_ptr->leaving = TRUE;
new_floor_id = 0;
- /* From somewhere of the surface to somewhere of the surface */
- if (!dungeon_type)
+ if (!p_ptr->floor_id)
{
- if (change_floor_mode & CFM_SAVE_SURFACE)
+ if (change_floor_mode & (CFM_NO_RETURN | CFM_CLEAR_ALL))
{
- /* Save surface floor to preserve pets (for Arena) */
- if (!p_ptr->floor_id)
- {
- /* Get temporal floor_id */
- p_ptr->floor_id = get_new_floor_id();
-
- /* Record the dungeon level */
- get_sf_ptr(p_ptr->floor_id)->dun_level = dun_level;
- }
+ /* No need to save current floor */
+ return;
}
else
{
- /* No need to save current floor */
- return;
+ /* Get temporal floor_id */
+ p_ptr->floor_id = get_new_floor_id();
+
+ /* Record the dungeon level */
+ get_sf_ptr(p_ptr->floor_id)->dun_level = dun_level;
}
}
+
/* Search the quest monster index */
for (i = 0; i < max_quests; i++)
{
c_ptr = &cave[py][px];
/* Get back to old saved floor? */
- if ((dun_level || (change_floor_mode & CFM_SAVE_SURFACE))
- && c_ptr->special && get_sf_ptr(c_ptr->special))
+ if (c_ptr->special && get_sf_ptr(c_ptr->special))
{
/* Saved floor is exist. Use it. */
new_floor_id = c_ptr->special;
/* Mega-Hack -- not ambushed on the wildness? */
ambush_flag = FALSE;
- /* On the surface */
- if (!dungeon_type && !(change_floor_mode & CFM_SAVE_SURFACE))
+ /* No saved floors (On the surface etc.) */
+ if (change_floor_mode & CFM_CLEAR_ALL)
{
/* Create cave */
generate_cave();
- /* Paranoia -- Now on the surface */
+ /* Paranoia -- No new saved floor */
new_floor_id = 0;
}
/* Set correct dun_level value */
sf_ptr->dun_level = dun_level;
- /* Creat connected stairs */
- if (!(change_floor_mode & (CFM_NO_RETURN | CFM_CLEAR_ALL))
- && (dun_level || (change_floor_mode & CFM_SAVE_SURFACE)))
+ /* Create connected stairs */
+ if (!(change_floor_mode & (CFM_NO_RETURN | CFM_CLEAR_ALL)))
{
- bool ok = TRUE;
-
/* Extract stair position */
cave_type *c_ptr = &cave[py][px];
c_ptr->feat = FEAT_LESS;
}
- /* Enter to/leave the Arena */
- else if (change_floor_mode & CFM_SAVE_SURFACE)
- {
- /* Nothing to do */
- }
-
- else
- {
- /* Hum??? */
- ok = FALSE;
- }
-
- if (ok)
- {
- /* Paranoia -- Clear mimic */
- c_ptr->mimic = 0;
+ /* Paranoia -- Clear mimic */
+ c_ptr->mimic = 0;
- /* Connect to previous floor */
- c_ptr->special = p_ptr->floor_id;
- }
+ /* Connect to previous floor */
+ c_ptr->special = p_ptr->floor_id;
}
}
p_ptr->inside_battle = (bool)tmp16s;
}
rd_byte(&p_ptr->exit_bldg);
- rd_byte(&p_ptr->leftbldg);
+ rd_byte(&tmp8u);
rd_s16b(&p_ptr->oldpx);
rd_s16b(&p_ptr->oldpy);
/* Number of the saved_floors array elements */
rd_byte(&num);
- /*** On the surface ***/
+ /*** No saved floor (On the surface etc.) ***/
if (!num)
{
- /* It should be 0 */
- if (num) err = 181;
-
/* Read the current floor data */
err = rd_saved_floor(NULL);
}
#endif
break;
- case 181:
-#ifdef JP
- note("Error 181");
-#else
- note("Error 181");
-#endif
- break;
-
case 182:
#ifdef JP
note("¥Æ¥ó¥Ý¥é¥ê¡¦¥Õ¥¡¥¤¥ë¤òºîÀ®¤Ç¤¤Þ¤»¤ó¡ª");
#endif
-#if 0
- /*
- * Initialize arena and rewards information
- */
- p_ptr->arena_number = 0;
- p_ptr->inside_arena = 0;
- p_ptr->inside_quest = 0;
- p_ptr->leftbldg = FALSE;
- p_ptr->exit_bldg = TRUE;
-
- /* Start in town 1 */
- p_ptr->town_num = 1;
-
- p_ptr->wilderness_x = 4;
- p_ptr->wilderness_y = 4;
-
-#endif
-
/* Init the wilderness seeds */
for (i = 0; i < max_wild_x; i++)
{
wr_s16b(p_ptr->inside_quest);
wr_s16b(p_ptr->inside_battle);
wr_byte(p_ptr->exit_bldg);
- wr_byte(p_ptr->leftbldg); /* save building leave status -KMW- */
+ wr_byte(0); /* Unused */
wr_s16b(p_ptr->oldpx);
wr_s16b(p_ptr->oldpy);
wr_byte(dungeon_type);
- /*** On the surface ***/
+ /*** No saved floor (On the surface etc.) ***/
if (!p_ptr->floor_id)
{
/* No array elements */
bool leaving; /* True if player is leaving */
byte exit_bldg; /* Goal obtained in arena? -KMW- */
- byte leftbldg; /* did we just leave a special area? -KMW- */
bool leaving_dungeon; /* True if player is leaving the dungeon */
bool teleport_town;
}
player_place(p_ptr->oldpy, p_ptr->oldpx);
- p_ptr->leftbldg = FALSE;
/* p_ptr->leaving_dungeon = FALSE;*/
lim = (generate_encounter==TRUE)?40:MIN_M_ALLOC_TN;
p_ptr->wild_mode = !p_ptr->wild_mode;
+ /* Clear all saved floors */
+ prepare_change_floor_mode(CFM_CLEAR_ALL);
+
/* Leaving */
p_ptr->leaving = TRUE;
if (record_stair) do_cmd_write_nikki(NIKKI_WIZ_TELE,0,NULL);
p_ptr->inside_quest = 0;
- p_ptr->leftbldg = FALSE;
energy_use = 0;
/* Prevent energy_need from being too lower than 0 */