I've been working on my text adventure, and in storing all the rooms I've come across a problem. How to store them. I want to keep them all in a vector, so they can be accessed easily, but when I do, I get an error.
Code:
#ifndef ROOM_LIST //Prevents repeat definitions.
#define ROOM_LIST
#include "Room.h"
#include <vector>
const unsigned short int roomCount=2;
std::vector<Room> roomList;
Room test1("coc_testhall", "You are standing in a large, open room. Doors line every wall, with barely a foot between them.");
roomList.push_back(test1);
Room test2("coc_armorroom", "You are standing in a square room, lined with tables; each holding multiple suits of similar armor.");
roomList.push_back(test2);
#endif
The error given is:
Originally Posted by
Dev-CPP Error
14 C:\Documents and Settings\Timothy Sassone\Text Adventure\source.cpp In file included from source.cpp
11 C:\Documents and Settings\Timothy Sassone\Text Adventure\roomListing.h expected constructor, destructor, or type conversion before '.' token
11 C:\Documents and Settings\Timothy Sassone\Text Adventure\roomListing.h expected `,' or `;' before '.' token
14 C:\Documents and Settings\Timothy Sassone\Text Adventure\roomListing.h expected constructor, destructor, or type conversion before '.' token
14 C:\Documents and Settings\Timothy Sassone\Text Adventure\roomListing.h expected `,' or `;' before '.' token
C:\Documents and Settings\Timothy Sassone\Text Adventure\Makefile.win [Build Error] [source.o] Error 1
Thank you for your time,
Timothy