OSDN Git Service

[Fix] 床置きアイテム自動破壊時にメッセージウインドウが遅れる #92
[hengbandforosx/hengbandosx.git] / src / window / display-sub-windows.c
index e8558ee..f5fc302 100644 (file)
@@ -1,7 +1,7 @@
 #include "window/display-sub-windows.h"
 #include "core/window-redrawer.h"
 #include "flavor/flavor-describer.h"
-#include "floor/floor.h"
+#include "floor/cave.h"
 #include "game-option/option-flags.h"
 #include "game-option/special-options.h"
 #include "game-option/text-display-options.h"
 #include "inventory/inventory-describer.h"
 #include "inventory/inventory-slot-types.h"
 #include "inventory/inventory-util.h"
-#include "io/input-key-processor.h"
-#include "io/targeting.h"
 #include "monster-race/monster-race.h"
 #include "monster-race/race-flags1.h"
 #include "monster/monster-flag-types.h"
 #include "monster/monster-info.h"
 #include "object/item-tester-hooker.h"
 #include "object/object-info.h"
+#include "player/player-status-flags.h"
 #include "spell-kind/magic-item-recharger.h"
+#include "system/floor-type-definition.h"
 #include "system/monster-type-definition.h"
+#include "target/target-preparation.h"
+#include "target/target-setter.h"
+#include "target/target-types.h"
 #include "term/gameterm.h"
 #include "term/screen-processor.h"
 #include "term/term-color-types.h"
@@ -27,9 +30,9 @@
 #include "view/display-map.h"
 #include "view/display-messages.h"
 #include "view/display-player.h"
-#include "window/main-window-util.h"
 #include "view/object-describer.h"
 #include "window/main-window-equipments.h"
+#include "window/main-window-util.h"
 #include "world/world.h"
 
 /*!
@@ -40,7 +43,7 @@
 void fix_inventory(player_type *player_ptr, tval_type item_tester_tval)
 {
     for (int j = 0; j < 8; j++) {
-        term *old = Term;
+        term_type *old = Term;
         if (!angband_term[j])
             continue;
 
@@ -67,8 +70,8 @@ void fix_inventory(player_type *player_ptr, tval_type item_tester_tval)
  *  X   : symbol of monster
  *  LV  : monster lv if known
  *  name: name of monster
- * @return なし
  * </pre>
+ * @return なし
  */
 static void print_monster_line(TERM_LEN x, TERM_LEN y, monster_type *m_ptr, int n_same)
 {
@@ -76,6 +79,7 @@ static void print_monster_line(TERM_LEN x, TERM_LEN y, monster_type *m_ptr, int
     MONRACE_IDX r_idx = m_ptr->ap_r_idx;
     monster_race *r_ptr = &r_info[r_idx];
 
+    term_erase(0, y, 255);
     term_gotoxy(x, y);
     if (!r_ptr)
         return;
@@ -155,11 +159,14 @@ void print_monster_list(floor_type *floor_ptr, TERM_LEN x, TERM_LEN y, TERM_LEN
     }
 
     if (line - y - 1 == max_lines && i != tmp_pos.n) {
+        term_erase(0, line, 255);
         term_gotoxy(x, line);
         term_addstr(-1, TERM_WHITE, "-- and more --");
     } else {
         if (last_mons)
             print_monster_line(x, line++, last_mons, n_same);
+        for (; line < max_lines; line++)
+            term_erase(0, line, 255);
     }
 }
 
@@ -171,18 +178,20 @@ void print_monster_list(floor_type *floor_ptr, TERM_LEN x, TERM_LEN y, TERM_LEN
 void fix_monster_list(player_type *player_ptr)
 {
     for (int j = 0; j < 8; j++) {
-        term *old = Term;
+        term_type *old = Term;
         if (!angband_term[j])
             continue;
-        if (!(window_flag[j] & (PW_MONSTER_LIST)))
+        if (!(window_flag[j] & PW_MONSTER_LIST))
+            continue;
+        if (angband_term[j]->never_fresh)
             continue;
 
         term_activate(angband_term[j]);
         int w, h;
         term_get_size(&w, &h);
-        term_clear();
-        target_set_prepare_look(player_ptr);
+        target_set_prepare(player_ptr, TARGET_LOOK);
         print_monster_list(player_ptr->current_floor_ptr, 0, 0, h);
+        target_clear(player_ptr);
         term_fresh();
         term_activate(old);
     }
@@ -204,17 +213,18 @@ static void display_equipment(player_type *owner_ptr, tval_type tval)
     TERM_COLOR attr = TERM_WHITE;
     char tmp_val[80];
     GAME_TEXT o_name[MAX_NLEN];
-    for (int i = INVEN_RARM; i < INVEN_TOTAL; i++) {
+    for (inventory_slot_type i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
         object_type *o_ptr;
         o_ptr = &owner_ptr->inventory_list[i];
         tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
-        if (select_ring_slot ? is_ring_slot(i) : item_tester_okay(owner_ptr, o_ptr, tval)) {
+        if (owner_ptr->select_ring_slot ? is_ring_slot(i) : item_tester_okay(owner_ptr, o_ptr, tval)) {
             tmp_val[0] = index_to_label(i);
             tmp_val[1] = ')';
         }
 
-        term_putstr(0, i - INVEN_RARM, 3, TERM_WHITE, tmp_val);
-        if ((((i == INVEN_RARM) && owner_ptr->hidarite) || ((i == INVEN_LARM) && owner_ptr->migite)) && owner_ptr->ryoute) {
+        term_putstr(0, i - INVEN_MAIN_HAND, 3, TERM_WHITE, tmp_val);
+        if ((((i == INVEN_MAIN_HAND) && can_attack_with_sub_hand(owner_ptr)) || ((i == INVEN_SUB_HAND) && can_attack_with_main_hand(owner_ptr)))
+            && has_two_handed_weapons(owner_ptr)) {
             strcpy(o_name, _("(武器を両手持ち)", "(wielding with two-hands)"));
             attr = TERM_WHITE;
         } else {
@@ -226,21 +236,21 @@ static void display_equipment(player_type *owner_ptr, tval_type tval)
         if (o_ptr->timeout)
             attr = TERM_L_DARK;
 
-        term_putstr(3, i - INVEN_RARM, n, attr, o_name);
-        term_erase(3 + n, i - INVEN_RARM, 255);
+        term_putstr(3, i - INVEN_MAIN_HAND, n, attr, o_name);
+        term_erase(3 + n, i - INVEN_MAIN_HAND, 255);
         if (show_weights) {
             int wgt = o_ptr->weight * o_ptr->number;
             sprintf(tmp_val, _("%3d.%1d kg", "%3d.%1d lb"), _(lbtokg1(wgt), wgt / 10), _(lbtokg2(wgt), wgt % 10));
-            prt(tmp_val, i - INVEN_RARM, wid - (show_labels ? 28 : 9));
+            prt(tmp_val, i - INVEN_MAIN_HAND, wid - (show_labels ? 28 : 9));
         }
 
         if (show_labels) {
-            term_putstr(wid - 20, i - INVEN_RARM, -1, TERM_WHITE, " <-- ");
-            prt(mention_use(owner_ptr, i), i - INVEN_RARM, wid - 15);
+            term_putstr(wid - 20, i - INVEN_MAIN_HAND, -1, TERM_WHITE, " <-- ");
+            prt(mention_use(owner_ptr, i), i - INVEN_MAIN_HAND, wid - 15);
         }
     }
 
-    for (int i = INVEN_TOTAL - INVEN_RARM; i < hgt; i++)
+    for (int i = INVEN_TOTAL - INVEN_MAIN_HAND; i < hgt; i++)
         term_erase(0, i, 255);
 }
 
@@ -253,7 +263,7 @@ static void display_equipment(player_type *owner_ptr, tval_type tval)
 void fix_equip(player_type *player_ptr, tval_type item_tester_tval)
 {
     for (int j = 0; j < 8; j++) {
-        term *old = Term;
+        term_type *old = Term;
         if (!angband_term[j])
             continue;
         if (!(window_flag[j] & (PW_EQUIP)))
@@ -275,7 +285,7 @@ void fix_equip(player_type *player_ptr, tval_type item_tester_tval)
 void fix_player(player_type *player_ptr)
 {
     for (int j = 0; j < 8; j++) {
-        term *old = Term;
+        term_type *old = Term;
         if (!angband_term[j])
             continue;
 
@@ -299,7 +309,7 @@ void fix_player(player_type *player_ptr)
 void fix_message(void)
 {
     for (int j = 0; j < 8; j++) {
-        term *old = Term;
+        term_type *old = Term;
         if (!angband_term[j])
             continue;
 
@@ -333,7 +343,7 @@ void fix_message(void)
 void fix_overhead(player_type *player_ptr)
 {
     for (int j = 0; j < 8; j++) {
-        term *old = Term;
+        term_type *old = Term;
         TERM_LEN wid, hgt;
         if (!angband_term[j])
             continue;
@@ -395,7 +405,7 @@ static void display_dungeon(player_type *player_ptr)
 void fix_dungeon(player_type *player_ptr)
 {
     for (int j = 0; j < 8; j++) {
-        term *old = Term;
+        term_type *old = Term;
         if (!angband_term[j])
             continue;
 
@@ -418,7 +428,7 @@ void fix_dungeon(player_type *player_ptr)
 void fix_monster(player_type *player_ptr)
 {
     for (int j = 0; j < 8; j++) {
-        term *old = Term;
+        term_type *old = Term;
         if (!angband_term[j])
             continue;
 
@@ -443,7 +453,7 @@ void fix_monster(player_type *player_ptr)
 void fix_object(player_type *player_ptr)
 {
     for (int j = 0; j < 8; j++) {
-        term *old = Term;
+        term_type *old = Term;
         if (!angband_term[j])
             continue;
 
@@ -473,14 +483,14 @@ void toggle_inventory_equipment(player_type *owner_ptr)
         if (window_flag[j] & (PW_INVEN)) {
             window_flag[j] &= ~(PW_INVEN);
             window_flag[j] |= (PW_EQUIP);
-            owner_ptr->window |= (PW_EQUIP);
+            owner_ptr->window_flags |= (PW_EQUIP);
             continue;
         }
 
         if (window_flag[j] & PW_EQUIP) {
             window_flag[j] &= ~(PW_EQUIP);
             window_flag[j] |= PW_INVEN;
-            owner_ptr->window |= PW_INVEN;
+            owner_ptr->window_flags |= PW_INVEN;
         }
     }
 }