Skip to content

Commit

Permalink
Updated get_next_bag_slot() to account for a PR in GWCA which fixes a…
Browse files Browse the repository at this point in the history
… bug in the GW::Constants::Bag prefix increment operator overload. This PR can be pulled prior to the GWCA PR, as the behavior is unchanged. The prefix increment simply had to be moved to a non-const object, as the increment operator now returns a reference (as expected) instead of a copy. The prefix operator is expected to modify the variable is it being used upon, which is invalid for a const object.
  • Loading branch information
zhro committed Sep 2, 2024
1 parent 8cf2959 commit 4979bcd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion GWToolboxdll/Modules/InventoryManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1502,7 +1502,8 @@ bool get_next_bag_slot(const InventoryManager::Item* item, GW::Constants::Bag* b
if (slot >= bag->items.size()) {
bag_id = GW::Constants::Bag::Max;
slot = 0;
for (auto it_bag_id = ++bag->bag_id(); it_bag_id < GW::Constants::Bag::Max; it_bag_id++) {
auto bag_start = bag->bag_id();
for (auto it_bag_id = ++bag_start; it_bag_id < GW::Constants::Bag::Max; it_bag_id++) {
const auto it_bag = GW::Items::GetBag(it_bag_id);
if (it_bag) {
bag_id = it_bag_id;
Expand Down

0 comments on commit 4979bcd

Please sign in to comment.