fixed bugs w buy menu; added option to exit b menu
This commit is contained in:
30
main.c
30
main.c
@@ -142,16 +142,27 @@ bool buyItem(int itemNumber)
|
|||||||
|
|
||||||
void buyItems()
|
void buyItems()
|
||||||
{
|
{
|
||||||
printf("What item would you like to buy?\n");
|
printf("What item would you like to buy? Type X to exit\n");
|
||||||
printItems();
|
printItems();
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
int selection = getchar();
|
int selection = getchar();
|
||||||
switch (selection)
|
switch (selection)
|
||||||
{
|
{
|
||||||
|
case '0':
|
||||||
|
if (buyItem(0))
|
||||||
|
{
|
||||||
|
printf("Item Bought\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
case '1':
|
case '1':
|
||||||
if (buyItem(1))
|
if (buyItem(1))
|
||||||
{
|
{
|
||||||
|
printf("Item Bought\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -161,6 +172,7 @@ void buyItems()
|
|||||||
case '2':
|
case '2':
|
||||||
if (buyItem(2))
|
if (buyItem(2))
|
||||||
{
|
{
|
||||||
|
printf("Item Bought\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -170,6 +182,7 @@ void buyItems()
|
|||||||
case '3':
|
case '3':
|
||||||
if (buyItem(3))
|
if (buyItem(3))
|
||||||
{
|
{
|
||||||
|
printf("Item Bought\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -179,6 +192,7 @@ void buyItems()
|
|||||||
case '4':
|
case '4':
|
||||||
if (buyItem(4))
|
if (buyItem(4))
|
||||||
{
|
{
|
||||||
|
printf("Item Bought\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -188,6 +202,7 @@ void buyItems()
|
|||||||
case '5':
|
case '5':
|
||||||
if (buyItem(5))
|
if (buyItem(5))
|
||||||
{
|
{
|
||||||
|
printf("Item Bought\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -197,6 +212,7 @@ void buyItems()
|
|||||||
case '6':
|
case '6':
|
||||||
if (buyItem(6))
|
if (buyItem(6))
|
||||||
{
|
{
|
||||||
|
printf("Item Bought\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -206,6 +222,7 @@ void buyItems()
|
|||||||
case '7':
|
case '7':
|
||||||
if (buyItem(7))
|
if (buyItem(7))
|
||||||
{
|
{
|
||||||
|
printf("Item Bought\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -215,6 +232,7 @@ void buyItems()
|
|||||||
case '8':
|
case '8':
|
||||||
if (buyItem(8))
|
if (buyItem(8))
|
||||||
{
|
{
|
||||||
|
printf("Item Bought\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -224,6 +242,7 @@ void buyItems()
|
|||||||
case '9':
|
case '9':
|
||||||
if (buyItem(9))
|
if (buyItem(9))
|
||||||
{
|
{
|
||||||
|
printf("Item Bought\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -231,15 +250,9 @@ void buyItems()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'X':
|
case 'X':
|
||||||
if (buyItem(10))
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,7 +306,6 @@ int gameUI(int itemPicked)
|
|||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
buyItems();
|
buyItems();
|
||||||
printf("Item Bought\n");
|
|
||||||
printf("A: Accept\nN: Negotiate\nD: Decline\nS: Print Stats\nI: Print Inventory\nB: Buy Items\n");
|
printf("A: Accept\nN: Negotiate\nD: Decline\nS: Print Stats\nI: Print Inventory\nB: Buy Items\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user