OSDN Git Service

[Fix] #41426 fresh-afterオフ時のターゲットの挙動がおかしい
authordis- <dis.rogue@gmail.com>
Tue, 2 Feb 2021 09:47:11 +0000 (18:47 +0900)
committerdis- <dis.rogue@gmail.com>
Tue, 2 Feb 2021 09:47:11 +0000 (18:47 +0900)
\e\e\et1*のように、マクロの最後の入力を*にしたときターゲット取得の挙動が変化する。
本来はprojectableな対象のみを+などでハイライトするはずが、あらゆる対象を追ってしまうようになっていた。
この現象がfresh-afterオフのときのみ発生することから原因箇所を特定した。
fix_monster_listをfresh-afterの範囲外に出すことでバグ発生を回避できる。
いずれ根本的に対処した方が良い。

src/core/window-redrawer.c
src/term/z-term.c
src/window/display-sub-windows.c

index 56b8e28..1bf740b 100644 (file)
@@ -22,6 +22,7 @@
 #include "window/main-window-util.h"
 #include "world/world-turn-processor.h"
 #include "world/world.h"
+#include <target\target-types.h>
 
 /*!
  * todo ここにplayer_type を追加するとz-termに影響が行くので保留
@@ -228,10 +229,7 @@ void window_stuff(player_type *player_ptr)
 {
     if (!player_ptr->window)
         return;
-
-    if (!need_term_fresh(player_ptr))
-        return;
-
+    
     BIT_FLAGS mask = 0L;
     for (int j = 0; j < 8; j++) {
         if (angband_term[j])
@@ -243,52 +241,53 @@ void window_stuff(player_type *player_ptr)
     if (!player_ptr->window)
         return;
 
-    if (player_ptr->window & (PW_INVEN)) {
+    if (need_term_fresh(player_ptr) && player_ptr->window & (PW_INVEN)) {
         player_ptr->window &= ~(PW_INVEN);
         fix_inventory(player_ptr, 0); // TODO:2.2.2 まともなtval参照手段を確保
     }
 
-    if (player_ptr->window & (PW_EQUIP)) {
+    if (need_term_fresh(player_ptr) && player_ptr->window & (PW_EQUIP)) {
         player_ptr->window &= ~(PW_EQUIP);
         fix_equip(player_ptr, 0); // TODO:2.2.2 まともなtval参照手段を確保
     }
 
-    if (player_ptr->window & (PW_SPELL)) {
+    if (need_term_fresh(player_ptr) && player_ptr->window & (PW_SPELL)) {
         player_ptr->window &= ~(PW_SPELL);
         fix_spell(player_ptr);
     }
 
-    if (player_ptr->window & (PW_PLAYER)) {
+    if (need_term_fresh(player_ptr) && player_ptr->window & (PW_PLAYER)) {
         player_ptr->window &= ~(PW_PLAYER);
         fix_player(player_ptr);
     }
 
     if (player_ptr->window & (PW_MONSTER_LIST)) {
-        player_ptr->window &= ~(PW_MONSTER_LIST);
-        fix_monster_list(player_ptr);
+        if (need_term_fresh)
+            player_ptr->window &= ~(PW_MONSTER_LIST);
+        fix_monster_list(player_ptr); //need this side-effect for work targetting collect
     }
 
-    if (player_ptr->window & (PW_MESSAGE)) {
+    if (need_term_fresh(player_ptr) && player_ptr->window & (PW_MESSAGE)) {
         player_ptr->window &= ~(PW_MESSAGE);
         fix_message();
     }
 
-    if (player_ptr->window & (PW_OVERHEAD)) {
+    if (need_term_fresh(player_ptr) && player_ptr->window & (PW_OVERHEAD)) {
         player_ptr->window &= ~(PW_OVERHEAD);
         fix_overhead(player_ptr);
     }
 
-    if (player_ptr->window & (PW_DUNGEON)) {
+    if (need_term_fresh(player_ptr) && player_ptr->window & (PW_DUNGEON)) {
         player_ptr->window &= ~(PW_DUNGEON);
         fix_dungeon(player_ptr);
     }
 
-    if (player_ptr->window & (PW_MONSTER)) {
+    if (need_term_fresh(player_ptr) && player_ptr->window & (PW_MONSTER)) {
         player_ptr->window &= ~(PW_MONSTER);
         fix_monster(player_ptr);
     }
 
-    if (player_ptr->window & (PW_OBJECT)) {
+    if (need_term_fresh(player_ptr) && player_ptr->window & (PW_OBJECT)) {
         player_ptr->window &= ~(PW_OBJECT);
         fix_object(player_ptr);
     }
index 839a497..3c19667 100644 (file)
@@ -1029,10 +1029,7 @@ bool macro_running(void)
     return diff < -1 || 1 < diff;
 }
 
-bool need_term_fresh(player_type *player_ptr) { 
-    return (!macro_running() && !continuous_action_running(player_ptr)) 
-        || fresh_after; 
-}
+bool need_term_fresh(player_type *player_ptr) { return (!macro_running() && !continuous_action_running(player_ptr)) || fresh_after; }
 
 /*
  * @brief Actually perform all requested changes to the window
index 1f1230b..0bbf4b9 100644 (file)
@@ -185,7 +185,8 @@ void fix_monster_list(player_type *player_ptr)
         term_clear();
         target_set_prepare(player_ptr, TARGET_LOOK);
         print_monster_list(player_ptr->current_floor_ptr, 0, 0, h);
-        term_fresh();
+        if (need_term_fresh(player_ptr))
+            term_fresh();
         term_activate(old);
     }
 }