1 2 3 4 5 6 7 8 9 10 11 12 13
|
typedef enum { north, south, east, west } exits_t;
struct room_t
{
string name;
string description;
int exits[ sizeof( exits_t ) ]; // index of room in indicated direction
};
room_t rooms[] = {
{ "Entry hall", "This room is filled with snakes.", { -1, 1, 2, -1 } },
{ "South room", "This room is cold.", { 0, -1, 2, -1 } },
{ "East room", "This room is fragrant.", { -1, 1, -1, 0 } }
};
|