|
@ -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(); |
|
|
} |
|
|
} |
|
|