-
I just edited my last post, a few seconds before you posted. :)
There I gave a solution of how item could be made independent. I was just thinking, a more elegant way to deal with the items is to remove the global array of items and let both room and character have items.
If a character wants to have an item in a room, then it could first ask the room which items it has available and then take some of the items. You add the items as a vector in your classes. When character calls the interface getItem of room, this vector should get smaller and the element should be added to the vector of character.
This means that in character.h and room.h you have to include item.h, because character and room have items. Also in character.h you have to include room.h, since character will be using room.
-
Hey, that's a good idea. I think I'll go about doing that. It's a lot more intuitive than the item controlling where it goes. After all, it's the character who gets/drops an item, so the item shouldn't even have to worry about that. Good call!
-edit-
Heh. Looks like I'll need to restructure my code a bit. Because my items are loaded after my rooms, I'll have to use a local array to store the items temporarily and put the in the room as needed. Smooth sailing, though!