From 197e696ef63e568bf5162bfcbacc8fe72302c86d Mon Sep 17 00:00:00 2001 From: Kai Kehres Date: Thu, 26 Jan 2023 12:22:02 +0100 Subject: [PATCH] prod/test: created getter and setter for charactername --- src/c/character.c | 7 +++++++ src/c/character.h | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/c/character.c b/src/c/character.c index 2d1d317..c994b8d 100644 --- a/src/c/character.c +++ b/src/c/character.c @@ -98,6 +98,13 @@ int getCharacterGold (Character *character){ return character->gold; } +void setCharacterName (Character *character, char *newName) { + strcpy(character->name,newName); +} + +char getCharacterName (Character *character) { + return character->name; +} void increaseStat (Character *character, int stat, int amount) { switch (stat) diff --git a/src/c/character.h b/src/c/character.h index 808c8d0..ee7973c 100644 --- a/src/c/character.h +++ b/src/c/character.h @@ -59,4 +59,9 @@ void setCharacterGold (Character *character, int newGold); int getCharacterGold (Character *character); void levelUp (Character *character); + +void setCharacterName (Character *character, char newName[]); + +char getCharacterName (Character *character); + #endif \ No newline at end of file