|
Planeshift
|
Class that represents the Recipe Manager of the game. More...
#include <recipe.h>
Classes | |
| struct | Correspondence |
| Keeps details about the matches between script actions and NPC Operations. More... | |
| struct | TribeData |
| Keeps details of all tribes enrolled in the manager. More... | |
Public Member Functions | |
| bool | AddTribe (Tribe *tribe) |
| Add a tribe. More... | |
| int | ApplyRecipe (RecipeTreeNode *bestRecipe, Tribe *tribe, int step) |
| Apply Recipe. More... | |
| void | CreateGlobalNPCType (Tribe *tribe) |
| Compute global npctype. More... | |
| Recipe * | GetRecipe (int recipeID) |
| Get pointer to recipe based on ID. More... | |
| Recipe * | GetRecipe (csString recipesName) |
| Get pointer to recipe based on Recipe's Name. More... | |
| TribeData * | GetTribeData (Tribe *tribe) |
| Get computed tribeData for a tribe. More... | |
| bool | LoadRecipes () |
| Loads all recipes from the database. More... | |
| bool | ParseFunction (csString function, Tribe *tribe, csArray< NPC * > &npcs, Recipe *recipe) |
| Parse function. More... | |
| bool | ParseRequirement (const Recipe::Requirement &requirement, Tribe *tribe, Recipe *recipe) |
| Check Requirement. More... | |
| csString | Preparse (csString function, Tribe *tribe) |
| Preparser. More... | |
| RecipeManager (psNPCClient *NPCClient, EventManager *eventManager) | |
| Construct the Recipe Manager. More... | |
| virtual | ~RecipeManager () |
| Destruct the Recipe Manager. More... | |
Class that represents the Recipe Manager of the game.
This object loads and stores all the recipes in-game. It also keeps track of the progress the tribes have in their recipes and triggers changes in tribes once recipes are completed.
| RecipeManager::RecipeManager | ( | psNPCClient * | NPCClient, |
| EventManager * | eventManager | ||
| ) |
Construct the Recipe Manager.
|
virtual |
Destruct the Recipe Manager.
| bool RecipeManager::AddTribe | ( | Tribe * | tribe | ) |
Add a tribe.
Method to load a tribe pointer into the tribes list held by the manager. Required for all tribes we want the manager to hold.
| tribe | The tribe to be added. |
| int RecipeManager::ApplyRecipe | ( | RecipeTreeNode * | bestRecipe, |
| Tribe * | tribe, | ||
| int | step | ||
| ) |
Apply Recipe.
Applies a recipe to a tribe.
| bestRecipe | The recipeTreeNode to apply |
| tribe | The tribe on which to apply |
| step | The step on which to start |
| void RecipeManager::CreateGlobalNPCType | ( | Tribe * | tribe | ) |
Compute global npctype.
Computes a global part of an npctype for each tribe. The global npctype contains general/common data concerning tribe members. E.g. : Behavior when attacked, behavior during day/night
| tribe | Pointer to the tribe on which to create NPCType |
| Recipe* RecipeManager::GetRecipe | ( | csString | recipesName | ) |
Get pointer to recipe based on Recipe's Name.
| bool RecipeManager::LoadRecipes | ( | ) |
Loads all recipes from the database.
| bool RecipeManager::ParseFunction | ( | csString | function, |
| Tribe * | tribe, | ||
| csArray< NPC * > & | npcs, | ||
| Recipe * | recipe | ||
| ) |
Parse function.
Applies changes to the tribe based on the function received as an argument.
| function | String containing a function and it's arguments |
| tribe | The tribe on which to apply the changes |
| npcs | The list of npcs to send perceptions to |
| recipe | The recipe this function belongs to |
| bool RecipeManager::ParseRequirement | ( | const Recipe::Requirement & | requirement, |
| Tribe * | tribe, | ||
| Recipe * | recipe | ||
| ) |
Check Requirement.
Checks a requirement. For unmet requirements this function enrolls needed recipes in order to meet the requirements.
| requirement | Data structure containing requirement |
| tribe | Tribe to check requirements on |
| recipe | The recipe this requirement belongs to |
| csString RecipeManager::Preparse | ( | csString | function, |
| Tribe * | tribe | ||
| ) |
Preparser.
Method to preparse the scripts in recipes in order to replace variables used while scripting. E.g. GROW_RESOURCE, HOME
| function | The function to preparse |
| tribe | The tribe from which values are needed |