Something like this is not done with string comparison (probably the worst method
) or branches. If you have a 1000 items, you would not be relying on enumeration either.
One of the more classic ways is to create a Name|Struct map association.
- a struct that holds onto the info about the item:
- a map that associates a
Namewith the abovementioned struct:
You can utilise the same approach when creating an item database (data table)
- to fetch something, one would:
This way you never need to iterate over any elements, you state what you want, and you get it.
Consider having a look at the links. It also may not be a bad idea to grab an inventory tutorial and scrub through it, even if itβs just to get a general workflow.


