aboutsummaryrefslogtreecommitdiff
path: root/backend/Location.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-29 20:01:27 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-29 20:01:27 +0100
commit9283e1eb66d6ff96b02f317e28cb6ff060953cdf (patch)
treec03d853ef620216f1c2299936004f56c6c3cee04 /backend/Location.cpp
parent7285f9f2c2622acff734e31314f92df9b25cae16 (diff)
WIP load XML
Diffstat (limited to 'backend/Location.cpp')
-rw-r--r--backend/Location.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/backend/Location.cpp b/backend/Location.cpp
new file mode 100644
index 0000000..8a79af5
--- /dev/null
+++ b/backend/Location.cpp
@@ -0,0 +1,38 @@
+#include <string.h>
+
+#include "Location.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];
+}
+