-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAreaCommand.cpp
78 lines (73 loc) · 1.76 KB
/
AreaCommand.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
/**
* @file AreaCommand.cpp
* Provides the functionality for an AreaCommand in the game.
*
* @brief Source file for area command functionality.
*
* @author Michael Abrams
* @author James Boocock
* @author Toby Herbert
* @author Tatai Nikora
* @version 0.3
*/
#include "AreaCommand.h"
AreaCommand::AreaCommand(const char * callmeby, const char * areatomoveto,
const char * status_command, const char * depends_command,
std::vector<std::string> *syns, bool lock) {
name = callmeby;
depends = depends_command;
status = status_command;
move_to_area= areatomoveto;
message = "";
synonyms = syns;
locked = lock;
}
std::string AreaCommand::get_depends() {
return depends;
}
AreaCommand::~AreaCommand() {
if(synonyms!=NULL){
delete synonyms;
}
}
std::string AreaCommand::get_status() {
return status;
}
std::string AreaCommand::get_name() {
return name;
}
std::string AreaCommand::get_area() {
return move_to_area;
}
std::string AreaCommand::get_message() {
return message;
}
void AreaCommand::set_message(const char *to_message) {
message = to_message;
}
bool AreaCommand::find(std::string to_find) {
if(!to_find.compare(name)) {
return true;
}
else {
return false;
}
}
void AreaCommand::unlock() {
locked = false;
}
bool AreaCommand::is_locked() {
return locked;
}
bool AreaCommand::has_synonym(std::string item) {
std::vector<std::string>& synonymsRef = *synonyms;
if(synonyms == NULL) {
return false;
}
for(unsigned int count = 0; count < synonyms->size(); count++) {
if(synonymsRef[count].compare(item) == 0) {
return true;
}
}
return false;
}