From c82c5855f72438ea135a82eaffd0c911e733ddcc Mon Sep 17 00:00:00 2001 From: KRUGSON Date: Sun, 5 Feb 2023 03:42:18 +0100 Subject: [PATCH] add player struct + addItemToInventory into main --- src/c/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/c/main.c b/src/c/main.c index 375c150..a64da20 100644 --- a/src/c/main.c +++ b/src/c/main.c @@ -8,6 +8,7 @@ #include "nav_helper.h" #include "items.h" #include "shop.h" +#include "player.h" bool gameRunning; bool acceptedRules; @@ -15,6 +16,7 @@ bool acceptedRules; // declare needed variables Room *map; Item *availableItems; +Player actualPlayer; int inputCounter = 0; // content @@ -37,6 +39,7 @@ void printStatus(); int main() { // define variables + actualPlayer.id = 1; char userInput[20]; // maximum defined user input length gameRunning = 1; @@ -134,7 +137,7 @@ void processInput(char userInput[20]) int result = openShop(availableItems); // result > 0 -> integer = index of item OR result = 0 -> cancel if (result > 0) { - // buyItem -> we need inventory for player first + addItemToInventory(availableItems, result, actualPlayer); } printStatus(); }