| 642 | } |
| 643 | |
| 644 | void ScriptList::RemoveBottom(SQInteger count) |
| 645 | { |
| 646 | this->modifications++; |
| 647 | |
| 648 | if (!this->sort_ascending) { |
| 649 | this->Sort(this->sorter_type, !this->sort_ascending); |
| 650 | this->RemoveTop(count); |
| 651 | this->Sort(this->sorter_type, !this->sort_ascending); |
| 652 | return; |
| 653 | } |
| 654 | |
| 655 | switch (this->sorter_type) { |
| 656 | default: NOT_REACHED(); |
| 657 | case SORT_BY_VALUE: |
| 658 | for (auto iter = this->values.rbegin(); iter != this->values.rend(); iter = this->values.rbegin()) { |
| 659 | if (--count < 0) return; |
| 660 | this->RemoveItem(iter->second); |
| 661 | } |
| 662 | break; |
| 663 | |
| 664 | case SORT_BY_ITEM: |
| 665 | for (auto iter = this->items.rbegin(); iter != this->items.rend(); iter = this->items.rbegin()) { |
| 666 | if (--count < 0) return; |
| 667 | this->RemoveItem(iter->first); |
| 668 | } |
| 669 | break; |
| 670 | } |
| 671 | } |
| 672 | |
| 673 | void ScriptList::RemoveList(ScriptList *list) |
| 674 | { |
no test coverage detected