-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
34 lines (28 loc) · 825 Bytes
/
Copy pathmain.cpp
File metadata and controls
34 lines (28 loc) · 825 Bytes
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
#include "GameObject.h"
#include "Trigger.h"
#include "Condition.h"
#include "HasCondition.h"
#include "StatusCondition.h"
#include "Container.h"
#include "Room.h"
#include "Item.h"
#include "Game.h"
#include <string>
#include <iostream>
#include <vector>
using namespace std;
int main (int argc, char *argv[]) {
Game* myGame = new Game("xml_source/triggersample.xml");
myGame->cur_room = myGame->getRoom("Entrance");
cout << myGame->cur_room->description << endl;
while (!myGame->gameOver) {
myGame->turn_num++;
getline(cin, myGame->input);
// check all triggers, and only execute command if not triggered
if (!myGame->checkAllTriggers()) {
myGame->handleCommand(myGame->input);
}
// keep checking triggers until effects are over
while (myGame->checkAllTriggers()) {}
}
}