Associate
- Joined
- 28 Sep 2003
- Posts
- 1,724
- Location
- Leamington Spa
I've been slowly working on a simple RPG shop system for some work I've been given to do.
After lots of trial and error getting all my classes working, I finally think that bit works. Now I've reached the part where I need to add all these item classes to a vector, as an inventory for the shop and the player.
I've setup the vector thusly:
vector<Item*> inventory; // setup a vector for the agents inventory
Now, I've tried lots of things, but I just can't get my addItem function to work - not even worth pasting my code as it flat out doesn't work.
Basically, how should I go about making this work? I need it to accept a pointer to a created object, and add it to the inventory vector. If I can get this working, adding/remove/selling, should be easy.
Help :O
After lots of trial and error getting all my classes working, I finally think that bit works. Now I've reached the part where I need to add all these item classes to a vector, as an inventory for the shop and the player.
I've setup the vector thusly:
vector<Item*> inventory; // setup a vector for the agents inventory
Now, I've tried lots of things, but I just can't get my addItem function to work - not even worth pasting my code as it flat out doesn't work.
Basically, how should I go about making this work? I need it to accept a pointer to a created object, and add it to the inventory vector. If I can get this working, adding/remove/selling, should be easy.
Help :O