int BuyItem() {
//ShopSelection
//ShopQuantity
//CurrentMonth
int i;
int Cost;
// 0 - 9 for Spring.
// 10 - 21 for Summer.
// 22 - 32 for Autumn.
if(InventorySlotTwelve != 0) {
if(CurrentMonth == 1) {
i = 0;
}
else if(CurrentMonth == 2) {
i = 10;
}
else if(CurrentMonth == 3) {
i = 22;
}
i = ShopSelection + i;
// GoldCalculation();
Cost = AllCrops[i].Seeds * ShopQuantity;
if(CurrentGold >= Cost) {
strncpy(InventorySlotTwelve.ItemName, AllCrops[i].InventoryText, 14);
InventorySlotTwelve.ItemQuantity = ShopQuantity;
CurrentGold = CurrentGold - Cost;
StackInventoryItems();
}
else {
// 'You don't have enough money!' here.
}
else {
// 'Full inventory!' here.
}
return 0;
}
Comments