Planeshift
Tribe Class Reference

Holds list of tribe members, position of tribe home Keeps resources and handles tribe perceptions. More...

#include <tribe.h>

Classes

struct  Asset
 
struct  CyclicRecipe
 
struct  MemberID
 
struct  Memory
 
struct  Resource
 

Public Types

enum  AssetStatus { ASSET_STATUS_NOT_APPLICABLE, ASSET_STATUS_NOT_USED, ASSET_STATUS_INCONSTRUCTION, ASSET_STATUS_CONSTRUCTED }
 
enum  AssetType { ASSET_TYPE_ITEM, ASSET_TYPE_BUILDING, ASSET_TYPE_BUILDINGSPOT }
 
typedef csHash< csString, csString > BufferHash
 

Public Member Functions

void AddAsset (Tribe::AssetType type, csString name, gemNPCItem *item, int quantity, int id=-1)
 Add an item asset. More...
 
Tribe::AssetAddAsset (Tribe::AssetType type, csString name, csVector3 position, iSector *sector, Tribe::AssetStatus status)
 Add an asset to the tribe. More...
 
void AddCyclicRecipe (Recipe *recipe, int time)
 Add a cyclic recipe. More...
 
void AddKnowledge (csString knowHow)
 Add a knowledge token. More...
 
bool AddMember (PID pid, const char *tribeMemberType)
 Adds a new member to the tribe. More...
 
void AddMemory (csString name, const csVector3 &pos, iSector *sector, float radius, NPC *npc)
 Add a new memory to the tribe. More...
 
void AddRecipe (Recipe *recipe, Recipe *parentRecipe, bool reqType=false)
 Add a recipe. More...
 
void AddResource (csString resource, int amount, csString nick="")
 Add a new resource to the tribe resource table. More...
 
void Advance (csTicks when, EventManager *eventmgr)
 Advance the tribe. More...
 
int AliveCount () const
 Count number of alive members. More...
 
size_t AssetQuantity (Tribe::AssetType type, csString name)
 Return the quanitity of the given asset type matching the name. More...
 
bool AttachMember (NPC *npc, const char *tribeMemberType)
 Attach a new member to the tribe. More...
 
void Build (NPC *npc, bool pickupable)
 Build a building on the current NPC building spot. More...
 
bool CanGrow () const
 Check if the tribe can grow by checking the tribes wealth. More...
 
bool CheckAsset (Tribe::AssetType type, csString name, int number)
 Check to see if enough assets are available. More...
 
bool CheckAttach (NPC *npc)
 Attach a new member to the tribe if the NPC is a member. More...
 
bool CheckKnowledge (csString knowHow)
 Check if knowledge is known. More...
 
bool CheckMembers (const csString &type, int number)
 Check to see if enough members are idle. More...
 
bool CheckResource (csString resource, int number)
 Check to see if enough resources are available. More...
 
bool CheckWithinBoundsTribeHome (NPC *npc, const csVector3 &pos, const iSector *sector)
 Check if the position is within the bounds of the tribe home. More...
 
int CountResource (csString resource) const
 Return the amount of a given resource. More...
 
void DeleteAsset (csString name, int quantity)
 Delete item assets. More...
 
void DeleteAsset (csString name, csVector3 pos)
 Delete a building asset. More...
 
void DeleteCyclicRecipe (Recipe *recipe)
 Delete a cyclic recipe. More...
 
void DumpAssets ()
 Dump Assets. More...
 
void DumpBuffers ()
 Dump Buffers. More...
 
void DumpKnowledge ()
 Dump knowledge to console. More...
 
void DumpRecipesToConsole ()
 Dumps all information about recipes to console. More...
 
MemoryFindMemory (csString name, const csVector3 &pos, iSector *sector, float radius)
 Find a memory. More...
 
MemoryFindMemory (csString name)
 Find a memory. More...
 
MemoryFindNearestMemory (const char *name, const csVector3 &pos, const iSector *sector, float range=-1.0, float *foundRange=NULL)
 Find nearest memory to a position. More...
 
MemoryFindPrivMemory (csString name, const csVector3 &pos, iSector *sector, float radius, NPC *npc)
 Find a privat memory. More...
 
MemoryFindRandomMemory (const char *name, const csVector3 &pos, const iSector *sector, float range=-1.0, float *foundRange=NULL)
 Find a random memory within range to a position. More...
 
void ForgetMemories (NPC *npc)
 Forget privat memories. More...
 
AssetGetAsset (Tribe::AssetType type, csString name)
 Get asset. More...
 
AssetGetAsset (Tribe::AssetType type, csString name, Tribe::AssetStatus status)
 Get asset. More...
 
AssetGetAsset (Tribe::AssetType type, csString name, csVector3 where, iSector *sector)
 Get an asset based on name and position. More...
 
AssetGetAsset (gemNPCItem *item)
 Get asset. More...
 
AssetGetAsset (uint32_t itemUID)
 Get asset. More...
 
csString GetBuffer (const csString &bufferName)
 Return a named buffer from the NPC. More...
 
float GetDeathRate ()
 Retrive death rate average value from tribe. More...
 
void GetHome (csVector3 &pos, float &radius, iSector *&sector)
 Get home position for the tribe. More...
 
csVector3 GetHomePosition ()
 
iSector * GetHomeSector ()
 
csString GetHomeSectorName ()
 
int GetID ()
 
int GetMaxSize () const
 Calculate the maximum number of members for the tribe. More...
 
NPCGetMember (size_t i)
 
size_t GetMemberCount ()
 
size_t GetMemberIDCount ()
 
csList< Memory * >::Iterator GetMemoryIterator ()
 
gemNPCActorGetMostHated (NPC *npc, float range, bool includeOutsideRegion, bool includeInvisible, bool includeInvincible, float *hate=NULL)
 Find the most hated entity for tribe within range. More...
 
const char * GetName ()
 
AssetGetNearestAsset (Tribe::AssetType type, Tribe::AssetStatus status, csVector3 pos, iSector *sector, float range, float *locatedRange=NULL)
 Get nearest asset. More...
 
AssetGetNearestAsset (Tribe::AssetType type, csString name, Tribe::AssetStatus status, csVector3 pos, iSector *sector, float range, float *locatedRange=NULL)
 Get an asset. More...
 
const char * GetNeededResource ()
 Get the most needed resource for this tribe. More...
 
const char * GetNeededResourceAreaType ()
 Get a area for the most needed resource for this tribe. More...
 
const char * GetNeededResourceNick ()
 Get the nick for the most needed resource for this tribe. More...
 
csString GetNPCIdleBehavior ()
 
AssetGetRandomAsset (Tribe::AssetType type, Tribe::AssetStatus status, csVector3 pos, iSector *sector, float range)
 Get a random asset. More...
 
AssetGetRandomAsset (Tribe::AssetType type, csString name, Tribe::AssetStatus status, csVector3 pos, iSector *sector, float range)
 Get an asset. More...
 
int GetReproductionCost () const
 Return the reproduction cost for this tribe. More...
 
const ResourceGetResource (size_t n)
 
bool GetResource (NPC *npc, csVector3 startPos, iSector *startSector, csVector3 &pos, iSector *&sector, float range, bool random)
 Get a memorized location for resources. More...
 
Tribe::MemoryGetResource (csString resourceName, NPC *npc)
 Get the closest Memory regarding a resource or the closest non-prospected mine. More...
 
size_t GetResourceCount ()
 
float GetResourceRate ()
 Retrive resource rate average value from tribe. More...
 
RecipeGetTribalRecipe ()
 Get the main recipe. More...
 
float GetWealthResourceGrowth () const
 Get wealth resource growth rate. More...
 
float GetWealthResourceGrowthActive () const
 Get wealth resource growth rate active. More...
 
int GetWealthResourceGrowthActiveLimit () const
 Get wealth resource growth active limit. More...
 
bool HandleDeath (NPC *npc)
 Remove members that die. More...
 
void HandlePerception (NPC *npc, Perception *perception)
 Handled a perception given to this tribe. More...
 
void HandlePersistItem (gemNPCItem *item)
 Handle persist items that should be assets. More...
 
bool Load (iResultRow &row)
 Load the tribe object. More...
 
void LoadAsset (iResultRow &row)
 Load an asset from an iResultRow. More...
 
bool LoadMember (iResultRow &row)
 Load and add a new member to the tribe. More...
 
bool LoadMemory (iResultRow &row)
 Load all stored memories from db. More...
 
bool LoadNPCMemoryBuffer (const char *name, csArray< NPC * > npcs)
 Set npcs memory buffers. More...
 
void LoadNPCMemoryBuffer (Tribe::Memory *memory, csArray< NPC * > npcs)
 Set npcs memory buffers - Using a memory. More...
 
bool LoadResource (iResultRow &row)
 Load and add a new resource to the tribe. More...
 
void Memorize (NPC *npc, Perception *perception)
 Memorize a perception. More...
 
void ModifyWait (Recipe *recipe, int delta)
 Modify Wait Time for a recipe. More...
 
void ProspectMine (NPC *npc, csString resource, csString nick)
 Assigned a resource to a prospect Mine. More...
 
void RemoveAsset (Tribe::Asset *asset)
 Remove an asset. More...
 
void ReplaceBuffers (csString &result)
 Replace $TBUFFER[x] with values from the NPC buffer. More...
 
void SaveAsset (Tribe::Asset *asset, bool deletion=false)
 Save an asset to the db - responsable for deleting assets to. More...
 
void SaveKnowledge (csString knowHow)
 Save a knowledge piece in the database. More...
 
void SaveMemory (Memory *memory)
 Save a memory to the db. More...
 
void SaveResource (Resource *resource, bool newResource)
 Save or update an resource in database. More...
 
virtual void ScopedTimerCallback (const ScopedTimer *timer)
 Callback for debug of long time used in scopes. More...
 
csArray< NPC * > SelectNPCs (const csString &type, const char *number)
 Returns pointers to required npcs for a task. More...
 
void SendPerception (const char *pcpt, csArray< NPC * > npcs)
 Sends the given perception to the given list of npcs. More...
 
void SendPerception (const char *pcpt)
 Sends the given perception to the tribe. More...
 
void SetBuffer (const csString &bufferName, const csString &value)
 Set/Update the value of a named buffer. More...
 
void SetHome (const csVector3 &pos, float radius, iSector *sector)
 Set home position for the tribe. More...
 
void SetRecipeManager (RecipeManager *rm)
 Sets the tribe's recipe manager. More...
 
void ShareMemories (NPC *npc)
 Share privat memories with the other npcs. More...
 
bool ShouldGrow () const
 Check if the tribe should grow by checking number of members against max size. More...
 
 Tribe (EventManager *eventmngr, RecipeManager *rm)
 Construct a new tribe object. More...
 
void TriggerEvent (Perception *pcpt, float maxRange=-1.0, csVector3 *basePos=NULL, iSector *baseSector=NULL)
 Send a perception to all members of the tribe. More...
 
void Unbuild (NPC *npc, gemNPCItem *building)
 Tear down a building. More...
 
void UpdateRecipeData (int delta)
 Updates recipe wait times. More...
 
virtual ~Tribe ()
 Destruct a tribe object. More...
 
- Public Member Functions inherited from ScopedTimerCB
virtual ~ScopedTimerCB ()
 
- Public Member Functions inherited from RemoteDebug
void AddDebugClient (uint clientNum, int debugLevel)
 Add a client to receive debug information. More...
 
int GetDebugging () const
 Get the local debugging level. More...
 
csString GetRemoteDebugClientsString () const
 Utility function to retrive a string with all remote debugging clients for debug outputs. More...
 
bool IsDebugging ()
 Check if debugging is enabled. More...
 
bool IsDebugging (int debugLevel)
 Check if this NPC is debugging at the given level. More...
 
void Printf (int debugLevel, const char *msg,...)
 Function to generate a debug print. More...
 
 RemoteDebug ()
 Constructor. More...
 
void RemoveDebugClient (uint clientNum)
 Remove client from list of debug receivers. More...
 
void SetDebugging (int debugLevel)
 Set a new debug level. More...
 
bool SwitchDebugging ()
 Switch the local debuging state. More...
 
virtual ~RemoteDebug ()
 Destructor. More...
 

Static Public Attributes

static const char * AssetStatusStr []
 
static const char * AssetTypeStr []
 

Additional Inherited Members

- Protected Attributes inherited from RemoteDebug
csArray< csString > debugLog
 Local debug log of last n print statments. More...
 
int nextDebugLogEntry
 The next entry to use. More...
 

Detailed Description

Holds list of tribe members, position of tribe home Keeps resources and handles tribe perceptions.

Definition at line 67 of file tribe.h.

Member Typedef Documentation

typedef csHash<csString,csString> Tribe::BufferHash

Definition at line 70 of file tribe.h.

Member Enumeration Documentation

Enumerator
ASSET_STATUS_NOT_APPLICABLE 
ASSET_STATUS_NOT_USED 
ASSET_STATUS_INCONSTRUCTION 
ASSET_STATUS_CONSTRUCTED 

Definition at line 80 of file tribe.h.

Enumerator
ASSET_TYPE_ITEM 
ASSET_TYPE_BUILDING 
ASSET_TYPE_BUILDINGSPOT 

Definition at line 72 of file tribe.h.

Constructor & Destructor Documentation

Tribe::Tribe ( EventManager eventmngr,
RecipeManager rm 
)

Construct a new tribe object.

virtual Tribe::~Tribe ( )
virtual

Destruct a tribe object.

Member Function Documentation

void Tribe::AddAsset ( Tribe::AssetType  type,
csString  name,
gemNPCItem item,
int  quantity,
int  id = -1 
)

Add an item asset.

Tribe::Asset* Tribe::AddAsset ( Tribe::AssetType  type,
csString  name,
csVector3  position,
iSector *  sector,
Tribe::AssetStatus  status 
)

Add an asset to the tribe.

void Tribe::AddCyclicRecipe ( Recipe recipe,
int  time 
)

Add a cyclic recipe.

Cyclic recipes are executed once in a pre-defined quantum of time and are set with the highest priority.

Parameters
recipeRecipe to add
timeTribe advances required to execute this cyclic recipe
void Tribe::AddKnowledge ( csString  knowHow)
inline

Add a knowledge token.

Definition at line 556 of file tribe.h.

bool Tribe::AddMember ( PID  pid,
const char *  tribeMemberType 
)

Adds a new member to the tribe.

void Tribe::AddMemory ( csString  name,
const csVector3 &  pos,
iSector *  sector,
float  radius,
NPC npc 
)

Add a new memory to the tribe.

void Tribe::AddRecipe ( Recipe recipe,
Recipe parentRecipe,
bool  reqType = false 
)

Add a recipe.

Adds a recipe to activeRecipes array in respect of it's priority and cost.

Parameters
recipeRecipe to add.
parentRecipeRecipe that requires the new recipe.
reqTypeTrue for meeting requirements distributed-way
void Tribe::AddResource ( csString  resource,
int  amount,
csString  nick = "" 
)

Add a new resource to the tribe resource table.

void Tribe::Advance ( csTicks  when,
EventManager eventmgr 
)

Advance the tribe.

int Tribe::AliveCount ( ) const

Count number of alive members.

size_t Tribe::AssetQuantity ( Tribe::AssetType  type,
csString  name 
)

Return the quanitity of the given asset type matching the name.

bool Tribe::AttachMember ( NPC npc,
const char *  tribeMemberType 
)

Attach a new member to the tribe.

void Tribe::Build ( NPC npc,
bool  pickupable 
)

Build a building on the current NPC building spot.

bool Tribe::CanGrow ( ) const

Check if the tribe can grow by checking the tribes wealth.

bool Tribe::CheckAsset ( Tribe::AssetType  type,
csString  name,
int  number 
)

Check to see if enough assets are available.

bool Tribe::CheckAttach ( NPC npc)

Attach a new member to the tribe if the NPC is a member.

bool Tribe::CheckKnowledge ( csString  knowHow)

Check if knowledge is known.

bool Tribe::CheckMembers ( const csString &  type,
int  number 
)

Check to see if enough members are idle.

bool Tribe::CheckResource ( csString  resource,
int  number 
)

Check to see if enough resources are available.

bool Tribe::CheckWithinBoundsTribeHome ( NPC npc,
const csVector3 &  pos,
const iSector *  sector 
)

Check if the position is within the bounds of the tribe home.

Parameters
npcThe npc responsible for this checking
posThe position to check
sectorThe sector to check
Returns
True if position is within bounds of the tribe home
int Tribe::CountResource ( csString  resource) const

Return the amount of a given resource.

void Tribe::DeleteAsset ( csString  name,
int  quantity 
)

Delete item assets.

void Tribe::DeleteAsset ( csString  name,
csVector3  pos 
)

Delete a building asset.

void Tribe::DeleteCyclicRecipe ( Recipe recipe)

Delete a cyclic recipe.

void Tribe::DumpAssets ( )

Dump Assets.

void Tribe::DumpBuffers ( )

Dump Buffers.

void Tribe::DumpKnowledge ( )

Dump knowledge to console.

void Tribe::DumpRecipesToConsole ( )

Dumps all information about recipes to console.

Memory* Tribe::FindMemory ( csString  name,
const csVector3 &  pos,
iSector *  sector,
float  radius 
)

Find a memory.

Memory* Tribe::FindMemory ( csString  name)

Find a memory.

Memory* Tribe::FindNearestMemory ( const char *  name,
const csVector3 &  pos,
const iSector *  sector,
float  range = -1.0,
float foundRange = NULL 
)

Find nearest memory to a position.

Memory* Tribe::FindPrivMemory ( csString  name,
const csVector3 &  pos,
iSector *  sector,
float  radius,
NPC npc 
)

Find a privat memory.

Memory* Tribe::FindRandomMemory ( const char *  name,
const csVector3 &  pos,
const iSector *  sector,
float  range = -1.0,
float foundRange = NULL 
)

Find a random memory within range to a position.

void Tribe::ForgetMemories ( NPC npc)

Forget privat memories.

Should be called when npc die.

Asset* Tribe::GetAsset ( Tribe::AssetType  type,
csString  name 
)

Get asset.

Asset* Tribe::GetAsset ( Tribe::AssetType  type,
csString  name,
Tribe::AssetStatus  status 
)

Get asset.

Asset* Tribe::GetAsset ( Tribe::AssetType  type,
csString  name,
csVector3  where,
iSector *  sector 
)

Get an asset based on name and position.

Asset* Tribe::GetAsset ( gemNPCItem item)

Get asset.

Asset* Tribe::GetAsset ( uint32_t  itemUID)

Get asset.

csString Tribe::GetBuffer ( const csString &  bufferName)

Return a named buffer from the NPC.

Function used to get data from buffers containing information.

Parameters
bufferNameThe name of the buffer to retrive.
Returns
Buffer value
float Tribe::GetDeathRate ( )
inline

Retrive death rate average value from tribe.

Returns
The Exponential smoothed death rate.

Definition at line 492 of file tribe.h.

void Tribe::GetHome ( csVector3 &  pos,
float radius,
iSector *&  sector 
)

Get home position for the tribe.

csVector3 Tribe::GetHomePosition ( )
inline

Definition at line 264 of file tribe.h.

iSector* Tribe::GetHomeSector ( )
csString Tribe::GetHomeSectorName ( )
inline

Definition at line 269 of file tribe.h.

int Tribe::GetID ( )
inline

Definition at line 227 of file tribe.h.

int Tribe::GetMaxSize ( ) const

Calculate the maximum number of members for the tribe.

NPC* Tribe::GetMember ( size_t  i)
inline

Definition at line 243 of file tribe.h.

size_t Tribe::GetMemberCount ( )
inline

Definition at line 239 of file tribe.h.

size_t Tribe::GetMemberIDCount ( )
inline

Definition at line 235 of file tribe.h.

csList<Memory*>::Iterator Tribe::GetMemoryIterator ( )
inline

Definition at line 255 of file tribe.h.

gemNPCActor* Tribe::GetMostHated ( NPC npc,
float  range,
bool  includeOutsideRegion,
bool  includeInvisible,
bool  includeInvincible,
float hate = NULL 
)

Find the most hated entity for tribe within range.

Check the hate list and retrive most hated entity within range of the given NPC.

Parameters
npcThe senter of the search.
rangeThe range to search for hated entities.
includeOutsideRegionInclude outside region entities in the search.
includeInvisibleInclude invisible entities in the search.
includeInvincibleInclude invincible entities in the search.
hateIf diffrent from NULL, set upon return to the hate of the hated.
Returns
The hated entity
const char* Tribe::GetName ( )
inline

Definition at line 231 of file tribe.h.

Asset* Tribe::GetNearestAsset ( Tribe::AssetType  type,
Tribe::AssetStatus  status,
csVector3  pos,
iSector *  sector,
float  range,
float locatedRange = NULL 
)

Get nearest asset.

Asset* Tribe::GetNearestAsset ( Tribe::AssetType  type,
csString  name,
Tribe::AssetStatus  status,
csVector3  pos,
iSector *  sector,
float  range,
float locatedRange = NULL 
)

Get an asset.

const char* Tribe::GetNeededResource ( )

Get the most needed resource for this tribe.

const char* Tribe::GetNeededResourceAreaType ( )

Get a area for the most needed resource for this tribe.

const char* Tribe::GetNeededResourceNick ( )

Get the nick for the most needed resource for this tribe.

csString Tribe::GetNPCIdleBehavior ( )
inline

Definition at line 260 of file tribe.h.

Asset* Tribe::GetRandomAsset ( Tribe::AssetType  type,
Tribe::AssetStatus  status,
csVector3  pos,
iSector *  sector,
float  range 
)

Get a random asset.

Asset* Tribe::GetRandomAsset ( Tribe::AssetType  type,
csString  name,
Tribe::AssetStatus  status,
csVector3  pos,
iSector *  sector,
float  range 
)

Get an asset.

int Tribe::GetReproductionCost ( ) const

Return the reproduction cost for this tribe.

const Resource& Tribe::GetResource ( size_t  n)
inline

Definition at line 251 of file tribe.h.

bool Tribe::GetResource ( NPC npc,
csVector3  startPos,
iSector *  startSector,
csVector3 &  pos,
iSector *&  sector,
float  range,
bool  random 
)

Get a memorized location for resources.

Tribe::Memory* Tribe::GetResource ( csString  resourceName,
NPC npc 
)

Get the closest Memory regarding a resource or the closest non-prospected mine.

size_t Tribe::GetResourceCount ( )
inline

Definition at line 247 of file tribe.h.

float Tribe::GetResourceRate ( )
inline

Retrive resource rate average value from tribe.

Returns
The Exponential smoothed resource rate.

Definition at line 502 of file tribe.h.

Recipe* Tribe::GetTribalRecipe ( )

Get the main recipe.

float Tribe::GetWealthResourceGrowth ( ) const

Get wealth resource growth rate.

Get the rate that the wealth will grow when all members are dead.

Returns
Return the wealth growth rate
float Tribe::GetWealthResourceGrowthActive ( ) const

Get wealth resource growth rate active.

Get the rate that the wealth will grow when there are alive members.

Returns
Return the wealth growth rate
int Tribe::GetWealthResourceGrowthActiveLimit ( ) const

Get wealth resource growth active limit.

Get the limit that the wealth will be capped at when there are alive members.

Returns
Return the wealth growth limit
bool Tribe::HandleDeath ( NPC npc)

Remove members that die.

void Tribe::HandlePerception ( NPC npc,
Perception perception 
)

Handled a perception given to this tribe.

void Tribe::HandlePersistItem ( gemNPCItem item)

Handle persist items that should be assets.

bool Tribe::Load ( iResultRow &  row)

Load the tribe object.

void Tribe::LoadAsset ( iResultRow &  row)

Load an asset from an iResultRow.

bool Tribe::LoadMember ( iResultRow &  row)

Load and add a new member to the tribe.

bool Tribe::LoadMemory ( iResultRow &  row)

Load all stored memories from db.

bool Tribe::LoadNPCMemoryBuffer ( const char *  name,
csArray< NPC * >  npcs 
)

Set npcs memory buffers.

Loads locations into the Memory buffers of the npcs. Useful when assigning tasks to them.

Parameters
nameName of the memory/resource to load.
npcsLink to the npcs on which to load.
Returns
False if no desired location exists.
void Tribe::LoadNPCMemoryBuffer ( Tribe::Memory memory,
csArray< NPC * >  npcs 
)

Set npcs memory buffers - Using a memory.

bool Tribe::LoadResource ( iResultRow &  row)

Load and add a new resource to the tribe.

void Tribe::Memorize ( NPC npc,
Perception perception 
)

Memorize a perception.

The perception will be marked as personal until NPC return home. Personal perceptions will be deleted if NPC die.

void Tribe::ModifyWait ( Recipe recipe,
int  delta 
)

Modify Wait Time for a recipe.

void Tribe::ProspectMine ( NPC npc,
csString  resource,
csString  nick 
)

Assigned a resource to a prospect Mine.

Upon 'Explore' behavior, tribe members may find locations named 'mine'. After mining from an unkown deposit, the npcclient will receive a psWorkDoneMessage telling it what his npc just mined. This function renames the former 'mine' Memory with it's real deposit name.

Parameters
npcThe npc who prospected it to access his memoryBuffer.
resourceThe resulted resource received from psServer.
nickThe nick name of the resource for this mine.
void Tribe::RemoveAsset ( Tribe::Asset asset)

Remove an asset.

void Tribe::ReplaceBuffers ( csString &  result)

Replace $TBUFFER[x] with values from the NPC buffer.

Parameters
resultString to replace buffers in.
void Tribe::SaveAsset ( Tribe::Asset asset,
bool  deletion = false 
)

Save an asset to the db - responsable for deleting assets to.

void Tribe::SaveKnowledge ( csString  knowHow)

Save a knowledge piece in the database.

void Tribe::SaveMemory ( Memory memory)

Save a memory to the db.

void Tribe::SaveResource ( Resource resource,
bool  newResource 
)

Save or update an resource in database.

virtual void Tribe::ScopedTimerCallback ( const ScopedTimer timer)
virtual

Callback for debug of long time used in scopes.

Implements ScopedTimerCB.

csArray<NPC*> Tribe::SelectNPCs ( const csString &  type,
const char *  number 
)

Returns pointers to required npcs for a task.

void Tribe::SendPerception ( const char *  pcpt,
csArray< NPC * >  npcs 
)

Sends the given perception to the given list of npcs.

Used by the recipe manager to send perceptions to tribe members selected by the active recipe.

Parameters
pcptThe perception name to be sent
npcsThe list of npcs to send perception to.
void Tribe::SendPerception ( const char *  pcpt)

Sends the given perception to the tribe.

Used to send perceptions to all tribe members.

Parameters
pcptThe perception name to be sent
void Tribe::SetBuffer ( const csString &  bufferName,
const csString &  value 
)

Set/Update the value of a named buffer.

Parameters
bufferNameThe buffer name.
valueThe value to put in the buffer.
void Tribe::SetHome ( const csVector3 &  pos,
float  radius,
iSector *  sector 
)

Set home position for the tribe.

void Tribe::SetRecipeManager ( RecipeManager rm)
inline

Sets the tribe's recipe manager.

Definition at line 510 of file tribe.h.

void Tribe::ShareMemories ( NPC npc)

Share privat memories with the other npcs.

Should be called when npc return to home.

bool Tribe::ShouldGrow ( ) const

Check if the tribe should grow by checking number of members against max size.

void Tribe::TriggerEvent ( Perception pcpt,
float  maxRange = -1.0,
csVector3 *  basePos = NULL,
iSector *  baseSector = NULL 
)

Send a perception to all members of the tribe.

This will send the perception to all the members of the tribe. If the maxRange has been set to something greater than 0.0 a range check will be applied. Only members within the range from the base position and sector will be triggered.

Parameters
pcptPerception to be sent.
maxRangeIf greater then 0.0 then max range apply
basePosThe base position for range checks.
baseSectorThe base sector for range checks.
void Tribe::Unbuild ( NPC npc,
gemNPCItem building 
)

Tear down a building.

void Tribe::UpdateRecipeData ( int  delta)

Updates recipe wait times.

Member Data Documentation

const char* Tribe::AssetStatusStr[]
static

Definition at line 87 of file tribe.h.

const char* Tribe::AssetTypeStr[]
static

Definition at line 78 of file tribe.h.


The documentation for this class was generated from the following file: