-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRooms.cpp
More file actions
148 lines (135 loc) · 2.91 KB
/
Rooms.cpp
File metadata and controls
148 lines (135 loc) · 2.91 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/****************************************************************************************************
** Program name: Eldritch Estate text adventure Game (CS 162 Final Project)
** Author: Alejandro Romero
** Date: 2/14/2017
** Description: This program is an H.P Lovecraft inspired horror mystery themed text adventure game.
** The goal of the game will be for the player to piece together clues to solve a mystery and stop a
** powerful creature before they go insane. (Sanity loss will be how I implement my time limit.)
** The game will take place at an estate which contains many rooms (linked pointer variables)
** to be explored. The program also makes use of containers for inventory and discard piles.
** The game is won once the final boss has been defeated, and lost if the player dies (health reached 0)
** or goes insane before they can solve the mystery. (sanity reaches 0).
******************************************************************************************************/
#include "Rooms.hpp"
Room::Room(string n)
{
if (n == "Foyer")
{
this->roomName = n;
}
else if (n == "Study")
{
this->roomName = n;
}
else if (n == "Dining Room")
{
this->roomName = n;
}
else if (n == "Kitchen")
{
this->roomName = n;
}
else if (n == "Hallway")
{
this->roomName = n;
}
else if (n == "Basement")
{
this->roomName = n;
}
else if (n == "Master Bedroom")
{
this->roomName = n;
}
else if (n == "Guest Bedroom")
{
this->roomName = n;
}
else if (n == "Ceremony Chamber")
{
this->roomName = n;
}
//initialize all location pointers to NULL
this->up = NULL;
this->down = NULL;
this->right = NULL;
this->left = NULL;
}
void Room::showImage()
{
}
void Room::setDoorToUnlock(bool tOrF)
{
doorIsUnlocked = tOrF;
}
void Room::setPointer(char dir, Room* loc)
{
if (dir == 'R')
{
this->right = loc;
}
else if (dir == 'L')
{
this->left = loc;
}
else if (dir == 'U')
{
this->up = loc;
}
else if (dir == 'D')
{
this->down = loc;
}
}
void Room::setLightsOn(bool TorF)
{
this->roomLit = TorF;
}
void Room::setEnemyDefeated(bool TorF)
{
enemyDefeated = TorF;
}
void Room::setHasBeenHere(bool yON)
{
hasBeenHere = yON;
}
/*void Room::setHasRune(bool TorF)
{
runeAquired = TorF;
}*/
Room * Room::getRight()
{
return right;
}
Room * Room::getLeft()
{
return left;
}
Room * Room::getUp()
{
return up;
}
Room * Room::getDown()
{
return down;
}
string Room::getName()
{
return roomName;
}
int Room::inputValidation(std::string s)
{
int num;
//run the desired prompt
cout << s << endl;
cin >> num;
//if value entered is not an integer, ask the user to re-try
while (!cin)
{
cout << "Invalid choice. Please enter an integer value instead." << endl;
cin.clear(); //clears the error flag on cin
cin.ignore(); //needed.
cin >> num;
}
return num;
}