Browse Source

add player struct + addItemToInventory into main

remotes/origin/navigation
KRUGSON 2 years ago
parent
commit
c82c5855f7
  1. 5
      src/c/main.c

5
src/c/main.c

@ -8,6 +8,7 @@
#include "nav_helper.h" #include "nav_helper.h"
#include "items.h" #include "items.h"
#include "shop.h" #include "shop.h"
#include "player.h"
bool gameRunning; bool gameRunning;
bool acceptedRules; bool acceptedRules;
@ -15,6 +16,7 @@ bool acceptedRules;
// declare needed variables // declare needed variables
Room *map; Room *map;
Item *availableItems; Item *availableItems;
Player actualPlayer;
int inputCounter = 0; int inputCounter = 0;
// content // content
@ -37,6 +39,7 @@ void printStatus();
int main() int main()
{ {
// define variables // define variables
actualPlayer.id = 1;
char userInput[20]; // maximum defined user input length char userInput[20]; // maximum defined user input length
gameRunning = 1; 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 int result = openShop(availableItems); // result > 0 -> integer = index of item OR result = 0 -> cancel
if (result > 0) if (result > 0)
{ {
// buyItem -> we need inventory for player first
addItemToInventory(availableItems, result, actualPlayer);
} }
printStatus(); printStatus();
} }

Loading…
Cancel
Save