Skip to content

Instantly share code, notes, and snippets.

@chancez
Created July 29, 2012 05:35
Show Gist options
  • Save chancez/3196251 to your computer and use it in GitHub Desktop.
Save chancez/3196251 to your computer and use it in GitHub Desktop.
int Apothecary::MakePotions()
{
int i;
Potion aPotion;
//Begin by checking if the order queue is empty
for (i = 0; !order->isEmpty() ; i++)
{
//If the queue is empty, but the shelf is full,
//than print that its full.
if(shelf->isFull() == true)
{
cout << "The shelf of potions is full. You can't make any more until somebody buys some." << endl;
break;
}
//Otherwise, take it off the order, put it onto the shelf.
else
{
order->dequeue(aPotion);
shelf->push(aPotion);
cout << "Made a " << PotionTypeString(aPotion.GetType()) << " potion." << endl;
}
}
return i; //Return the number of potions made;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment