Is there a good way to build a map in C++ for a text based adventure? A room should obviously have some sort of unique identifier (probably an integer) and an identifier that links the room to its exits, but I'm not sure the best way to implement that.
class Room
{
public:
Room();
~Room();
string getRoomDescription();
int getRoomNumber();
int getNorthRoom();
int getSouthRoom();
int getEastRoom();
int getWestRoom();
void setRoomDescription(string &suppliedDescription);
void setRoomNumber(int suppliedRoomNumber);
void setNorthRoom(int suppliedRoomNumber);
void setSouthRoom(int suppliedRoomNumber);
void setEastRoom(int suppliedRoomNumber);
void setWestRoom(int suppliedRoomNumber);
private:
string roomDescription;
int roomNumber;
int northRoom;
int southRoom;
int eastRoom;
int westRoom;
};
I was thinking I could just use unique room numbers as integers and "northRoom", "southRoom" . . . would hold the unique integers to the rooms that they exit to. If it held a -1 then there would be no exit there. But then I was also thinking you could use pointers. . . I just don't know the "right" way to do it. Any suggestions on how to implement an "Area" or small map in C++ for a text game?
Also, does anyone have any resources/books they could recommend to building text games??