I have a concept of array with items, i.e. itemdatabase from which I get an index which I then use to reference my items in inventory and other places.
The problem I have is that some items are quite different with different properties.
So they have different properties (which I need to read and write).
From a coding point of view, I add new properties as well so, regression testing is a pain because using a single structure occasionally breaks code.
I have an item type that I thought might be used to point me to the item type’s structure , however, this means I need to use enums OR array indexes for lookups, ( array indexes have the mutation problem and enums means I compare strings to enums.
Honestly I’d simplify it overall. I wouldn’t pack all of that into a single parent struct.
Have an Inventory variable for each “type” of inventory item. Types would be items using the same data structure. As @3dRaven said… database. You’d have a table (variable) for each specific type following a strict field type structure (struct).
Health/Meds
Consumables
Ammo
Weapons
Gear
Armor
Keep the prototyping setup as simple as possible to reduce breaking. Once you figure out the final requirements, then start packing structures and arrays.