#include "angband.h"
#include "cmd-activate.h"
#include "cmd-eat.h"
+#include "cmd-hissatsu.h"
#include "cmd-item.h"
#include "cmd-magiceat.h"
+#include "cmd-mane.h"
#include "cmd-quaff.h"
#include "cmd-read.h"
+#include "cmd-smith.h"
#include "cmd-usestaff.h"
#include "cmd-zaprod.h"
#include "cmd-zapwand.h"
#include "cmd-pet.h"
#include "floor.h"
#include "floor-events.h"
+#include "grid.h"
#include "object-curse.h"
#include "store.h"
#include "spells-summon.h"
#include "quest.h"
#include "artifact.h"
#include "avatar.h"
+#include "player-move.h"
#include "player-status.h"
#include "cmd-spell.h"
#include "realm-hex.h"
#include "object-hook.h"
#include "wild.h"
+#include "monster-status.h"
+#include "floor-save.h"
static bool load = TRUE; /*!<ロード処理中の分岐フラグ*/
{
return;
}
-
- /* Paranoia */
if (command_arg < min_level) command_arg = (COMMAND_ARG)min_level;
-
- /* Paranoia */
if (command_arg > max_level) command_arg = (COMMAND_ARG)max_level;
/* Accept request */
* and create a first saved floor
*/
prepare_change_floor_mode(CFM_FIRST_FLOOR);
-
- /* Leaving */
p_ptr->leaving = TRUE;
}
/*!
- * @brief 種族アンバライトが出血時パターンの上に乗った際のペナルティ処理
- * @return なし
- */
-static void wreck_the_pattern(void)
-{
- int to_ruin = 0;
- POSITION r_y, r_x;
- int pattern_type = f_info[current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].feat].subtype;
-
- if (pattern_type == PATTERN_TILE_WRECKED)
- {
- /* Ruined already */
- return;
- }
-
- msg_print(_("パターンを血で汚してしまった!", "You bleed on the Pattern!"));
- msg_print(_("何か恐ろしい事が起こった!", "Something terrible happens!"));
-
- if (!IS_INVULN()) take_hit(DAMAGE_NOESCAPE, damroll(10, 8), _("パターン損壊", "corrupting the Pattern"), -1);
- to_ruin = randint1(45) + 35;
-
- while (to_ruin--)
- {
- scatter(&r_y, &r_x, p_ptr->y, p_ptr->x, 4, 0);
-
- if (pattern_tile(r_y, r_x) &&
- (f_info[current_floor_ptr->grid_array[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED))
- {
- cave_set_feat(r_y, r_x, feat_pattern_corrupted);
- }
- }
-
- cave_set_feat(p_ptr->y, p_ptr->x, feat_pattern_corrupted);
-}
-
-/*!
* @brief 各種パターン地形上の特別な処理 / Returns TRUE if we are on the Pattern...
* @return 実際にパターン地形上にプレイヤーが居た場合はTRUEを返す。
*/
monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
- /* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Allow regeneration (if needed) */
if (m_ptr->hp < m_ptr->maxhp)
}
}
-/*!
- * @brief クエスト階層から離脱する際の処理
- * @return なし
- */
-void leave_quest_check(void)
-{
- /* Save quest number for dungeon pref file ($LEAVING_QUEST) */
- leaving_quest = p_ptr->inside_quest;
-
- /* Leaving an 'only once' quest marks it as failed */
- if (leaving_quest)
- {
- quest_type* const q_ptr = &quest[leaving_quest];
-
- if(((q_ptr->flags & QUEST_FLAG_ONCE) || (q_ptr->type == QUEST_TYPE_RANDOM)) &&
- (q_ptr->status == QUEST_STATUS_TAKEN))
- {
- q_ptr->status = QUEST_STATUS_FAILED;
- q_ptr->complev = p_ptr->lev;
- update_playtime();
- q_ptr->comptime = playtime;
-
- /* Additional settings */
- switch (q_ptr->type)
- {
- case QUEST_TYPE_TOWER:
- quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
- quest[QUEST_TOWER1].complev = p_ptr->lev;
- break;
- case QUEST_TYPE_FIND_ARTIFACT:
- a_info[q_ptr->k_idx].gen_flags &= ~(TRG_QUESTITEM);
- break;
- case QUEST_TYPE_RANDOM:
- r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
-
- /* Floor of random quest will be blocked */
- prepare_change_floor_mode(CFM_NO_RETURN);
- break;
- }
-
- /* Record finishing a quest */
- if (q_ptr->type == QUEST_TYPE_RANDOM)
- {
- if (record_rand_quest) do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
- }
- else
- {
- if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
- }
- }
- }
-}
-
-/*!
- * @brief 「塔」クエストの各階層から離脱する際の処理
- * @return なし
- */
-void leave_tower_check(void)
-{
- leaving_quest = p_ptr->inside_quest;
- /* Check for Tower Quest */
- if (leaving_quest &&
- (quest[leaving_quest].type == QUEST_TYPE_TOWER) &&
- (quest[QUEST_TOWER1].status != QUEST_STATUS_COMPLETED))
- {
- if(quest[leaving_quest].type == QUEST_TYPE_TOWER)
- {
- quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
- quest[QUEST_TOWER1].complev = p_ptr->lev;
- update_playtime();
- quest[QUEST_TOWER1].comptime = playtime;
- }
- }
-}
-
/*!
* @brief !!を刻んだ魔道具の時間経過による再充填を知らせる処理 / If player has inscribed the object with "!!", let him know when it's recharged. -LM-
{
monster_type *m_ptr = ¤t_floor_ptr->m_list[monster];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
- /* Paranoia -- Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
if (r_ptr->level >= p_ptr->lev)
{
* and create a first saved floor
*/
prepare_change_floor_mode(CFM_FIRST_FLOOR);
-
- /* Leaving */
p_ptr->leaving = TRUE;
if (p_ptr->dungeon_idx == DUNGEON_ANGBAND)
q_ptr->status = QUEST_STATUS_FAILED;
q_ptr->complev = (byte)p_ptr->lev;
update_playtime();
- q_ptr->comptime = playtime;
+ q_ptr->comptime = current_world_ptr->play_time;
r_info[q_ptr->r_idx].flags1 &= ~(RF1_QUESTOR);
}
}
* and create a first saved floor
*/
prepare_change_floor_mode(CFM_FIRST_FLOOR);
-
- /* Leaving */
p_ptr->leaving = TRUE;
}
else
}
}
-
-/*!
- * @brief 指定したモンスターに隣接しているモンスターの数を返す。
- * / Count number of adjacent monsters
- * @param m_idx 隣接数を調べたいモンスターのID
- * @return 隣接しているモンスターの数
- */
-static int get_monster_crowd_number(MONSTER_IDX m_idx)
-{
- monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
- POSITION my = m_ptr->fy;
- POSITION mx = m_ptr->fx;
- int i;
- int count = 0;
-
- for (i = 0; i < 7; i++)
- {
- int ay = my + ddy_ddd[i];
- int ax = mx + ddx_ddd[i];
-
- if (!in_bounds(ay, ax)) continue;
-
- /* Count number of monsters */
- if (current_floor_ptr->grid_array[ay][ax].m_idx > 0) count++;
- }
-
- return count;
-}
-
-
-
-/*!
- * ダンジョンの雰囲気を計算するための非線形基準値 / Dungeon rating is no longer linear
- */
-#define RATING_BOOST(delta) (delta * delta + 50 * delta)
-
-/*!
- * @brief ダンジョンの雰囲気を算出する。
- * / Examine all monsters and unidentified objects, and get the feeling of current dungeon floor
- * @return 算出されたダンジョンの雰囲気ランク
- */
-static byte get_dungeon_feeling(void)
-{
- const int base = 10;
- int rating = 0;
- IDX i;
-
- /* Hack -- no feeling in the town */
- if (!current_floor_ptr->dun_level) return 0;
-
- /* Examine each monster */
- for (i = 1; i < m_max; i++)
- {
- monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
- monster_race *r_ptr;
- int delta = 0;
-
- /* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
-
- /* Ignore pet */
- if (is_pet(m_ptr)) continue;
-
- r_ptr = &r_info[m_ptr->r_idx];
-
- /* Unique monsters */
- if (r_ptr->flags1 & (RF1_UNIQUE))
- {
- /* Nearly out-of-depth unique monsters */
- if (r_ptr->level + 10 > current_floor_ptr->dun_level)
- {
- /* Boost rating by twice delta-depth */
- delta += (r_ptr->level + 10 - current_floor_ptr->dun_level) * 2 * base;
- }
- }
- else
- {
- /* Out-of-depth monsters */
- if (r_ptr->level > current_floor_ptr->dun_level)
- {
- /* Boost rating by delta-depth */
- delta += (r_ptr->level - current_floor_ptr->dun_level) * base;
- }
- }
-
- /* Unusually crowded monsters get a little bit of rating boost */
- if (r_ptr->flags1 & RF1_FRIENDS)
- {
- if (5 <= get_monster_crowd_number(i)) delta += 1;
- }
- else
- {
- if (2 <= get_monster_crowd_number(i)) delta += 1;
- }
-
-
- rating += RATING_BOOST(delta);
- }
-
- /* Examine each unidentified object */
- for (i = 1; i < o_max; i++)
- {
- object_type *o_ptr = ¤t_floor_ptr->o_list[i];
- object_kind *k_ptr = &k_info[o_ptr->k_idx];
- int delta = 0;
-
- /* Skip dead objects */
- if (!o_ptr->k_idx) continue;
-
- /* Skip known objects */
- if (object_is_known(o_ptr))
- {
- /* Touched? */
- if (o_ptr->marked & OM_TOUCHED) continue;
- }
-
- /* Skip pseudo-known objects */
- if (o_ptr->ident & IDENT_SENSE) continue;
-
- /* Ego objects */
- if (object_is_ego(o_ptr))
- {
- ego_item_type *e_ptr = &e_info[o_ptr->name2];
-
- delta += e_ptr->rating * base;
- }
-
- /* Artifacts */
- if (object_is_artifact(o_ptr))
- {
- PRICE cost = object_value_real(o_ptr);
-
- delta += 10 * base;
- if (cost > 10000L) delta += 10 * base;
- if (cost > 50000L) delta += 10 * base;
- if (cost > 100000L) delta += 10 * base;
-
- /* Special feeling */
- if (!preserve_mode) return 1;
- }
-
- if (o_ptr->tval == TV_DRAG_ARMOR) delta += 30 * base;
- if (o_ptr->tval == TV_SHIELD && o_ptr->sval == SV_DRAGON_SHIELD) delta += 5 * base;
- if (o_ptr->tval == TV_GLOVES && o_ptr->sval == SV_SET_OF_DRAGON_GLOVES) delta += 5 * base;
- if (o_ptr->tval == TV_BOOTS && o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE) delta += 5 * base;
- if (o_ptr->tval == TV_HELM && o_ptr->sval == SV_DRAGON_HELM) delta += 5 * base;
- if (o_ptr->tval == TV_RING && o_ptr->sval == SV_RING_SPEED && !object_is_cursed(o_ptr)) delta += 25 * base;
- if (o_ptr->tval == TV_RING && o_ptr->sval == SV_RING_LORDLY && !object_is_cursed(o_ptr)) delta += 15 * base;
- if (o_ptr->tval == TV_AMULET && o_ptr->sval == SV_AMULET_THE_MAGI && !object_is_cursed(o_ptr)) delta += 15 * base;
-
- /* Out-of-depth objects */
- if (!object_is_cursed(o_ptr) && !object_is_broken(o_ptr) && k_ptr->level > current_floor_ptr->dun_level)
- {
- /* Rating increase */
- delta += (k_ptr->level - current_floor_ptr->dun_level) * base;
- }
-
- rating += RATING_BOOST(delta);
- }
-
-
- if (rating > RATING_BOOST(1000)) return 2;
- if (rating > RATING_BOOST(800)) return 3;
- if (rating > RATING_BOOST(600)) return 4;
- if (rating > RATING_BOOST(400)) return 5;
- if (rating > RATING_BOOST(300)) return 6;
- if (rating > RATING_BOOST(200)) return 7;
- if (rating > RATING_BOOST(100)) return 8;
- if (rating > RATING_BOOST(0)) return 9;
-
- return 10;
-}
-
-/*!
- * @brief ダンジョンの雰囲気を更新し、変化があった場合メッセージを表示する
- * / Update dungeon feeling, and announce it if changed
- * @return なし
- */
-static void update_dungeon_feeling(void)
-{
- byte new_feeling;
- int quest_num;
- int delay;
-
- /* No feeling on the surface */
- if (!current_floor_ptr->dun_level) return;
-
- /* No feeling in the arena */
- if (p_ptr->inside_battle) return;
-
- /* Extract delay time */
- delay = MAX(10, 150 - p_ptr->skill_fos) * (150 - current_floor_ptr->dun_level) * TURNS_PER_TICK / 100;
-
- /* Not yet felt anything */
- if (current_world_ptr->game_turn < p_ptr->feeling_turn + delay && !cheat_xtra) return;
-
- /* Extract quest number (if any) */
- quest_num = quest_number(current_floor_ptr->dun_level);
-
- /* No feeling in a quest */
- if (quest_num &&
- (is_fixed_quest_idx(quest_num) &&
- !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
- !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) return;
-
-
- /* Get new dungeon feeling */
- new_feeling = get_dungeon_feeling();
-
- /* Remember last time updated */
- p_ptr->feeling_turn = current_world_ptr->game_turn;
-
- /* No change */
- if (p_ptr->feeling == new_feeling) return;
-
- /* Dungeon feeling is changed */
- p_ptr->feeling = new_feeling;
-
- /* Announce feeling */
- do_cmd_feeling();
-
- select_floor_music();
-
- /* Update the level indicator */
- p_ptr->redraw |= (PR_DEPTH);
-
- if (disturb_minor) disturb(FALSE, FALSE);
-}
-
/*!
* @brief 10ゲームターンが進行する毎にゲーム世界全体の処理を行う。
* / Handle certain things once every 10 game turns
msg_print(_("相打ちに終わりました。", "They have kill each other at the same time."));
msg_print(NULL);
p_ptr->energy_need = 0;
- battle_monsters();
+ update_gambling_monsters();
}
else if ((number_mon-1) == 0)
{
}
msg_print(NULL);
p_ptr->energy_need = 0;
- battle_monsters();
+ update_gambling_monsters();
}
- else if (current_world_ptr->game_turn - old_turn == 150 * TURNS_PER_TICK)
+ else if (current_world_ptr->game_turn - current_floor_ptr->generated_turn == 150 * TURNS_PER_TICK)
{
msg_print(_("申し分けありませんが、この勝負は引き分けとさせていただきます。", "This battle have ended in a draw."));
p_ptr->au += kakekin;
msg_print(NULL);
p_ptr->energy_need = 0;
- battle_monsters();
+ update_gambling_monsters();
}
}
/* Stop playing */
p_ptr->playing = FALSE;
-
- /* Leaving */
p_ptr->leaving = TRUE;
}
}
/* Check every feature */
for (i = 1; i < max_f_idx; i++)
{
- /* Access the index */
feature_type *f_ptr = &f_info[i];
/* Skip empty index */
/* Every 15 minutes after 11:00 pm */
if ((hour == 23) && !(min % 15))
{
- /* Disturbing */
disturb(FALSE, TRUE);
switch (min / 15)
{
if (vanilla_town) break;
- if (ambush_flag)
+ if (p_ptr->ambush_flag)
{
msg_print(_("襲撃から逃げるにはマップの端まで移動しなければならない。", "To flee the ambush you have to reach the edge of the map."));
break;
/* Fire an item */
case 'f':
{
- do_cmd_fire();
+ do_cmd_fire(SP_NONE);
break;
}
/* Access the slot to be dropped */
o_ptr = &inventory[INVEN_PACK];
- /* Disturbing */
disturb(FALSE, TRUE);
/* Warning */
*/
static void process_player(void)
{
- IDX i;
+ MONSTER_IDX m_idx;
/*** Apply energy ***/
if (p_ptr->inside_battle)
{
- for(i = 1; i < m_max; i++)
+ for(m_idx = 1; m_idx < m_max; m_idx++)
{
- monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
- update_monster(i, FALSE);
+ update_monster(m_idx, FALSE);
}
prt_time();
}
/*** Check for interupts ***/
/* Complete resting */
- if (resting < 0)
+ if (p_ptr->resting < 0)
{
/* Basic resting */
- if (resting == COMMAND_ARG_REST_FULL_HEALING)
+ if (p_ptr->resting == COMMAND_ARG_REST_FULL_HEALING)
{
/* Stop resting */
if ((p_ptr->chp == p_ptr->mhp) &&
}
/* Complete resting */
- else if (resting == COMMAND_ARG_REST_UNTIL_DONE)
+ else if (p_ptr->resting == COMMAND_ARG_REST_UNTIL_DONE)
{
/* Stop resting */
if ((p_ptr->chp == p_ptr->mhp) &&
}
}
- /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
handle_stuff();
}
p_ptr->window |= PW_PLAYER;
p_ptr->sutemi = FALSE;
p_ptr->counter = FALSE;
- now_damaged = FALSE;
+ p_ptr->now_damaged = FALSE;
handle_stuff();
else if (p_ptr->action == ACTION_REST)
{
/* Timed rest */
- if (resting > 0)
+ if (p_ptr->resting > 0)
{
/* Reduce rest count */
- resting--;
+ p_ptr->resting--;
- if (!resting) set_action(ACTION_NONE);
+ if (!p_ptr->resting) set_action(ACTION_NONE);
p_ptr->redraw |= (PR_STATE);
}
process_command();
}
-
/* Hack -- Pack Overflow */
pack_overflow();
-
/*** Clean up ***/
/* Significant */
shimmer_monsters = FALSE;
/* Shimmer multi-hued monsters */
- for (i = 1; i < m_max; i++)
+ for (m_idx = 1; m_idx < m_max; m_idx++)
{
monster_type *m_ptr;
monster_race *r_ptr;
- /* Access monster */
- m_ptr = ¤t_floor_ptr->m_list[i];
-
- /* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ m_ptr = ¤t_floor_ptr->m_list[m_idx];
+ if (!monster_is_valid(m_ptr)) continue;
/* Skip unseen monsters */
if (!m_ptr->ml) continue;
repair_monsters = FALSE;
/* Rotate detection flags */
- for (i = 1; i < m_max; i++)
+ for (m_idx = 1; m_idx < m_max; m_idx++)
{
monster_type *m_ptr;
-
- /* Access monster */
- m_ptr = ¤t_floor_ptr->m_list[i];
-
- /* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ m_ptr = ¤t_floor_ptr->m_list[m_idx];
+ if (!monster_is_valid(m_ptr)) continue;
/* Nice monsters get mean */
if (m_ptr->mflag & MFLAG_NICE)
/* Assume invisible */
m_ptr->ml = FALSE;
- update_monster(i, FALSE);
+ update_monster(m_idx, FALSE);
- if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH);
- if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH);
+ if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
+ if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
/* Redraw regardless */
lite_spot(m_ptr->fy, m_ptr->fx);
}
if (p_ptr->pclass == CLASS_IMITATOR)
{
+ int j;
if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
{
p_ptr->mane_num--;
- for (i = 0; i < p_ptr->mane_num; i++)
+ for (j = 0; j < p_ptr->mane_num; j++)
{
- p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
- p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
+ p_ptr->mane_spell[j] = p_ptr->mane_spell[j + 1];
+ p_ptr->mane_dam[j] = p_ptr->mane_dam[j + 1];
}
}
new_mane = FALSE;
p_ptr->redraw |= (PR_MAP);
p_ptr->update |= (PU_MONSTERS);
-
p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
msg_print(_("「時は動きだす…」", "You feel time flowing around you once more."));
p_ptr->timewalk = FALSE;
p_ptr->energy_need = ENERGY_NEED();
- /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
handle_stuff();
}
}
target_who = 0;
pet_t_m_idx = 0;
riding_t_m_idx = 0;
- ambush_flag = FALSE;
+ p_ptr->ambush_flag = FALSE;
/* Cancel the health bar */
health_track(0);
character_xtra = TRUE;
p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON);
+ p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY | PR_MAP);
+ p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS | PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH | PU_MONSTERS | PU_DISTANCE | PU_FLOW);
- /* Redraw dungeon */
- p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY);
-
- p_ptr->redraw |= (PR_MAP);
-
- p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
-
- /* Update lite/view */
- p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH);
- p_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW);
-
- /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
handle_stuff();
/* Leave "xtra" mode */
if (load_game)
{
p_ptr->energy_need = 0;
- battle_monsters();
+ update_gambling_monsters();
}
else
{
process_player();
process_upkeep_with_speed();
- /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
handle_stuff();
/* Hack -- Hilite the player */
{
while (1)
{
- kubi_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
- r_ptr = &r_info[kubi_r_idx[i]];
+ current_world_ptr->bounty_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
+ r_ptr = &r_info[current_world_ptr->bounty_r_idx[i]];
if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
if (r_ptr->rarity > 100) continue;
- if (no_questor_or_bounty_uniques(kubi_r_idx[i])) continue;
+ if (no_questor_or_bounty_uniques(current_world_ptr->bounty_r_idx[i])) continue;
for (j = 0; j < i; j++)
- if (kubi_r_idx[i] == kubi_r_idx[j]) break;
+ if (current_world_ptr->bounty_r_idx[i] == current_world_ptr->bounty_r_idx[j]) break;
if (j == i) break;
}
{
for (j = i; j < MAX_KUBI; j++)
{
- if (r_info[kubi_r_idx[i]].level > r_info[kubi_r_idx[j]].level)
+ if (r_info[current_world_ptr->bounty_r_idx[i]].level > r_info[current_world_ptr->bounty_r_idx[j]].level)
{
- tmp = kubi_r_idx[i];
- kubi_r_idx[i] = kubi_r_idx[j];
- kubi_r_idx[j] = tmp;
+ tmp = current_world_ptr->bounty_r_idx[i];
+ current_world_ptr->bounty_r_idx[i] = current_world_ptr->bounty_r_idx[j];
+ current_world_ptr->bounty_r_idx[j] = tmp;
}
}
}
p_ptr->teleport_town = FALSE;
p_ptr->sutemi = FALSE;
- world_monster = FALSE;
- now_damaged = FALSE;
+ current_world_ptr->timewalk_m_idx = 0;
+ p_ptr->now_damaged = FALSE;
now_message = 0;
start_time = time(NULL) - 1;
record_o_name[0] = '\0';
rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
if (current_world_ptr->game_turn > rollback_turns) current_world_ptr->game_turn -= rollback_turns;
- else current_world_ptr->game_turn = 1; /* Paranoia */
- if (old_turn > rollback_turns) old_turn -= rollback_turns;
- else old_turn = 1;
+ else current_world_ptr->game_turn = 1;
+ if (current_floor_ptr->generated_turn > rollback_turns) current_floor_ptr->generated_turn -= rollback_turns;
+ else current_floor_ptr->generated_turn = 1;
if (old_battle > rollback_turns) old_battle -= rollback_turns;
else old_battle = 1;
if (p_ptr->feeling_turn > rollback_turns) p_ptr->feeling_turn -= rollback_turns;
}
}
}
+
+/*!
+ * @brief ゲーム終了処理 /
+ * Close up the current game (player may or may not be dead)
+ * @return なし
+ * @details
+ * <pre>
+ * This function is called only from "main.c" and "signals.c".
+ * </pre>
+ */
+void close_game(void)
+{
+ char buf[1024];
+ bool do_send = TRUE;
+
+ /* concptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
+ handle_stuff();
+
+ /* Flush the messages */
+ msg_print(NULL);
+
+ /* Flush the input */
+ flush();
+
+
+ /* No suspending now */
+ signals_ignore_tstp();
+
+
+ /* Hack -- Character is now "icky" */
+ character_icky = TRUE;
+
+
+ /* Build the filename */
+ path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
+
+ /* Grab permissions */
+ safe_setuid_grab();
+
+ /* Open the high score file, for reading/writing */
+ highscore_fd = fd_open(buf, O_RDWR);
+
+ /* Drop permissions */
+ safe_setuid_drop();
+
+ /* Handle death */
+ if (p_ptr->is_dead)
+ {
+ /* Handle retirement */
+ if (p_ptr->total_winner) kingly();
+
+ /* Save memories */
+ if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
+ {
+ if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
+ }
+ else do_send = FALSE;
+
+ /* You are dead */
+ print_tomb();
+
+ flush();
+
+ /* Show more info */
+ show_info();
+ Term_clear();
+
+ if (check_score())
+ {
+ if ((!send_world_score(do_send)))
+ {
+ if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
+ (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
+ {
+ p_ptr->wait_report_score = TRUE;
+ p_ptr->is_dead = FALSE;
+ if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
+ }
+ }
+ if (!p_ptr->wait_report_score)
+ (void)top_twenty();
+ }
+ else if (highscore_fd >= 0)
+ {
+ display_scores_aux(0, 10, -1, NULL);
+ }
+#if 0
+ /* Dump bones file */
+ make_bones();
+#endif
+ }
+
+ /* Still alive */
+ else
+ {
+ /* Save the game */
+ do_cmd_save_game(FALSE);
+
+ /* Prompt for scores */
+ prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
+ play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
+
+ /* Predict score (or ESCAPE) */
+ if (inkey() != ESCAPE) predict_score();
+ }
+
+
+ /* Shut the high score file */
+ (void)fd_close(highscore_fd);
+
+ /* Forget the high score fd */
+ highscore_fd = -1;
+
+ /* Kill all temporal files */
+ clear_saved_floor_files();
+
+ /* Allow suspending now */
+ signals_handle_tstp();
+}