-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathItemCommand.cpp
114 lines (96 loc) · 2.43 KB
/
ItemCommand.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
/**
* @file ItemCommand.cpp
* Provides the functionality for an ItemCommand.
*
* @brief Source file for an ItemCommand.
*
* @author Michael Abrams
* @author James Boocock
* @author Toby Herbert
* @author Tatai Nikora
* @version 0.3
*/
#include "ItemCommand.h"
#include <iostream>
ItemCommand::ItemCommand(const char * callmeby, const char * state_mutator,
bool chng_collec, bool collec_dep, const char *area_chng,
const char* status_command, const char* depends,
std::vector<std::string> *syns, std::string unlocks, bool combine) {
this->call_combine = combine;
name = callmeby;
this->depends = depends;
state_change = state_mutator;
area_change = area_chng;
change_collect = chng_collec;
collect_dependent = collec_dep;
status = status_command;
message = "";
synonyms = syns;
unlock = unlocks;
}
bool ItemCommand::is_combine(){
return call_combine;
}
std::string ItemCommand::get_depends() {
return depends;
}
bool ItemCommand::get_change_collect() {
return change_collect;
}
bool ItemCommand::get_collect_dependent() {
return collect_dependent;
}
std::string ItemCommand::get_area_change() {
return area_change;
}
std::string ItemCommand::get_status() {
return status;
}
ItemCommand::~ItemCommand() {
if(synonyms!=NULL){
delete synonyms;
}
}
std::string ItemCommand::get_message() {
return message;
}
std::string ItemCommand::get_name() {
return name;
}
std::string ItemCommand::get_state_change() {
return state_change;
}
void ItemCommand::set_message(const char *to_message) {
message = to_message;
}
bool ItemCommand::check_synonyms(std::string command) {
std::vector<std::string>& synonymsRef = *synonyms;
if(synonyms == NULL) {
return false;
}
for(unsigned int count = 0; count < synonyms->size(); count++) {
if(!synonymsRef[count].compare(command)) {
return true;
}
}
return false;
}
bool ItemCommand::unlocks() {
if(unlock.compare(NONE)==0) {
return false;
}
return true;
}
std::string ItemCommand::unlock_area_string() {
size_t found;
found = unlock.find_first_of('/');
return unlock.substr(0,found);
}
std::string ItemCommand::unlock_areacommand_string() {
size_t found;
found = unlock.find_first_of('/');
return unlock.substr(found + 1, unlock.size());
}
std::string ItemCommand::get_unlock_string(){
return unlock;
}