Planeshift
|
This class is a set of faction structures. More...
#include <factions.h>
Public Member Functions | |
bool | CheckFaction (Faction *faction, int value) |
Check given faction. | |
FactionSet (const char *csv_list, csHash< Faction *, int, CS::Memory::AllocatorMalloc > &factionset) | |
Construct the faction set based on the comma delimited text. | |
float | FindWeightedDiff (FactionSet *other) |
int | GetFaction (Faction *faction) |
Just get the number. | |
void | GetFactionListCSV (csString &csv) |
Create a comma delimited string based on the current faction standings. | |
bool | GetFactionStanding (int factionID, int &standing, float &weight) |
csHash< FactionStanding *, int > & | GetStandings () |
void | UpdateFactionStanding (int factionID, int delta, bool setDirty=true, bool overwrite=false) |
Updates a faction standing. | |
~FactionSet () | |
Protected Attributes | |
csHash< Faction *, int > * | factions_by_id |
A list of all the factions in this set. | |
csHash< FactionStanding *, int > | factionstandings |
A list of all the standings with each faction. |
This class is a set of faction structures.
It's designed for storing, updating and saving many faction scores per player in a compact way.
Definition at line 68 of file factions.h.
FactionSet::FactionSet | ( | const char * | csv_list, |
csHash< Faction *, int, CS::Memory::AllocatorMalloc > & | factionset | ||
) |
Construct the faction set based on the comma delimited text.
csv_list | The list of comma delimited factions. Faction,score. |
factionset | The global list of factions. |
FactionSet::~FactionSet | ( | ) |
float FactionSet::FindWeightedDiff | ( | FactionSet * | other | ) |
void FactionSet::GetFactionListCSV | ( | csString & | csv | ) |
Create a comma delimited string based on the current faction standings.
csv | The destination for the constructed string. |
csHash<FactionStanding*, int>& FactionSet::GetStandings | ( | ) | [inline] |
Definition at line 109 of file factions.h.
void FactionSet::UpdateFactionStanding | ( | int | factionID, |
int | delta, | ||
bool | setDirty = true , |
||
bool | overwrite = false |
||
) |
Updates a faction standing.
If the factionID is not in the current list of standings a new standing is added.
factionID | The ID of the faction to update. |
delta | The amount to change the faction score by. If the faction is not in the current list this will be the starting score. |
setDirty | declares if the variable should be set dirty when updated. |
overwrite | Sets if the delta should overwrite the current value (true) or just be added to the current value (false) |
csHash<Faction*, int>* FactionSet::factions_by_id [protected] |
A list of all the factions in this set.
Definition at line 75 of file factions.h.
csHash<FactionStanding*, int> FactionSet::factionstandings [protected] |
A list of all the standings with each faction.
Definition at line 72 of file factions.h.