From c00affd4efadc69d5b779247b68425774b2b3ebe Mon Sep 17 00:00:00 2001 From: Deskull Date: Sat, 1 Dec 2018 19:38:40 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#37353=20=E3=82=B3=E3=83=A1?= =?utf8?q?=E3=83=B3=E3=83=88=E6=95=B4=E7=90=86=E3=80=82=20update=5Fmon()?= =?utf8?q?=E3=82=92update=5Fmonster()=E3=81=AB=E6=94=B9=E5=90=8D=E3=80=82?= =?utf8?q?=20/=20Refactor=20comments=20and=20rename=20update=5Fmon()=20to?= =?utf8?q?=20update=5Fmonster().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cave.c | 15 +++++---------- src/cmd1.c | 4 ++-- src/cmd2.c | 2 +- src/cmd4.c | 6 +++--- src/dungeon.c | 8 ++------ src/externs.h | 2 +- src/floor-generate.c | 4 +--- src/floor-save.c | 6 ++---- src/mind.c | 2 +- src/monster-process.c | 6 ++---- src/monster-status.c | 2 +- src/monster2.c | 12 ++++-------- src/realm-hissatsu.c | 4 ++-- src/spells1.c | 8 +++----- src/spells2.c | 41 +++++++++++------------------------------ src/spells3.c | 6 +++--- src/wizard1.c | 9 +++------ src/xtra2.c | 2 +- 18 files changed, 48 insertions(+), 91 deletions(-) diff --git a/src/cave.c b/src/cave.c index b3d518cc6..a9ec76bb9 100644 --- a/src/cave.c +++ b/src/cave.c @@ -423,7 +423,7 @@ static bool check_local_illumination(POSITION y, POSITION x) if (player_has_los_bold((Y), (X))) \ { \ /* Update the monster */ \ - if (cave[(Y)][(X)].m_idx) update_mon(cave[(Y)][(X)].m_idx, FALSE); \ + if (cave[(Y)][(X)].m_idx) update_monster(cave[(Y)][(X)].m_idx, FALSE); \ \ /* Notice and redraw */ \ note_spot((Y), (X)); \ @@ -4040,7 +4040,7 @@ void delayed_visual_update(void) lite_spot(y, x); /* Hack -- Visual update of monster on this grid */ - if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE); + if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE); /* No longer in the array */ c_ptr->info &= ~(CAVE_NOTE | CAVE_REDRAW); @@ -4573,9 +4573,7 @@ void cave_set_feat(POSITION y, POSITION x, FEAT_IDX feat) /* Check for change to boring grid */ if (!have_flag(f_ptr->flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK); - - /* Update the monster */ - if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE); + if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE); note_spot(y, x); @@ -4613,8 +4611,7 @@ void cave_set_feat(POSITION y, POSITION x, FEAT_IDX feat) if (player_has_los_grid(cc_ptr)) { - /* Update the monster */ - if (cc_ptr->m_idx) update_mon(cc_ptr->m_idx, FALSE); + if (cc_ptr->m_idx) update_monster(cc_ptr->m_idx, FALSE); note_spot(yy, xx); @@ -4755,9 +4752,7 @@ void remove_mirror(POSITION y, POSITION x) { c_ptr->info &= ~(CAVE_GLOW); if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK); - - /* Update the monster */ - if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE); + if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE); update_local_illumination(y, x); } diff --git a/src/cmd1.c b/src/cmd1.c index 5ab57b930..e01260160 100644 --- a/src/cmd1.c +++ b/src/cmd1.c @@ -860,7 +860,7 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode) monster_type *om_ptr = &m_list[om_idx]; om_ptr->fy = ny; om_ptr->fx = nx; - update_mon(om_idx, TRUE); + update_monster(om_idx, TRUE); } if (nm_idx > 0) /* Monster on new spot */ @@ -868,7 +868,7 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode) monster_type *nm_ptr = &m_list[nm_idx]; nm_ptr->fy = oy; nm_ptr->fx = ox; - update_mon(nm_idx, TRUE); + update_monster(nm_idx, TRUE); } } diff --git a/src/cmd2.c b/src/cmd2.c index 3d7443dbe..e3ee7a73c 100644 --- a/src/cmd2.c +++ b/src/cmd2.c @@ -3169,7 +3169,7 @@ void do_cmd_fire_aux(INVENTORY_IDX item, object_type *j_ptr) m_ptr->fy = ny; /* Update the monster (new location) */ - update_mon(c_mon_ptr->m_idx, TRUE); + update_monster(c_mon_ptr->m_idx, TRUE); lite_spot(ny, nx); lite_spot(oy, ox); diff --git a/src/cmd4.c b/src/cmd4.c index d4551e554..2e095f245 100644 --- a/src/cmd4.c +++ b/src/cmd4.c @@ -5540,9 +5540,9 @@ static void do_cmd_knowledge_uniques(void) if (!fff) { - msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name); - msg_print(NULL); - return; + msg_format(_("一時ファイル %s を作成できませんでした。", "Failed to create temporary file %s."), file_name); + msg_print(NULL); + return; } /* Allocate the "who" array */ diff --git a/src/dungeon.c b/src/dungeon.c index 168ea6f77..b955ce32b 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -4702,9 +4702,7 @@ static void process_player(void) /* Hack -- Detect monster */ m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW); - - /* Update the monster */ - update_mon(i, FALSE); + update_monster(i, FALSE); } prt_time(); } @@ -5160,9 +5158,7 @@ static void process_player(void) /* Assume invisible */ m_ptr->ml = FALSE; - - /* Update the monster */ - update_mon(i, FALSE); + update_monster(i, FALSE); if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH); if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH); diff --git a/src/externs.h b/src/externs.h index ec4ce3730..aec455e74 100644 --- a/src/externs.h +++ b/src/externs.h @@ -760,7 +760,7 @@ extern void monster_desc(char *desc, monster_type *m_ptr, BIT_FLAGS mode); extern int lore_do_probe(MONRACE_IDX r_idx); extern void lore_treasure(MONSTER_IDX m_idx, ITEM_NUMBER num_item, ITEM_NUMBER num_gold); extern void sanity_blast(monster_type *m_ptr, bool necro); -extern void update_mon(MONSTER_IDX m_idx, bool full); +extern void update_monster(MONSTER_IDX m_idx, bool full); extern void update_monsters(bool full); extern bool place_monster_aux(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_IDX r_idx, BIT_FLAGS mode); extern bool place_monster(POSITION y, POSITION x, BIT_FLAGS mode); diff --git a/src/floor-generate.c b/src/floor-generate.c index b1e53d45f..809f977e0 100644 --- a/src/floor-generate.c +++ b/src/floor-generate.c @@ -1182,9 +1182,7 @@ static void battle_gen(void) /* Hack -- Detect monster */ m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW); - - /* Update the monster */ - update_mon(i, FALSE); + update_monster(i, FALSE); } } diff --git a/src/floor-save.c b/src/floor-save.c index b34ec3800..73ef1cbc3 100644 --- a/src/floor-save.c +++ b/src/floor-save.c @@ -574,9 +574,7 @@ static void place_pet(void) /* Must repair monsters */ repair_monsters = TRUE; } - - /* Update the monster */ - update_mon(m_idx, TRUE); + update_monster(m_idx, TRUE); lite_spot(cy, cx); /* Pre-calculated in precalc_cur_num_of_pet() */ @@ -728,7 +726,7 @@ static void get_out_monster(void) m_ptr->fy = ny; m_ptr->fx = nx; - /* No need to do update_mon() */ + /* No need to do update_monster() */ /* Success */ return; diff --git a/src/mind.c b/src/mind.c index 9395e9929..7a1ee9941 100644 --- a/src/mind.c +++ b/src/mind.c @@ -1707,7 +1707,7 @@ static bool cast_ninja_spell(int spell) (void)set_monster_csleep(m_idx, 0); /* Update the monster (new location) */ - update_mon(m_idx, TRUE); + update_monster(m_idx, TRUE); /* Redraw the old grid */ lite_spot(target_row, target_col); diff --git a/src/monster-process.c b/src/monster-process.c index a2b9ebfb4..55eff62be 100644 --- a/src/monster-process.c +++ b/src/monster-process.c @@ -3055,7 +3055,7 @@ void process_monster(MONSTER_IDX m_idx) y_ptr->fx = ox; /* Update the old monster */ - update_mon(c_ptr->m_idx, TRUE); + update_monster(c_ptr->m_idx, TRUE); } /* Hack -- Update the new location */ @@ -3064,9 +3064,7 @@ void process_monster(MONSTER_IDX m_idx) /* Move the monster */ m_ptr->fy = ny; m_ptr->fx = nx; - - /* Update the monster */ - update_mon(m_idx, TRUE); + update_monster(m_idx, TRUE); /* Redraw the old grid */ lite_spot(oy, ox); diff --git a/src/monster-status.c b/src/monster-status.c index 5f7b5c3be..ea3827242 100644 --- a/src/monster-status.c +++ b/src/monster-status.c @@ -857,7 +857,7 @@ void monster_gain_exp(MONSTER_IDX m_idx, IDX s_idx) /* Now you feel very close to this pet. */ m_ptr->parent_m_idx = 0; } - update_mon(m_idx, FALSE); + update_monster(m_idx, FALSE); lite_spot(m_ptr->fy, m_ptr->fx); } if (m_idx == p_ptr->riding) p_ptr->update |= PU_BONUS; diff --git a/src/monster2.c b/src/monster2.c index bd9126f19..05ead33fd 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -2282,7 +2282,7 @@ void sanity_blast(monster_type *m_ptr, bool necro) * "disturb_near" (monster which is "easily" viewable moves in some * way). Note that "moves" includes "appears" and "disappears". */ -void update_mon(MONSTER_IDX m_idx, bool full) +void update_monster(MONSTER_IDX m_idx, bool full) { monster_type *m_ptr = &m_list[m_idx]; @@ -2686,9 +2686,7 @@ void update_monsters(bool full) /* Skip dead monsters */ if (!m_ptr->r_idx) continue; - - /* Update the monster */ - update_mon(i, full); + update_monster(i, full); } } @@ -2821,7 +2819,7 @@ void choose_new_monster(MONSTER_IDX m_idx, bool born, MONRACE_IDX r_idx) m_ptr->r_idx = r_idx; m_ptr->ap_r_idx = r_idx; - update_mon(m_idx, FALSE); + update_monster(m_idx, FALSE); lite_spot(m_ptr->fy, m_ptr->fx); if ((r_info[old_r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK)) || @@ -3267,9 +3265,7 @@ static bool place_monster_one(MONSTER_IDX who, POSITION y, POSITION x, MONRACE_I p_ptr->update |= (PU_MON_LITE); else if ((r_ptr->flags7 & RF7_HAS_LD_MASK) && !MON_CSLEEP(m_ptr)) p_ptr->update |= (PU_MON_LITE); - - /* Update the monster */ - update_mon(c_ptr->m_idx, TRUE); + update_monster(c_ptr->m_idx, TRUE); /* Count the monsters on the level */ diff --git a/src/realm-hissatsu.c b/src/realm-hissatsu.c index 01350b527..f36d482f2 100644 --- a/src/realm-hissatsu.c +++ b/src/realm-hissatsu.c @@ -308,7 +308,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) m_ptr->fy = ty; m_ptr->fx = tx; - update_mon(m_idx, TRUE); + update_monster(m_idx, TRUE); lite_spot(oy, ox); lite_spot(ty, tx); @@ -674,7 +674,7 @@ cptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode) m_ptr->fy = ny; m_ptr->fx = nx; - update_mon(m_idx, TRUE); + update_monster(m_idx, TRUE); /* Redraw the old spot */ lite_spot(y, x); diff --git a/src/spells1.c b/src/spells1.c index 7e362f6d8..e71736ddd 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -1086,7 +1086,7 @@ static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P /* Mega-Hack -- Update the monster in the affected grid */ /* This allows "spear of light" (etc) to work "correctly" */ - if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE); + if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE); if (p_ptr->special_defense & NINJA_S_STEALTH) { @@ -1149,7 +1149,7 @@ static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P /* Mega-Hack -- Update the monster in the affected grid */ /* This allows "spear of light" (etc) to work "correctly" */ - if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE); + if (c_ptr->m_idx) update_monster(c_ptr->m_idx, FALSE); } /* All done */ @@ -5025,9 +5025,7 @@ static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_P } /* Verify this code */ - - /* Update the monster */ - if (m_ptr->r_idx) update_mon(c_ptr->m_idx, FALSE); + if (m_ptr->r_idx) update_monster(c_ptr->m_idx, FALSE); /* Redraw the monster grid */ lite_spot(y, x); diff --git a/src/spells2.c b/src/spells2.c index d8c446d2f..97f172843 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -378,9 +378,7 @@ bool detect_monsters_normal(POSITION range) /* Hack -- Detect monster */ m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW); - - /* Update the monster */ - update_mon(i, FALSE); + update_monster(i, FALSE); flag = TRUE; } } @@ -437,9 +435,7 @@ bool detect_monsters_invis(POSITION range) /* Hack -- Detect monster */ m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW); - - /* Update the monster */ - update_mon(i, FALSE); + update_monster(i, FALSE); flag = TRUE; } } @@ -501,9 +497,7 @@ bool detect_monsters_evil(POSITION range) /* Hack -- Detect monster */ m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW); - - /* Update the monster */ - update_mon(i, FALSE); + update_monster(i, FALSE); flag = TRUE; } } @@ -557,9 +551,7 @@ bool detect_monsters_nonliving(POSITION range) /* Hack -- Detect monster */ m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW); - - /* Update the monster */ - update_mon(i, FALSE); + update_monster(i, FALSE); flag = TRUE; } } @@ -613,9 +605,7 @@ bool detect_monsters_mind(POSITION range) /* Hack -- Detect monster */ m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW); - - /* Update the monster */ - update_mon(i, FALSE); + update_monster(i, FALSE); flag = TRUE; } } @@ -671,9 +661,7 @@ bool detect_monsters_string(POSITION range, cptr Match) /* Hack -- Detect monster */ m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW); - - /* Update the monster */ - update_mon(i, FALSE); + update_monster(i, FALSE); flag = TRUE; } } @@ -737,9 +725,7 @@ bool detect_monsters_xxx(POSITION range, u32b match_flag) /* Hack -- Detect monster */ m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW); - - /* Update the monster */ - update_mon(i, FALSE); + update_monster(i, FALSE); flag = TRUE; } } @@ -1993,7 +1979,7 @@ bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx) m_ptr->fx = sx; /* Update the monster (new location) */ - update_mon(m_idx, TRUE); + update_monster(m_idx, TRUE); /* Redraw the old grid */ lite_spot(yy, xx); @@ -2246,9 +2232,7 @@ static void cave_temp_room_lite(void) monster_type *m_ptr = &m_list[c_ptr->m_idx]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; - - /* Update the monster */ - update_mon(c_ptr->m_idx, FALSE); + update_monster(c_ptr->m_idx, FALSE); /* Stupid monsters rarely wake up */ if (r_ptr->flags2 & (RF2_STUPID)) chance = 10; @@ -2359,8 +2343,7 @@ static void cave_temp_room_unlite(void) /* Process affected monsters */ if (c_ptr->m_idx) { - /* Update the monster */ - update_mon(c_ptr->m_idx, FALSE); + update_monster(c_ptr->m_idx, FALSE); } /* Redraw */ @@ -4025,9 +4008,7 @@ bool rush_attack(bool *mdeath) /* Move player before updating the monster */ if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL); - - /* Update the monster */ - update_mon(cave[ny][nx].m_idx, TRUE); + update_monster(cave[ny][nx].m_idx, TRUE); /* Found a monster */ m_ptr = &m_list[cave[ny][nx].m_idx]; diff --git a/src/spells3.c b/src/spells3.c index 8e7a21cf0..7a2ef24a8 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -118,7 +118,7 @@ bool teleport_away(MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode) reset_target(m_ptr); /* Update the monster (new location) */ - update_mon(m_idx, TRUE); + update_monster(m_idx, TRUE); /* Redraw the old grid */ lite_spot(oy, ox); @@ -223,7 +223,7 @@ void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, m_ptr->fx = nx; /* Update the monster (new location) */ - update_mon(m_idx, TRUE); + update_monster(m_idx, TRUE); /* Redraw the old grid */ lite_spot(oy, ox); @@ -5067,7 +5067,7 @@ bool shock_power(void) m_ptr->fy = (byte_hack)ty; m_ptr->fx = (byte_hack)tx; - update_mon(m_idx, TRUE); + update_monster(m_idx, TRUE); lite_spot(oy, ox); lite_spot(ty, tx); diff --git a/src/wizard1.c b/src/wizard1.c index f0ca3bdf7..9f622dd7a 100644 --- a/src/wizard1.c +++ b/src/wizard1.c @@ -1257,8 +1257,7 @@ static void analyze_misc_magic(object_type *o_ptr, cptr *misc_list) misc_list = spoiler_flag_aux(flgs, misc_flags2_desc, misc_list, N_ELEMENTS(misc_flags2_desc)); - misc_list = spoiler_flag_aux(flgs, misc_flags3_desc, misc_list, - N_ELEMENTS(misc_flags3_desc)); + misc_list = spoiler_flag_aux(flgs, misc_flags3_desc, misc_list, N_ELEMENTS(misc_flags3_desc)); /* * Glowing artifacts -- small radius light. @@ -1381,8 +1380,7 @@ static void analyze_misc(object_type *o_ptr, char *misc_desc) { artifact_type *a_ptr = &a_info[o_ptr->name1]; - sprintf(misc_desc, _("レベル %d, 希少度 %u, %d.%d kg, $%ld", "Level %d, Rarity %u, %d.%d lbs, %ld Gold"), - (int)a_ptr->level, a_ptr->rarity, + sprintf(misc_desc, _("レベル %d, 希少度 %u, %d.%d kg, $%ld", "Level %d, Rarity %u, %d.%d lbs, %ld Gold"), (int)a_ptr->level, a_ptr->rarity, #ifdef JP lbtokg1(a_ptr->weight), lbtokg2(a_ptr->weight), (long int)a_ptr->cost); #else @@ -1423,8 +1421,7 @@ static void print_header(void) { char buf[80]; - sprintf(buf, "Artifact Spoilers for Hengband Version %d.%d.%d", - FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH); + sprintf(buf, "Artifact Spoilers for Hengband Version %d.%d.%d",FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH); spoiler_underline(buf); } diff --git a/src/xtra2.c b/src/xtra2.c index a6ed8e916..36beac409 100644 --- a/src/xtra2.c +++ b/src/xtra2.c @@ -3487,7 +3487,7 @@ static char target_set_aux(POSITION y, POSITION x, BIT_FLAGS mode, cptr info) * some form of "scrolling" the map around the cursor. * That is, consider the possibility of "auto-scrolling" the screen * while the cursor moves around. This may require changes in the - * "update_mon()" code to allow "visibility" even if off panel, and + * "update_monster()" code to allow "visibility" even if off panel, and * may require dynamic recalculation of the "temp" grid set. * * Hack -- targeting/observing an "outer border grid" may induce -- 2.11.0