Skip to content

Instantly share code, notes, and snippets.

@chancez
Created July 29, 2012 01:00
Show Gist options
  • Save chancez/3195546 to your computer and use it in GitHub Desktop.
Save chancez/3195546 to your computer and use it in GitHub Desktop.
bool Queue::enqueue(const Potion& aPotion)
{
if (size == MAX_CAPACITY)
return false; //Returns false if the queue is full
//Add the item to the end of the queue
items[rear] = aPotion;
rear = (rear + 1) % MAX_CAPACITY; //Circular, so no shifting needed.
size++;
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment