about summary refs log tree commit diff
path: root/src/entities/character.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/entities/character.rs')
-rw-r--r--src/entities/character.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/entities/character.rs b/src/entities/character.rs
index 7bcb8b5c87e4..b917f140e635 100644
--- a/src/entities/character.rs
+++ b/src/entities/character.rs
@@ -13,6 +13,8 @@ pub struct Character {
 
     /// The position of the character, relative to the game
     pub position: Position,
+
+    pub o_name: Option<String>,
 }
 
 impl Character {
@@ -20,6 +22,7 @@ impl Character {
         Character {
             id: None,
             position: Position { x: 0, y: 0 },
+            o_name: None,
         }
     }
 
@@ -31,6 +34,16 @@ impl Character {
         // TODO
         1
     }
+
+    pub fn name<'a>(&'a self) -> &'a str {
+        self.o_name
+            .as_ref()
+            .expect("Character name not initialized")
+    }
+
+    pub fn set_name(&mut self, name: String) {
+        self.o_name = Some(name);
+    }
 }
 
 entity!(Character);