iiag / iiag-legacy

Iiag is a game
Other
7 stars 7 forks source link

Technical Note: Inventory-item exclusivity #40

Open Grissess opened 9 years ago

Grissess commented 9 years ago

Just as a note to everyone working with items (and before I try to roll out some documentation soon), the functions inv_add() and inv_rm() in inventory.c now ensure that the item is consistently aware of the inventory it is in (via fields of and i).

This exclusivity means that an item can only be in one inventory at once. As far as I know, this was never a feature, so it shouldn't cause problems. (In fact, a SIGSEGV was fixed by enforcing this case.) The practical implications of this for developers working with inventories are:

Again, I will reflect these in the documentation when I get a chance. Get used to using them thusly; I think they're improved :D