Public Member Functions | Public Attributes

FactionData Class Reference

Wrapper class for holding data needed to create Faction database in the array of uints. More...


Detailed Description

Wrapper class for holding data needed to create Faction database in the array of uints.

It saves all data needed for faction.

List of all members.

Public Member Functions

 FactionData (uint nfaction, uint stringId, bool playerDriven)
 Creates empty FactionData object for given faction with assigned name stringId.
 FactionData (const string& name)
 Creates FactionData object from an array containing its data.
void initRecognition ()
 Initializes radio text listener for quick info.
bool IsPlayerDriven ()
 Gang or not.
void SetRadioChannel (uint16 newFreq)
 Sets new radio frequency.
void SetLocation (uint locId, uint pid, uint x, uint y)
 Sets new location data for player-faction hq.
bool GetFactionLocation (uint& out locId, uint& out pid, uint& out x, uint& out y)
 Gets location data for player-faction hq.
void SetLeaderId (uint id)
 Sets new leader id.
void SetClaimId (uint id)
 Sets new claim id.
void SetLeaderTime (uint time)
 Sets time when claim will be able to confirm leadership without doing anything.
void SetClaimTime (uint time)
 Sets time when another claim will be allowed to be made (previous claimee will lose it).
void SetScore (uint score)
 Sets faction score.
uint GetRecordsCount ()
 Number of records with player's data.
uint GetMembersCount ()
 Number of members.
uint GetMembers (array< uint >& members)
 Ids table with members.
uint GetRecords (array< uint >& records)
 Ids table with records.
uint GetFactions (array< int >& factions)
 Ids table with known factions.
uint GetLastUsed ()
 Gets the time when faction was last used/accessed.
bool Exists (uint key)
 Checks if the key exists in the array.
bool FactionExists (int faction_id)
 Checks if the faction with given id is in the known factions list.
int UpdateData ()
 Updates any_data associated with the array.
int RemoveData ()
 Removes data associated with the faction.
void UpdateNewsData ()
 Updates any_data associated with the news array.
void UpdateLastUsed ()
 Updates last used for actual time.
uint LogData (bool fullLog, array< string >& strings)
 Logs the content of data array.
int GetPrevNextId (uint id, int dir, bool members, uint& out newId)
 Gets the id of the next/prev record.
int ModifyRank (uint id, uint newRank)
int ModifyStatus (uint id, uint newStatus)
int ModifyFaction (uint id, uint newFaction)
int AddPlayer (uint id)
 Adds player without knowing anything about him.
int RemovePlayer (uint id)
 Clears the area occupied by a given player in the array so that it won't be taken into consideration, and may be later be filled by new data.
int AddFaction (int faction_id)
 Adds faction to the list of known factions.
int RemoveFaction (int id)

Public Attributes

string factionName
 Name of the faction.
dictionary_assignednames
Serializator serialiser
 Serialiser used to store data in AnyData array.
array< uint > players
 Identifiers of players whose info is stored in faction database.
array< int > factions
 Identifiers of factions whose info is stored in faction database.
uint faction
 'Owner' faction of that database
uint stringId
 Index to the array holding factions names.
uint freq
 Radio frequency.
uint locationId
 id of the location if faction uses dynamically created location, otherwise 0
uint locationPid
 prototype id of location
uint leaderId
 id of the leader
uint claimId
 id of the member who claimed leadership, and wants to overthrown current leader
uint leaderTime
 time that will allow claimee to claim leadership even without forcing current leader to resign/killing him this is time for leader to act
uint claimTime
 time that will allow another player to claim leadership this is time for claimee to act
uint newsId
 index to array with faction news
FactionNews news
 News.
uint score
 score
uint locX
 worldmap coord
uint locY
 worldmap coord
bool playerDriven
 Denotes whether it's player-driven gang or not.
uint lastUsed
 Tracks the time when faction has been last accessed.
uint update_seq
 Some features requires us to track the 'update' counter.

Constructor & Destructor Documentation

FactionData ( uint  nfaction,
uint  stringId,
bool  playerDriven 
)

Creates empty FactionData object for given faction with assigned name stringId.

FactionData ( const string name  ) 

Creates FactionData object from an array containing its data.


Member Function Documentation

void initRecognition (  ) 

Initializes radio text listener for quick info.

bool IsPlayerDriven (  ) 

Gang or not.

void SetRadioChannel ( uint16  newFreq  ) 

Sets new radio frequency.

void SetLocation ( uint  locId,
uint  pid,
uint  x,
uint  y 
)

Sets new location data for player-faction hq.

bool GetFactionLocation ( uint& out  locId,
uint& out  pid,
uint& out  x,
uint& out  y 
)

Gets location data for player-faction hq.

void SetLeaderId ( uint  id  ) 

Sets new leader id.

void SetClaimId ( uint  id  ) 

Sets new claim id.

void SetLeaderTime ( uint  time  ) 

Sets time when claim will be able to confirm leadership without doing anything.

void SetClaimTime ( uint  time  ) 

Sets time when another claim will be allowed to be made (previous claimee will lose it).

void SetScore ( uint  score  ) 

Sets faction score.

uint GetRecordsCount (  ) 

Number of records with player's data.

uint GetMembersCount (  ) 

Number of members.

uint GetMembers ( array< uint >&  members  ) 

Ids table with members.

uint GetRecords ( array< uint >&  records  ) 

Ids table with records.

uint GetFactions ( array< int >&  factions  ) 

Ids table with known factions.

uint GetLastUsed (  ) 

Gets the time when faction was last used/accessed.

bool Exists ( uint  key  ) 

Checks if the key exists in the array.

bool FactionExists ( int  faction_id  ) 

Checks if the faction with given id is in the known factions list.

int UpdateData (  ) 

Updates any_data associated with the array.

int RemoveData (  ) 

Removes data associated with the faction.

void UpdateNewsData (  ) 

Updates any_data associated with the news array.

void UpdateLastUsed (  ) 

Updates last used for actual time.

uint LogData ( bool  fullLog,
array< string >&  strings 
)

Logs the content of data array.

int GetPrevNextId ( uint  id,
int  dir,
bool  members,
uint& out  newId 
)

Gets the id of the next/prev record.

Parameters:
id id of currently selected player
dir browsing direction: -1 - look for previous (with regard to given id) 0 - first index 1 - look for next (with regard to given id)
members if true, it looks only for members records when lookingfor next/prev
Returns:
FD_RESULT_* value (see _factions.fos)
int ModifyRank ( uint  id,
uint  newRank 
)
int ModifyStatus ( uint  id,
uint  newStatus 
)
int ModifyFaction ( uint  id,
uint  newFaction 
)
int AddPlayer ( uint  id  ) 

Adds player without knowing anything about him.

Returns:
FD_RESULT_* value (see _factions.fos)
int RemovePlayer ( uint  id  ) 

Clears the area occupied by a given player in the array so that it won't be taken into consideration, and may be later be filled by new data.

Returns:
FD_RESULT_* value (see _factions.fos)
int AddFaction ( int  faction_id  ) 

Adds faction to the list of known factions.

int RemoveFaction ( int  id  ) 

Member Data Documentation

Name of the faction.

Serialiser used to store data in AnyData array.

array<uint> players

Identifiers of players whose info is stored in faction database.

array<int> factions

Identifiers of factions whose info is stored in faction database.

uint faction

'Owner' faction of that database

uint stringId

Index to the array holding factions names.

uint freq

Radio frequency.

uint locationId

id of the location if faction uses dynamically created location, otherwise 0

prototype id of location

uint leaderId

id of the leader

uint claimId

id of the member who claimed leadership, and wants to overthrown current leader

uint leaderTime

time that will allow claimee to claim leadership even without forcing current leader to resign/killing him this is time for leader to act

uint claimTime

time that will allow another player to claim leadership this is time for claimee to act

uint newsId

index to array with faction news

News.

uint score

score

uint locX

worldmap coord

uint locY

worldmap coord

Denotes whether it's player-driven gang or not.

uint lastUsed

Tracks the time when faction has been last accessed.

uint update_seq

Some features requires us to track the 'update' counter.

This is the counter.