Browse Source

prod: created getter and setter for character status

remotes/origin/nextcycle
Kai Kehres 2 years ago
parent
commit
c4cadbbec0
  1. 8
      src/c/character.c
  2. 6
      src/c/character.h
  3. 2
      src/c/spell.h

8
src/c/character.c

@ -247,6 +247,14 @@ char* getItemName (Item *item) {
return item->name; return item->name;
} }
void setCharacterStatus (Character *character, int newStatus) {
character->status = newStatus;
}
int getCharacterStatus (Character *character) {
return character->status;
}
void initializeInventory (Character *character) { void initializeInventory (Character *character) {
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {

6
src/c/character.h

@ -7,7 +7,7 @@ typedef struct {
} Item; } Item;
typedef struct { typedef struct {
int strength,dexterity,intelligence,healthPoints,manaPoints,level,exp,maxExp; int strength,dexterity,intelligence,healthPoints,manaPoints,level,exp,maxExp;
int attack,armor,maxHealthPoints,gold,weaponClass,statPoints;
int attack,armor,maxHealthPoints,gold,weaponClass,statPoints,status;
char name [50]; char name [50];
Item *inventory[10]; Item *inventory[10];
} Character; } Character;
@ -126,4 +126,8 @@ void putItemInInventory (Character *character, Item *item, int inventorySlot);
void initializeInventory (Character *character); void initializeInventory (Character *character);
Item * getItemInInventory (Character *character, int inventorySlot); Item * getItemInInventory (Character *character, int inventorySlot);
void setCharacterStatus (Character *character, int newStatus);
int getCharacterStatus (Character *character);
#endif #endif

2
src/c/spell.h

@ -15,4 +15,6 @@ enum {
SpellEffect spellFireball(Character *character); SpellEffect spellFireball(Character *character);
SpellEffect spellHeal(Character *character); SpellEffect spellHeal(Character *character);
#endif #endif
Loading…
Cancel
Save