From 4fe2d31d0b00e564ab85bff463bdd3273633bfc3 Mon Sep 17 00:00:00 2001 From: Deskull Date: Sun, 16 Dec 2018 11:05:38 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#37353=20window=5Fstuff()=20?= =?utf8?q?=E3=81=AE=E7=9B=B4=E6=8E=A5=E5=91=BC=E5=87=BA=E3=81=97=E3=82=92?= =?utf8?q?=E6=8A=91=E6=AD=A2=E3=80=82=20/=20Forbid=20call=20of=20window=5F?= =?utf8?q?stuff()=20except=20handle=5Fstuff().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/bldg.c | 2 +- src/cmd-item.c | 6 ++---- src/cmd-pet.c | 2 +- src/cmd5.c | 10 ++-------- src/dungeon.c | 5 +---- src/hissatsu.c | 5 +---- src/main-win.c | 2 +- src/mane.c | 4 +--- src/mind.c | 4 +--- src/mspells3.c | 4 +--- src/object1.c | 24 +++++------------------- src/snipe.c | 4 +--- src/spells2.c | 3 ++- src/util.c | 6 +++--- 14 files changed, 23 insertions(+), 58 deletions(-) diff --git a/src/bldg.c b/src/bldg.c index 3f46d15e6..227f75199 100644 --- a/src/bldg.c +++ b/src/bldg.c @@ -302,7 +302,7 @@ static void arena_comm(int cmd) p_ptr->monster_race_idx = arena_info[p_ptr->arena_number].r_idx; p_ptr->window |= (PW_MONSTER); - window_stuff(); + handle_stuff(); } break; diff --git a/src/cmd-item.c b/src/cmd-item.c index da56f8bf3..16a65690a 100644 --- a/src/cmd-item.c +++ b/src/cmd-item.c @@ -811,7 +811,7 @@ void do_cmd_destroy(void) /* HACK : Add the line to message buffer */ message_add(out_val); p_ptr->window |= (PW_MESSAGE); - window_stuff(); + handle_stuff(); /* Get an acceptable answer */ while (TRUE) @@ -1415,10 +1415,8 @@ void do_cmd_target(void) */ void do_cmd_look(void) { - /*TEST*/ p_ptr->window |= PW_MONSTER_LIST; - window_stuff(); - /*TEST*/ + handle_stuff(); /* Look around */ if (target_set(TARGET_LOOK)) diff --git a/src/cmd-pet.c b/src/cmd-pet.c index c9f2dcf8a..729ad1742 100644 --- a/src/cmd-pet.c +++ b/src/cmd-pet.c @@ -271,7 +271,7 @@ void do_cmd_pet_dismiss(void) /* HACK : Add the line to message buffer */ msg_format(_("%s を放した。", "Dismissed %s."), friend_name); p_ptr->window |= (PW_MESSAGE); - window_stuff(); + handle_stuff(); delete_monster_idx(pet_ctr); Dismissed++; diff --git a/src/cmd5.c b/src/cmd5.c index 68e016cc3..a67677f12 100644 --- a/src/cmd5.c +++ b/src/cmd5.c @@ -125,10 +125,8 @@ static int get_spell(SPELL_IDX *sn, cptr prompt, OBJECT_SUBTYPE_VALUE sval, bool /* No redraw yet */ redraw = FALSE; - /* Show choices */ p_ptr->window |= (PW_SPELL); - - window_stuff(); + handle_stuff(); /* Build a prompt (accept all spells) */ #ifdef JP @@ -308,12 +306,8 @@ static int get_spell(SPELL_IDX *sn, cptr prompt, OBJECT_SUBTYPE_VALUE sval, bool /* Restore the screen */ if (redraw) screen_load(); - - /* Show choices */ p_ptr->window |= (PW_SPELL); - - window_stuff(); - + handle_stuff(); /* Abort if needed */ if (!flag) return FALSE; diff --git a/src/dungeon.c b/src/dungeon.c index 3b75e105b..2fcb27ede 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -6034,11 +6034,8 @@ void play_game(bool new_game) Term_xtra(TERM_XTRA_REACT, 0); p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER); - p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT); - - window_stuff(); - + handle_stuff(); /* Set or clear "rogue_like_commands" if requested */ if (arg_force_original) rogue_like_commands = FALSE; diff --git a/src/hissatsu.c b/src/hissatsu.c index 0ec466bca..b9f4a595e 100644 --- a/src/hissatsu.c +++ b/src/hissatsu.c @@ -293,11 +293,8 @@ static int get_hissatsu_power(SPELL_IDX *sn) /* Restore the screen */ if (redraw) screen_load(); - /* Show choices */ p_ptr->window |= (PW_SPELL); - - window_stuff(); - + handle_stuff(); /* Abort if needed */ if (!flag) return (FALSE); diff --git a/src/main-win.c b/src/main-win.c index 099722bd3..3f2d30bdd 100644 --- a/src/main-win.c +++ b/src/main-win.c @@ -5108,7 +5108,7 @@ LRESULT FAR PASCAL AngbandListProc(HWND hWnd, UINT uMsg, /* HACK - Redraw all windows */ p_ptr->window = 0xFFFFFFFF; - window_stuff(); + handle_stuff(); } td->size_hack = FALSE; diff --git a/src/mane.c b/src/mane.c index d4d5e578b..5974546e8 100644 --- a/src/mane.c +++ b/src/mane.c @@ -242,10 +242,8 @@ static int get_mane_power(int *sn, bool baigaesi) /* Restore the screen */ if (redraw) screen_load(); - /* Show choices */ p_ptr->window |= (PW_SPELL); - - window_stuff(); + handle_stuff(); /* Abort if needed */ if (!flag) return (FALSE); diff --git a/src/mind.c b/src/mind.c index 37580dd59..b331ecd8d 100644 --- a/src/mind.c +++ b/src/mind.c @@ -1000,10 +1000,8 @@ static bool_hack get_mind_power(SPELL_IDX *sn, bool only_browse) /* Restore the screen */ if (redraw && !only_browse) screen_load(); - /* Show choices */ p_ptr->window |= (PW_SPELL); - - window_stuff(); + handle_stuff(); /* Abort if needed */ if (!flag) return (FALSE); diff --git a/src/mspells3.c b/src/mspells3.c index b5a39aded..ead271f85 100644 --- a/src/mspells3.c +++ b/src/mspells3.c @@ -571,10 +571,8 @@ static int get_learned_power(SPELL_IDX *sn) /* Restore the screen */ if (redraw) screen_load(); - /* Show choices */ p_ptr->window |= (PW_SPELL); - - window_stuff(); + handle_stuff(); /* Abort if needed */ if (!flag) return (FALSE); diff --git a/src/object1.c b/src/object1.c index a47203418..2a04f6b7c 100644 --- a/src/object1.c +++ b/src/object1.c @@ -2974,8 +2974,7 @@ bool get_item(OBJECT_IDX *cp, cptr pmt, cptr str, BIT_FLAGS mode) } /* Toggle if needed */ - if ((command_wrk && ni && !ne) || - (!command_wrk && !ni && ne)) + if ((command_wrk && ni && !ne) || (!command_wrk && !ni && ne)) { /* Toggle */ toggle_inven_equip(); @@ -2984,12 +2983,8 @@ bool get_item(OBJECT_IDX *cp, cptr pmt, cptr str, BIT_FLAGS mode) toggle = !toggle; } - /* Update */ p_ptr->window |= (PW_INVEN | PW_EQUIP); - - /* Redraw windows */ - window_stuff(); - + handle_stuff(); /* Inventory screen */ if (!command_wrk) @@ -3480,11 +3475,8 @@ bool get_item(OBJECT_IDX *cp, cptr pmt, cptr str, BIT_FLAGS mode) /* Toggle again if needed */ if (toggle) toggle_inven_equip(); - /* Update */ p_ptr->window |= (PW_INVEN | PW_EQUIP); - - window_stuff(); - + handle_stuff(); /* Clear the prompt line */ prt("", 0, 0); @@ -3992,11 +3984,8 @@ bool get_item_floor(COMMAND_CODE *cp, cptr pmt, cptr str, BIT_FLAGS mode) toggle = !toggle; } - /* Update */ p_ptr->window |= (PW_INVEN | PW_EQUIP); - - /* Redraw windows */ - window_stuff(); + handle_stuff(); /* Inventory screen */ if (command_wrk == (USE_INVEN)) @@ -4822,11 +4811,8 @@ bool get_item_floor(COMMAND_CODE *cp, cptr pmt, cptr str, BIT_FLAGS mode) /* Toggle again if needed */ if (toggle) toggle_inven_equip(); - /* Update */ p_ptr->window |= (PW_INVEN | PW_EQUIP); - - window_stuff(); - + handle_stuff(); /* Clear the prompt line */ prt("", 0, 0); diff --git a/src/snipe.c b/src/snipe.c index 2c263ebe6..fea4232da 100644 --- a/src/snipe.c +++ b/src/snipe.c @@ -387,10 +387,8 @@ static int get_snipe_power(COMMAND_CODE *sn, bool only_browse) /* Restore the screen */ if (redraw && !only_browse) screen_load(); - /* Show choices */ p_ptr->window |= (PW_SPELL); - - window_stuff(); + handle_stuff(); /* Abort if needed */ if (!flag) return (FALSE); diff --git a/src/spells2.c b/src/spells2.c index 35e95ecee..74cb059d9 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -1316,8 +1316,9 @@ bool probing(void) /* HACK : Add the line to message buffer */ message_add(buf); + p_ptr->window |= (PW_MESSAGE); - window_stuff(); + handle_stuff(); if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx); inkey(); diff --git a/src/util.c b/src/util.c index 7ba96f06a..0ae9d37b8 100644 --- a/src/util.c +++ b/src/util.c @@ -2904,7 +2904,7 @@ void msg_print(cptr msg) /* if (character_generated) message_add(t); */ p_ptr->window |= (PW_MESSAGE); - window_stuff(); + handle_stuff(); /* Remember the message */ msg_flag = TRUE; @@ -3609,7 +3609,7 @@ bool get_check_strict(cptr prompt, BIT_FLAGS mode) if (auto_more) { p_ptr->window |= PW_MESSAGE; - window_stuff(); + handle_stuff(); num_more = 0; } @@ -3645,7 +3645,7 @@ bool get_check_strict(cptr prompt, BIT_FLAGS mode) /* HACK : Add the line to message buffer */ message_add(buf); p_ptr->window |= (PW_MESSAGE); - window_stuff(); + handle_stuff(); } /* Get an acceptable answer */ -- 2.11.0