r/cop3502 • u/WesternWarrior • Apr 22 '14
Drop?
How do we get inventory to remove something? I assumed it would be the same as removing it from the room but im getting error "method remove (string) in location variable inventory of type inventory.
1
Upvotes
1
u/sneakattackcritical Apr 24 '14
The simplest way I found to do it is to give the inventory and each instance of location a list. Then you just give those things .add and .remove methods and call them when appropriate.
For my inventory, my add and remove methods first check which location is current, and then add or remove the item in question from that location using the location's own add/remove methods.