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. | |
int | ApplyRecipe (RecipeTreeNode *bestRecipe, Tribe *tribe, int step) |
Apply Recipe. | |
void | CreateGlobalNPCType (Tribe *tribe) |
Compute global npctype. | |
Recipe * | GetRecipe (int recipeID) |
Get pointer to recipe based on ID. | |
Recipe * | GetRecipe (csString recipesName) |
Get pointer to recipe based on Recipe's Name. | |
TribeData * | GetTribeData (Tribe *tribe) |
Get computed tribeData for a tribe. | |
bool | LoadRecipes () |
Loads all recipes from the database. | |
bool | ParseFunction (csString function, Tribe *tribe, csArray< NPC * > &npcs, Recipe *recipe) |
Parse function. | |
bool | ParseRequirement (const Recipe::Requirement &requirement, Tribe *tribe, Recipe *recipe) |
Check Requirement. | |
csString | Preparse (csString function, Tribe *tribe) |
Preparser. | |
RecipeManager (psNPCClient *NPCClient, EventManager *eventManager) | |
Construct the Recipe Manager. | |
virtual | ~RecipeManager () |
Destruct the Recipe Manager. |
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 RecipeManager::~RecipeManager | ( | ) | [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 + reactions that change to above-mentioned behaviors After assembling the NPCType it sends the string to the npcclient who creates a new object and pushes into npctypes hash.
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 |