Constructing a text adventure

Okay! so here i am working with a new text adventure. The way i want to construct it is by having
a class for all living things. in the class you have basic things as:
health, gold, vector for inventory holding "struct item". etc...

There is also a class called world, wich navigates through the world.
World class contains of: player location, and a map containing info about the room etc...

Here comes the problem. I want there to be characters to be placed out in different maps, so basically i want the world class to hold objects from Character.

Here is my idea on how to do it.
in world class i made a map...

std::map<int,"content">

content is a struct i made above in world class:
1
2
3
4
5
6
struct content{
	std::string name; // location name
	std::string info; // info about location
	std::vector<Character>characters;
	std::vector<item>items;
};



To sum it up, i have a std::map<int,content>map
the int stands for location id.
content holds more info about the room and what's in it

btw the classes are in different files and that means i have to include "Character.h" in the world file so i can set up the vector of characters.
Is that bad to do?
I hope you understand what i mean! Thankyou for reading :)
Tell me about how you've constructed your text adventure :D
Is that bad to do?
No, put separate thing in separate files.

Use more descriptive names. Instead of using a generic name like 'content' name it 'location' since you want to use it that way.

I'd assume that characters and items will change (i.e. inserted and removed). So list would be a better container.

To sum it up, i have a std::map<int,content>map
the int stands for location id.
This looks rather like a vector...
Thankyou :) I'll keep working on it!
Yeah using a vector instead of map might be a better idea :P
Topic archived. No new replies allowed.