Browse Source

Update calls to DeleteItem to use ActiveItems inline

This highlights how all (except one) call sites duplicate the i argument. With the exception of the use in msg.cpp this can be treated as a offset into activeItems and doesn't care about the real index.
pull/3586/head
ephphatha 5 years ago committed by Anders Jenbo
parent
commit
f60cc3bfd9
  1. 2
      Source/items.cpp
  2. 5
      Source/loadsave.cpp

2
Source/items.cpp

@ -3567,7 +3567,7 @@ void CornerstoneLoad(Point position)
int ii = dItem[position.x][position.y] - 1;
for (int i = 0; i < ActiveItemCount; i++) {
if (ActiveItems[i] == ii) {
DeleteItem(ii, i);
DeleteItem(ActiveItems[i], i);
break;
}
}

5
Source/loadsave.cpp

@ -928,11 +928,10 @@ void LoadDroppedItemLocations(LoadHelper &file, const std::unordered_map<uint8_t
void RemoveEmptyLevelItems()
{
for (int i = ActiveItemCount; i > 0; i--) {
int ii = ActiveItems[i];
auto &item = Items[ii];
auto &item = Items[ActiveItems[i]];
if (item.isEmpty()) {
dItem[item.position.x][item.position.y] = 0;
DeleteItem(ii, i);
DeleteItem(ActiveItems[i], i);
}
}
}

Loading…
Cancel
Save