aboutsummaryrefslogtreecommitdiff
path: root/backend/Enemy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backend/Enemy.cpp')
-rw-r--r--backend/Enemy.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/backend/Enemy.cpp b/backend/Enemy.cpp
new file mode 100644
index 0000000..699a303
--- /dev/null
+++ b/backend/Enemy.cpp
@@ -0,0 +1,31 @@
+#include <string.h>
+
+#include "Enemy.h"
+#include "util.h"
+
+Enemy::Enemy(const char * name, const char * description) {
+ this->set_name(name);
+ this->set_description(description);
+}
+
+Enemy::~Enemy() {
+ safe_free(this->name);
+ safe_free(this->description);
+}
+
+void Enemy::set_name(const char * name) {
+ safe_free(this->name);
+ this->name = strdup(name);
+}
+const char * Enemy::get_name() {
+ return this->name;
+}
+
+void Enemy::set_description(const char * description) {
+ safe_free(this->description);
+ this->description = strdup(description);
+}
+const char * Enemy::get_description() {
+ return this->description;
+}
+