1 #include "object/object-index-list.h"
2 #include "system/floor-type-definition.h"
3 #include "system/item-entity.h"
7 void ObjectIndexList::add(FloorType *floor_ptr, OBJECT_IDX o_idx, IDX stack_idx)
10 stack_idx = o_idx_list_.empty() ? 1 : floor_ptr->o_list[o_idx_list_.front()].stack_idx + 1;
13 auto it = std::partition_point(
14 o_idx_list_.begin(), o_idx_list_.end(), [floor_ptr, stack_idx](IDX idx) { return floor_ptr->o_list[idx].stack_idx > stack_idx; });
16 o_idx_list_.insert(it, o_idx);
17 floor_ptr->o_list[o_idx].stack_idx = stack_idx;
20 void ObjectIndexList::remove(OBJECT_IDX o_idx)
22 o_idx_list_.remove(o_idx);
25 void ObjectIndexList::rotate(FloorType *floor_ptr)
27 if (o_idx_list_.size() < 2) {
31 o_idx_list_.push_back(o_idx_list_.front());
32 o_idx_list_.pop_front();
34 for (const auto o_idx : o_idx_list_) {
35 floor_ptr->o_list[o_idx].stack_idx++;
38 floor_ptr->o_list[o_idx_list_.back()].stack_idx = 1;