-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
executable file
·67 lines (56 loc) · 1.51 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/***************************************************************************************************
** Program Filename: main.cpp
** Author: Edwin Grove
** Date: 3/11/2016
** Description: The driver function for a text based game
** Input: none
** Output: intro.txt
****************************************************************************************************/
#include "abstractRoom.hpp"
#include "buildRoom.hpp"
#include "game.hpp"
#include "movieRoom.hpp"
#include "senseRoom.hpp"
#include "spaces.hpp"
#include "subRoom.hpp"
#include "bedroom.hpp"
#include <iostream>
#include <string>
#include <vector>
#include <fstream>
int main()
{
string line;
std::ifstream intro("Intro.txt");
inventory backpack;
spaces **room = new spaces*[6];
room[0] = new bedroom(&backpack);
room[1] = new movieRoom(&backpack);
room[2] = new senseRoom(&backpack);
room[3] = new buildRoom(&backpack);
room[4] = new abstractRoom(&backpack);
room[5] = new subRoom(&backpack);
room[0]->setPointers(room);
room[1]->setPointers(room);
room[2]->setPointers(room);
room[3]->setPointers(room);
room[4]->setPointers(room);
room[5]->setPointers(room);
if (intro.is_open()) //opening and outputting intro.txt file
{
while (std::getline(intro, line))
{
std::cout << line << '\n';
}
intro.close();
}
std::cout << std::endl;
game player(room[0], &backpack);
player.playGame();
for (int i = 0; i < 6; i++)
{
delete room[i];
}
delete room;
return 0;
}