-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.cpp
More file actions
53 lines (45 loc) · 1.2 KB
/
node.cpp
File metadata and controls
53 lines (45 loc) · 1.2 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
#include "node.h"
#include <string>
#include <iostream>
Node::Node(){}
Node::Node(std::string ttl, std::string enterDesc, std::string nme, std::string en, std::string es,
std::string ee, std::string ew, std::string one, std::string onl, std::vector<std::string> search,
std::vector<std::string> find, std::vector<std::string> searchT, std::vector<std::string> objs) {
title = ttl;
desc = enterDesc;
enemy = nme;
exitNorth = en;
exitSouth = es;
exitEast = ee;
exitWest = ew;
onEnter = one;
onLeave = onl;
searchables = search;
findables = find;
searchText = searchT;
objects = objs;
}
bool Node::objectExists(std::string obj){
auto it = find(objects.begin(), objects.end(), obj);
if(it != objects.end())
return true;
else
return false;
}
int Node::getSearchableIndex(std::string search){
int loc = -1;
for(int i = 0; i < searchables.size(); i++){
if(searchables[i].compare(search) == 0)
loc = i;
}
return loc;
}
void Node::addObject(std::string obj){
objects.push_back(obj);
}
void Node::print(){
std::cout << desc << std::endl;
}
std::string Node::getDescription() {
return desc;
}