Code:
if (player.getGold() < mGoldRequired )
*********{
************cout << endl;
************cout << "You dont have enough gold for that" << endl;
************cout << endl;
******break ;
*********}
Here is the complete file
Code:
// Store cpp
#include <iostream>
#include "Store.h"
#include "Random.h"
using namespace std;
void Store::enter(Player& player)
{
******int select;
******bool leave = false;
************cout << "Welcome to my store, what can I do for you?" << endl;
************cout << endl;
******while (!leave)
***{
************cout << "1) View Prices, 2) Buy Potions, 3) Buy Armor, 4) Rest a while, 5) Leave... ";
************cin >> select;
************cout << endl;
******switch(select)
******{
******case 1:
************cout << "==== POTIONS ====" << endl;
************cout << endl;
************cout << "Belt 500, Heal 100, Poison 100, Invisability 1000" << endl;
************cout << endl;
************cout << "==== ARMOR ====" << endl;
************cout << endl;
************cout << "Leather 100, Ring 200, Splintered 300, Mail 500" << endl;
************cout << endl;
*********break;
******
******case 2:
*********{
************cout << "What Potions would you like to buy?" << endl;
************cout << endl;
************cout << "We have 1) Belt, 2) Heal, 3) Poison, 4) Invisability...";
*********
************int potion = 1;
************cin >> potion;
*********if (player.getGold() < mGoldRequired )
*********{
************cout << endl;
************cout << "You dont have enough gold for that" << endl;
************cout << endl;
******break ;
*********}
***
******if(potion == 1)
*********{
************mPotionName = "Belt";
************cout << endl;
************cout << "You have purchased a " << mPotionName << " Potion for 500 Gold"<< endl;
************cout << endl;
************mGoldRequired = 500;
************player.SetGold (- 500);
*********}
******else if(potion == 2)
*********{
************mPotionName = "Heal";
************cout << endl;
************cout << "You have purchased a " << mPotionName << " Potion for 100 Gold"<< endl;
************cout << endl;
************mGoldRequired = 100;
************player.SetGold (- 100);
************player.SetHitPoints (+ 15);
************player.SetMaxHitPoints ( player.getHitPoints());
*********}
******else if(potion == 3)
*********{
************mPotionName = "Poison";
************cout << endl;
************cout << "You have purchased a " << mPotionName << " Potion for 100 Gold"<< endl;
************cout << endl;
************mGoldRequired = 100;
************player.SetGold (- 100);
************player.SetHitPoints (+ 50);
************player.SetMaxHitPoints ( player.getHitPoints());
*********}
******else
*********{
************mPotionName = "Invisability";
************cout << endl;
************cout << "You have purchased a " << mPotionName << " Potion for 1000 Gold" << endl;
************cout << endl;
************mGoldRequired = 1000;
************player.SetGold (- 1000);
************player.SetHitPoints (+ 200);
************player.SetMaxHitPoints ( player.getHitPoints());
*********}
******break;
*********}
******case 3:
*********{
************cout << "What Armor would you like to buy?" << endl;
************cout << endl;
************cout << "We have 1) Leather, 2) Ring, 3) Splintered, 4) Mail...";
*********
*********int armor = 1;
*********cin >> armor;
******if (player.getGold() < mGoldRequired )
*********{
************cout << endl;
************cout << "You dont have enough gold for that" << endl;
************cout << endl;
******break ;
*********}
******if(armor == 1)
*********{
************mClothingName = "Leather Armor";
************cout << endl;
************cout << "You have purchased " << mClothingName << " for 100 Gold "<< endl;
************cout << endl;
************mGoldRequired = 100;
************player.SetGold (- 100);
************player.SetHitPoints (+ 20);
************player.SetMaxHitPoints ( player.getHitPoints());
*********}
******else if(armor == 2)
*********{
************mClothingName = "Ring Armor";
************cout << endl;
************cout << "You have purchased " << mClothingName << " for 200 Gold " << endl;
************cout << endl;
************mGoldRequired = 200;
************player.SetGold (- 200);
************player.SetHitPoints (+ 30);
************player.SetMaxHitPoints ( player.getHitPoints());
*********}
******
******else if(armor == 3)
*********{
************mClothingName = "Splintered Armor";
************cout << endl;
************cout << "You have purchased " << mClothingName << " for 300 Gold " << endl;
************cout << endl;
************mGoldRequired = 300;
************player.SetGold (- 300);
************player.SetHitPoints (+ 40);
************player.SetMaxHitPoints ( player.getHitPoints());
*********}
******else
*********{
************mClothingName = "Mail Armor";
************cout << endl;
************cout << "You have purchased " << mClothingName << " for 500 Gold " << endl;
************cout << endl;
************mGoldRequired = 500;
************player.SetGold (- 500);
************player.SetHitPoints (+ 50);
************player.SetMaxHitPoints ( player.getHitPoints());
*********}
******break;
*********}
******case 4:
*********{
*********int roll = Random(1, 4);
******if( roll == 1 )
******{
************cout << "A monster has also come to the shop" << endl;
************cout << endl;
************cout << "He picks your pocket and gets 150 Gold and 15 Magic Points" << endl;
************cout << endl;
******
************player.SetGold (- 150);
************player.SetMagicPoints (- 15);
******}
******else
******{
************cout << "Do you want to rest" << endl;
************cout << endl;
************cout << "Rooms are 200, Chairs are 100 & Floor is 10 gold" << endl;
************cout << endl;
************cout << "1) Room, 2) Chair, 3) Floor...";
*********int rest = 1;
*********cin >> rest;
*********cout << endl;
******if (rest == 1)
*********{
************player.SetGold (- 200);***
************player.SetMaxHitPoints ( player.getHitPoints());
*********}
******else if (rest == 2)
*********{
************player.SetGold (- 100);
************player.SetHitPoints (+ 20);
************player.SetMaxHitPoints ( player.getHitPoints());
*********}
******else
*********{
************player.SetGold (- 10);***
************player.SetHitPoints (+ 5);
************player.SetMaxHitPoints ( player.getHitPoints());
*********}
************cout << "You are now rested" << endl;
************cout << endl;
*********}
******break;
*********}
******case 5:
************cout << "Thank you for coming, please come again" << endl;
************leave = true;
******}
******
***}
}


