Most of this was centred around stash pages being saved/loaded as unsigned values but stored as signed values. Consistently used unsigned since it matches the intended usage.
Makes `CelSprite` unowned and adds a new `OwnedCelSprite` class for
owned sprites.
This clarifies ownership and makes the code cleaner in a number of
places.
Additionally, because the `CelSprite` class is now tiny (1 less
pointer), we can pass it by-value instead of by-reference, removing a
pointer indirection in the rendering functions.
This was a cleanup function to handle converting saves between Hellfire <-> Diablo, mainly when a hellfire specific item was dropped and should be removed from a Diablo game. This had an off by one with the way it iterated backwards over the active items list which meant it always called DeleteItem at least once (since it uses an invalid item past the end of the active items range). DeleteItem then always decremented the ActiveItems count. When saving the game after converting the items we then end up with a dropped items array containing an index to an item that is no longer considered active.
However the code in LoadDroppedItems already checks that the conversion was successful before considering it active, so this function doesn't need to be called. Instead we can just save if we converted game mode.
This doesn't handle failed allocations (e.g. if the platform runs out of memory) but makes it easier to use a fixed size container on limited memory devices.
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.
Identified and removed an instance of Direction being used as an argument for a bool parameter
Removed a single-use temporary variable being cast from sprite frame to direction to size_t
Co-authored-by: Anders Jenbo <anders@jenbo.dk>
Fix alignment of WalkSettings array