diff options
Diffstat (limited to 'backend/Enemy.cpp')
-rw-r--r-- | backend/Enemy.cpp | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/backend/Enemy.cpp b/backend/Enemy.cpp index 699a303..bb39359 100644 --- a/backend/Enemy.cpp +++ b/backend/Enemy.cpp @@ -1,31 +1,10 @@ -#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); -} +Enemy::Enemy(const String & name, const String & description) : name(name), description(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_name(const String & name) { this->name = name; } +const String & Enemy::get_name() const { 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; -} +void Enemy::set_description(const String & description) { this->description = description; } +const String & Enemy::get_description() const { return this->description; } |