OSDN Git Service

[Feature] 床上スタック選択時の順序変更動作を改善
authorHabu <habu1010+github@gmail.com>
Sat, 8 May 2021 11:19:23 +0000 (20:19 +0900)
committerHabu <habu1010+github@gmail.com>
Sat, 8 May 2021 11:19:23 +0000 (20:19 +0900)
床上アイテムを選択する時にアイテムの絞り込みがある場合、
絞り込みアイテム内の2番目のアイテムがスタックの先頭に
くるまで順序変更を繰り返す。
これにより絞り込みアイテム内の順序が変わるまで何度も
エンターを押す必要がなくなる。

src/inventory/floor-item-getter.cpp

index 2e58f42..8a54637 100644 (file)
@@ -620,7 +620,9 @@ bool get_item_floor(player_type *owner_ptr, COMMAND_CODE *cp, concptr pmt, concp
             if (g_ptr->o_idx_list.size() < 2)
                 break;
 
-            g_ptr->o_idx_list.rotate(owner_ptr->current_floor_ptr);
+            const auto next_o_idx = fis_ptr->floor_list[1];
+            while (g_ptr->o_idx_list.front() != next_o_idx)
+                g_ptr->o_idx_list.rotate(owner_ptr->current_floor_ptr);
 
             owner_ptr->window_flags |= PW_FLOOR_ITEM_LIST;
             window_stuff(owner_ptr);