Browse Source

prod/test: created getter and setter for charactername

remotes/origin/thirdcycle
Kai Kehres 2 years ago
parent
commit
197e696ef6
  1. 7
      src/c/character.c
  2. 5
      src/c/character.h

7
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)

5
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
Loading…
Cancel
Save