This file contains hidden or 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() | |
| { | |
| //queue *orders; | |
| //stack *shelf; | |
| Potion currentPotion; | |
| int count = 0; | |
| //orders = new queue(sizeof(orders)); | |
| //shelf = new stack(sizeof(shelf)); |
This file contains hidden or 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) |
This file contains hidden or 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
| ostream& operator<<(ostream& out, const Potion& aPotion) | |
| { | |
| out << "Potion of " << PotionTypeString(aPotion.type) << endl; | |
| return out; | |
| } |
This file contains hidden or 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
| const Potion& Potion::operator=(const Potion& aPotion) | |
| { | |
| if (this == &aPotion) | |
| return *this; | |
| else | |
| { | |
| type = aPotion.type; | |
| return *this; | |
| } |
This file contains hidden or 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) |
This file contains hidden or 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
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head></head><body> | |
| <h1>CS260 Lab: Player Database</h1> | |
| <h2>Instructions</h2> | |
| <p> | |
| Your RPG game would be incomplete without players so this lab is | |
| going to add a player database. In order to support fast updates to |
This file contains hidden or 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
| bool HashTable::retrieve (char const * const name, Player & aPlayer)const | |
| { | |
| //calculate the retrieval position (the index of the array) | |
| int index = calculateIndex(name); | |
| //search for the Player in the chain (linked list) | |
| node * curr = table[index]; | |
| char id[100]; | |
| char *playerName; |
This file contains hidden or 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
| bool HashTable::retrieve (char const * const name, Player & aPlayer)const | |
| { | |
| //calculate the retrieval position (the index of the array) | |
| int index = calculateIndex(name); | |
| //search for the Player in the chain (linked list) | |
| node * curr = table[index]; | |
| char *playerName; | |
| while (curr) |
This file contains hidden or 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 HashTable::calculateIndex(char const * const name) const | |
| { | |
| int length = strlen(name); | |
| int i; | |
| unsigned int sum = int(name[0]); | |
| // Start at 1 because the value for the first character was done above. | |
| for (i = 1; i < length; i++) | |
| { | |
| sum = (sum * 32 + int(name[i])); |
This file contains hidden or 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
| #include "Skill.h" | |
| #include "SkillNode.h" | |
| #include <stdlib.h> | |
| SkillNode::SkillNode(): children(NULL) | |
| { | |
| } | |
| SkillNode::SkillNode(Skill& aSkill): skill(aSkill), children(NULL) | |
| { |