forked from mayant15/AlmostPure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
227 lines (171 loc) · 4.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
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <fstream>
#include <sstream>
#include "Event.h"
#include "Dolphin.h"
using namespace std;
string readLine(ifstream& in){
string ss = "";
string line;
getline(in, line);
while(line != "----"){
ss += line + '\n';
getline(in, line);
}
return ss;
}
int main(void) {
Dolphin meriel("Meriel", true);
Dolphin lePoo("Le Poo", false);
int resp;
string m;
vector<string> op;
Event* e;
Event* e1;
Event* currentEvent;
ifstream infile;
infile.open("script.txt");
/*Setup the Tree here*/
m = readLine(infile);
Event instructions(m, 0, 0);
m = readLine(infile);
op.push_back(readLine(infile));
op.push_back(readLine(infile));
Event start(m, op, 0, 0);
op.clear();
instructions.setNext(&start);
//if punched
m = readLine(infile);
e = new Event(m , 0, 0);
start.setNext(e);
//if not punched
m = readLine(infile);
e = new Event(m , 0, 0);
start.setNext(e);
//Random monologue
m = readLine(infile);
e = new Event(m, 0, 0);
start.getNext(1)->setNext(e);
start.getNext(2)->setNext(e);
//Talk with king
m = readLine(infile);
op.push_back(readLine(infile));
op.push_back(readLine(infile));
e1 = new Event(m, op, 0, 0);
e->setNext(e1);
op.clear();
//if joke getting old
m = readLine(infile);
e = new Event(m, 0, 0);
e1->setNext(e);
//if joined
m = readLine(infile);
e = new Event(m, 0, 0);
e1->setNext(e);
//Merial question
m = readLine(infile);
op.push_back(readLine(infile));
op.push_back(readLine(infile));
e = new Event(m, op, 0, 0);
e1->getNext(1)->setNext(e);
e1->getNext(2)->setNext(e);
op.clear();
//grill or fry?
m = readLine(infile);
e1 = new Event(m, -2, 0);
e->setNext(e1);
//work?
m = readLine(infile);
e1 = new Event(m, 2, 0);
e->setNext(e1);
//going to the room and meeting Mario
m = readLine(infile);
op.push_back(readLine(infile));
op.push_back(readLine(infile));
e1 = new Event(m, op, 0, 0);
e->getNext(1)->setNext(e1);
e->getNext(2)->setNext(e1);
op.clear();
//start conversation
m = readLine(infile);
e = new Event(m, 0, 0);
e1->setNext(e);
//reached room
m = readLine(infile);
e = new Event(m, 0, 0);
e1->setNext(e);
e1->getNext(1)->setNext(e);
//Inside room
m = readLine(infile);
e1 = new Event(m, 0, 0);
e->setNext(e1);
//Doraemon
m = readLine(infile);
op.push_back(readLine(infile));
op.push_back(readLine(infile));
e = new Event(m, op, 0, 0);
e1->setNext(e);
op.clear();
//peek
m = readLine(infile);
e1 = new Event(m, -2, 0);
e->setNext(e1);
//Ignore
m = readLine(infile);
e1 = new Event(m, 0, 0);
e->setNext(e1);
//Photo shoot morning
m = readLine(infile);
e1 = new Event(m, 0, 0);
e->getNext(1)->setNext(e1);
e->getNext(2)->setNext(e1);
//Stan Lee
m = readLine(infile);
op.push_back(readLine(infile));
op.push_back(readLine(infile));
op.push_back(readLine(infile));
e = new Event(m, op, 0, 0);
e1->setNext(e);
//fit
m = readLine(infile);
e1 = new Event(m, 0, 0);
e->setNext(e1);
//meet meriel
m = readLine(infile);
Event* e2 = new Event(m, 0, 0);
e->setNext(e2);
e1->setNext(e2);
//look around
m = readLine(infile);
Event* e3 = new Event(m, 0, 0);
e->setNext(e3);
//meriel late
m = readLine(infile);
e1 = new Event(m, 3, 0);
e3->setNext(e1);
//Le Poo Intro Deck
m = readLine(infile);
e = new Event(m, 0, 0);
e1->setNext(e);
e2->setNext(e);
//end
m = readLine(infile);
e1 = new Event(m, 0, 0);
e->setNext(e1);
currentEvent = &instructions;
infile.close();
do{
currentEvent->updateStats(meriel,lePoo);
currentEvent->trigger();
cin >> resp;
while(resp == 0){
cout << endl << "STATS" << endl << "Meriel: " << meriel.getLove() << " Le Poo: " << lePoo.getLove() << endl << endl;
cin >> resp;
}
currentEvent = currentEvent->getNext(resp);
} while(1);
currentEvent->trigger();
return 0;
}