Created
July 29, 2012 05:35
-
-
Save chancez/3196251 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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