-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
66 lines (52 loc) · 1.44 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
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include "Entity.h"
#include "World.h"
#include "Player.h"
using namespace std;
int main()
{
string line;
vector<string> args;
string arg;
World world;
cout << RED_TEXT;
cout << "My Zork: Hotel Basinski\n\n";
cout << YELLOW_TEXT;
cout << "You find yourself in a floating island. In this island there is only one building, a Hotel.\n";
cout << "You don't seem to be on Earth, but you're not in space either since you're still breathing.\n";
cout << "All that surrounds you is an unnatural void. You wouldn't want to get lost in it.\n\n\n";
cout << DEFAULT_COLOR;
world.player->location->Look();
cout << YELLOW_TEXT;
cout << "\n> ";
while (true)
{
if (args.size() == 0)
getline(cin, line);
istringstream iss(line);
cout << "\n";
while (getline(iss, arg, ' '))
{
args.push_back(arg);
}
cout << DEFAULT_COLOR;
if (args.size() > 0 && (args[0] == "quit" || args[0] == "Quit" || args[0] == "q" || args[0] == "Q"))
{
break;
}
else if (world.Execute(args) == false)
{
cout << "Sorry I don't understand this command\n";
}
cout << YELLOW_TEXT;
if (args.size() > 0)
{
args.clear();
cout << "\n> ";
}
}
return 0;
}