I've used "pp" to represent the plus-plus increment operator since it doesn't appear.
So, I have a .txt file with this in it:
First room description.
door
Second room description.
hole
Third room description.
window
The 1,3,5 lines are descriptions of the rooms, and the 2,4,6 lines are the exits available in those rooms.
Now I'm trying to read in this information into a vector, and then send this information to a function that creates rooms, like this:
void GenerateRooms(int DIFFICULTY)
{
vector<string> room_descriptions;
ifstream descFile ("RoomDescriptions.txt");
if( descFile.is_open() )
{
while( !descFile.eof() )
{
string description;
getline( descFile, description );
room_descriptions.push_back(description);
}
descFile.close();
}
vector<string>::iterator iter = room_descriptions.begin();
// Initialize the various Rooms.
// The first parameter is the description,
// the second parameter is the exits, and
// the third parameter is the hint.
// the fourth parameter is the chance that a monster will spawn in the room
AddRoom(*(iter)pp, *(iter)pp, "Try the door.", DIFFICULTY);
AddRoom(*(iter)pp, *(iter)pp, "Try the hole.", DIFFICULTY);
AddRoom(*(iter)pp, *(iter)pp, "Try the trapdoor.", DIFFICULTY);
AddRoom(*(iter)pp, *(iter)pp, "none.", DIFFICULTY);
So in my vector I want the 0th element to be the room description, the 1st element to be the exits, the 2nd element the second room description, the 3rd element the second room's exit, ...
But I can't get the pp operator to work correctly. When I run this I get this output:
door
Exits: First room description.
Where those lines should be switched. What is the correct placement of the pp operator? I've tried every possibility I could find, although perhaps some funky parentheses placement is needed.