From a9711f8a7818e95ef3fc21113a2736b6afe52364 Mon Sep 17 00:00:00 2001 From: Kai Kehres Date: Sat, 28 Jan 2023 19:26:46 +0100 Subject: [PATCH] prod: created new struct item and getter setter --- src/c/character.h | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/c/character.h b/src/c/character.h index 99d354e..849f08e 100644 --- a/src/c/character.h +++ b/src/c/character.h @@ -3,13 +3,18 @@ typedef struct { int strength,dexterity,intelligence,healthPoints,manaPoints,level,exp,maxExp; - int attack,armor,maxHealthPoints,gold,items[10],weaponClass,statPoints; + int attack,armor,maxHealthPoints,gold,*items[10],weaponClass,statPoints; char name [50]; } Character; typedef struct { int attack,durability; char name [50]; } Weapon; +typedef struct { + int id,amount,damage,healing,mana; + char name [50]; + } Item; + enum { SWORD = 1, BOW = 2, STAFF = 3 @@ -91,4 +96,30 @@ void setCharacterStatPoints (Character *character, int newStatPoints); int getCharacterStatPoints (Character *character); void initializeCharacter (Character *character,int weaponClass); + +void setItemID (Item *item, int newID); + +int getItemID (Item *item); + +void setItemAmount (Item *item, int newAmount); + +int getItemAmount (Item *item); + +void setItemDamage (Item *item, int newDamage); + +int getItemDamage (Item *item); + +void setItemHealing (Item *item, int newHealing); + +int getItemHealing (Item *item); + +void setItemMana (Item *item, int newMana); + +int getItemMana (Item *item); + +void setItemName (Item *item, char newName[]); + +char* getItemName (Item *item); + + #endif \ No newline at end of file