blob: a26d53024859e6b949284cdd276451d6c868233c (
plain)
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 <string.h>
#include "Location.h"
#include "ListIterator.h"
#include "util.h"
Location::Location(const char * name, const char * description) {
this->set_name(name);
this->set_description(description);
}
Location::~Location() {
safe_free(this->name);
safe_free(this->description);
}
void Location::set_name(const char * name) {
safe_free(this->name);
this->name = strdup(name);
}
const char * Location::get_name() {
return this->name;
}
void Location::set_description(const char * description) {
safe_free(this->description);
this->description = strdup(description);
}
const char * Location::get_description() {
return this->description;
}
void Location::set_exit(Direction dir, Location * location) {
this->edges[dir] = location;
}
Location * Location::get_exit(Direction dir) {
return this->edges[dir];
}
void Location::add_object(Object * object) {
this->objects.push_back(object);
}
ListRange<Object *> Location::get_objects() {
return this->objects.range();
}
void Location::add_enemy(Enemy * enemy) {
this->enemies.push_back(enemy);
}
ListRange<Enemy *> Location::get_enemies() {
return this->enemies.range();
}
|