Reduces the size of the `PathNodes` array from 28 KiB to just 8 KiB.
Also reduces the size of `pnode_tblptr` from `300 * sizeof(void *)` to
`300 * 2` bytes.
Introduces new functions to check for presence of and remove player items.
These functions do not rely on or expose item indices.
They're implemented as free functions instead of Player methods due to
complicated include dependencies between `player.h`, `inv.h`, and
`inv_iterators.h`. We should probably look into cleaning this up at some
point.
Previously this was falling back to FunctionCase, leading to inconsistent casing of class methods throughout the codebase. Applied to Item as an example.
Used when moving from one persistent variable to another where we want the source variable to be marked empty. Defining as a function instead of move constructor/assignment operator as we only really need to mark the source for xvalues. Detecting that in the constructor/assignment would be needlessly complicated.
This cleans up a bit of code and solves a few edge cases where an item
could be lost, the game be unresponsive, or miss fire an event during
lag cause of the cursor not reflecting the currently held item.
* Move declaration of dItems to items.cpp
This array is never used in dungeon generation, it's closely related to Items so should be kept together. Ideally managing dItems can become responsibility of a container for Items, which will handle adding/removing items from the list and keeping the positions in sync.
* Rename SetPlrHandItem to match purpose/use
* Give more descriptive name to GetPlrHandSeed
This function sets a new seed on a given item struct, not just the held item.
* Don't use HoldItem as a temporary for the players initial inventory
* Take Item by reference in RespawnItem
* Don't use holdItem as a temporary when dropping gold on death
* Update DeadItem to take item by reference, and refer to it consistently
Move code which invalidates the source of dropped items to the caller
Most call sites use a temporary item instance or remove the item from the container, so there's no real point invalidating the item after it's been copied to the drop list.
Update DeadItem to take position instead of player references
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.