Quote:
|
Originally Posted by MerakSpielman
So the only difference I can think of is that my player_inventory vector is a global vector, but my room_contents vector is inside a "Room" object. Should that really make a difference?
|
No, it shouldn't. If you've put some objects into the vector inside the same "Room" object, you would still be able to use it, like using the player inventory. It just confuses me, because you say you've made the room inventory almost identical to the player inventory, but it still won't work.
By the way, I noticed you're using the
operator[] for your vector; you should rather use
vector::at.
operator[] does not check whether the given index is out of range or not;
vector::at does. If the given index is out of range,
vector::at will throw a
std:: out_of_range-exception.
Code:
myVector.at(index);