Browse Source

prod: created initializeInventory function

remotes/origin/nextcycle
Kai Kehres 2 years ago
parent
commit
daea02f10a
  1. 7
      src/c/character.c
  2. 1
      src/c/character.h

7
src/c/character.c

@ -247,6 +247,13 @@ char* getItemName (Item *item) {
return item->name; return item->name;
} }
void initializeInventory (Character *character) {
for (int i = 0; i < 10; i++)
{
character->inventory[i] = NULL;
}
}
void putItemInInventory (Character *character, Item *item,int inventorySlot) { void putItemInInventory (Character *character, Item *item,int inventorySlot) {
if(inventorySlot > 9) { if(inventorySlot > 9) {
printf("Inventory slot is out of range (0-9)\n"); printf("Inventory slot is out of range (0-9)\n");

1
src/c/character.h

@ -123,4 +123,5 @@ char* getItemName (Item *item);
void putItemInInventory (Character *character, Item *item, int inventorySlot); void putItemInInventory (Character *character, Item *item, int inventorySlot);
void initializeInventory (Character *character);
#endif #endif
Loading…
Cancel
Save