naev 0.12.6
faction.c File Reference

Handles the Naev factions. More...

#include "faction.h"
#include "array.h"
#include "colour.h"
#include "hook.h"
#include "log.h"
#include "ndata.h"
#include "nlua.h"
#include "nlua_system.h"
#include "nxml.h"
#include "opengl_tex.h"
#include "player.h"
#include "space.h"
Include dependency graph for faction.c:

Go to the source code of this file.

Data Structures

struct  Faction
 Description of a lane-building faction. More...

Macros

#define XML_FACTION_ID   "Factions"
#define XML_FACTION_TAG   "faction"
#define FACTION_STATIC    ( 1 << 0 )
#define FACTION_INVISIBLE    ( 1 << 1 )
#define FACTION_KNOWN   ( 1 << 2 )
#define FACTION_DYNAMIC   ( 1 << 3 )
#define FACTION_USESHIDDENJUMPS    ( 1 << 4 )
#define FACTION_REPOVERRIDE   ( 1 << 5 ) /* Reputation is being overidden. */
#define faction_setFlag(fa, f)
#define faction_rmFlag(fa, f)
#define faction_isFlag(fa, f)
#define faction_isKnown_(fa)

Enumerations

enum  FactionGrid { GRID_NONE = 0 , GRID_ENEMIES , GRID_ALLIES , GRID_NEUTRAL }

Functions

static int faction_getRaw (const char *name)
 Gets a faction ID by name.
static void faction_freeOne (Faction *f)
 Frees a single faction.
static void faction_sanitizePlayer (Faction *faction)
 Sanitizes player faction standing.
static double faction_hitLua (int f, const StarSystem *sys, double mod, const char *source, int secondary, int primary_faction)
 Mods player using the power of Lua.
static int faction_parse (Faction *temp, const char *file)
 Parses a single faction, but doesn't set the allies/enemies bit.
static int faction_parseSocial (const char *file)
 Parses the social tidbits of a faction: allies and enemies.
static void faction_addStandingScript (Faction *temp, const char *scriptname)
 Sets up a standing script for a faction.
static void faction_computeGrid (void)
 Computes the faction relationship grid.
int pfaction_save (xmlTextWriterPtr writer)
 Saves player's standings with the factions.
int pfaction_load (xmlNodePtr parent)
 Loads the player's faction standings.
static int faction_cmp (const void *p1, const void *p2)
int faction_exists (const char *name)
 Checks to see if a faction exists by name.
int faction_get (const char *name)
 Gets a faction ID by name.
int * faction_getAll (void)
 Returns all faction IDs in an array (array.h).
int * faction_getAllVisible (void)
 Returns all non-invisible faction IDs in an array (array.h).
int * faction_getKnown ()
 Gets all the known factions in an array (array.h).
void faction_clearKnown ()
 Clears the known factions.
int faction_isStatic (int id)
 Is the faction static?
int faction_isInvisible (int id)
 Is the faction invisible?
int faction_setInvisible (int id, int state)
 Sets the faction's invisible state.
int faction_isKnown (int id)
 Is the faction known?
int faction_isDynamic (int id)
 Is faction dynamic.
int faction_setKnown (int id, int state)
 Sets the factions known state.
const char * faction_name (int f)
 Gets a factions "real" (internal) name.
const char * faction_shortname (int f)
 Gets a factions short name (human-readable).
const char * faction_longname (int f)
 Gets the faction's long name (formal, human-readable).
const char * faction_mapname (int f)
 Gets the faction's map name (translated).
const char * faction_description (int f)
 Gets the faction's description (translated).
const char * faction_default_ai (int f)
 Gets the name of the default AI profile for the faction's pilots.
const char *const * faction_tags (int f)
 Gets the tags the faction has.
double faction_lane_length_per_presence (int f)
 Gets the faction's weight for patrolled safe-lane construction (0 means they don't build lanes).
double faction_lane_base_cost (int f)
 Gets the faction's weight for patrolled safe-lane construction;.
const glTexturefaction_logo (int f)
 Gets the faction's logo (ideally 256x256).
const glColour * faction_colour (int f)
 Gets the colour of the faction.
const int * faction_getEnemies (int f)
 Gets the list of enemies of a faction.
const int * faction_getAllies (int f)
 Gets the list of allies of a faction.
void faction_clearEnemy (int f)
 Clears all the enemies of a dynamic faction.
void faction_addEnemy (int f, int o)
 Adds an enemy to the faction's enemies list.
void faction_rmEnemy (int f, int o)
 Removes an enemy from the faction's enemies list.
void faction_clearAlly (int f)
 Clears all the ally of a dynamic faction.
void faction_addAlly (int f, int o)
 Adds an ally to the faction's allies list.
void faction_rmAlly (int f, int o)
 Removes an ally from the faction's allies list.
nlua_env faction_getScheduler (int f)
 Gets the state associated to the faction scheduler.
nlua_env faction_getEquipper (int f)
 Gets the equipper state associated to the faction scheduler.
double faction_hit (int f, const StarSystem *sys, double mod, const char *source, int single)
 Handles a faction hit against a faction and how to apply it.
double faction_hitTest (int f, const StarSystem *sys, double mod, const char *source)
 Tests a faction hit to see how much it would apply. Does not actually modify standing.
void faction_modPlayer (int f, double mod, const char *source)
 Modifies the player's standing with a faction.
void faction_modPlayerSingle (int f, double mod, const char *source)
 Modifies the player's standing without affecting others.
void faction_modPlayerRaw (int f, double mod)
 Modifies the player's standing without affecting others.
void faction_setReputation (int f, double value)
 Sets the player's standing with a faction.
double faction_reputation (int f)
 Gets the player's standing with a faction.
double faction_reputationDefault (int f)
 Gets the player's default standing with a faction.
int faction_isPlayerFriend (int f)
 Gets whether or not the player is a friend of the faction.
int faction_isPlayerFriendSystem (int f, const StarSystem *sys)
int faction_isPlayerEnemy (int f)
 Gets whether or not the player is an enemy of the faction.
int faction_isPlayerEnemySystem (int f, const StarSystem *sys)
const glColour * faction_reputationColour (int f)
 Gets the colour of the faction based on it's standing with the player.
const glColour * faction_reputationColourSystem (int f, const StarSystem *sys)
char faction_reputationColourChar (int f)
 Gets the faction character associated to its standing with the player.
char faction_reputationColourCharSystem (int f, const StarSystem *sys)
const char * faction_getStandingText (int f)
 Gets the player's standing in human readable form.
const char * faction_getStandingTextAtValue (int f, double value)
 Gets the player's standing in human readable form.
const char * faction_getStandingBroad (int f, int bribed, int override)
 Gets the broad faction standing.
double faction_reputationMax (int f)
 Gets the maximum reputation of a faction.
int areNeutral (int a, int b)
 Checks whether two factions are true neutral.
int areEnemies (int a, int b)
 Checks whether two factions are enemies.
int areAllies (int a, int b)
 Checks whether two factions are allies or not.
int areEnemiesSystem (int a, int b, const StarSystem *sys)
int areAlliesSystem (int a, int b, const StarSystem *sys)
int faction_isFaction (int f)
 Checks whether or not a faction is valid.
void factions_reset (void)
 Resets player standing and flags of factions to default.
void factions_resetLocal (void)
 Reset local standing.
void faction_updateSingle (int f)
void faction_updateGlobal (void)
 Computes the global faction standing for each of the factions.
void faction_applyLocalThreshold (int f, StarSystem *sys)
int factions_load (void)
 Loads up all the factions from the data file.
void factions_loadPost (void)
void factions_free (void)
 Frees the factions.
int * faction_getGroup (int which)
 Returns an array of faction ids.
double faction_reputationOverride (int f, int *set)
void faction_setReputationOverride (int f, int set, double value)
int faction_usesHiddenJumps (int f)
 Checks to see if a faction uses hidden jumps.
const FactionGeneratorfaction_generators (int f)
 Gets the faction's generators.
void factions_clearDynamic (void)
 Clears dynamic factions.
int faction_dynAdd (int base, const char *name, const char *display, const char *ai, const glColour *colour)
 Dynamically add a faction.

Variables

int faction_player
static Factionfaction_stack = NULL
static int * faction_grid = NULL
static size_t faction_mgrid = 0

Detailed Description

Handles the Naev factions.

Definition in file faction.c.

Macro Definition Documentation

◆ FACTION_DYNAMIC

#define FACTION_DYNAMIC   ( 1 << 3 )

Faction was created dynamically.

Definition at line 40 of file faction.c.

◆ FACTION_INVISIBLE

#define FACTION_INVISIBLE    ( 1 << 1 )

Faction isn't exposed to the player.

Definition at line 37 of file faction.c.

◆ faction_isFlag

#define faction_isFlag ( fa,
f )
Value:
( ( fa )->flags & ( f ) )

Definition at line 47 of file faction.c.

◆ faction_isKnown_

#define faction_isKnown_ ( fa)
Value:
( ( fa )->flags & ( FACTION_KNOWN ) )
#define FACTION_KNOWN
Definition faction.c:39

Definition at line 48 of file faction.c.

◆ FACTION_KNOWN

#define FACTION_KNOWN   ( 1 << 2 )

Faction is known to the player.

Definition at line 39 of file faction.c.

◆ FACTION_REPOVERRIDE

#define FACTION_REPOVERRIDE   ( 1 << 5 ) /* Reputation is being overidden. */

Definition at line 43 of file faction.c.

◆ faction_rmFlag

#define faction_rmFlag ( fa,
f )
Value:
( ( fa )->flags &= ~( f ) )

Definition at line 46 of file faction.c.

◆ faction_setFlag

#define faction_setFlag ( fa,
f )
Value:
( ( fa )->flags |= ( f ) )

Definition at line 45 of file faction.c.

◆ FACTION_STATIC

#define FACTION_STATIC    ( 1 << 0 )

Faction doesn't change standing with player.

Definition at line 35 of file faction.c.

◆ FACTION_USESHIDDENJUMPS

#define FACTION_USESHIDDENJUMPS    ( 1 << 4 )

Faction will try to use hidden jumps when possible.

Definition at line 41 of file faction.c.

◆ XML_FACTION_ID

#define XML_FACTION_ID   "Factions"

XML section identifier

Definition at line 32 of file faction.c.

◆ XML_FACTION_TAG

#define XML_FACTION_TAG   "faction"

XML tag identifier.

Definition at line 33 of file faction.c.

Enumeration Type Documentation

◆ FactionGrid

enum FactionGrid

Definition at line 50 of file faction.c.

Function Documentation

◆ areAllies()

int areAllies ( int a,
int b )

Checks whether two factions are allies or not.

Parameters
aFaction A.
bFaction B.
Returns
1 if A and B are allies, 0 otherwise.

Definition at line 1476 of file faction.c.

◆ areAlliesSystem()

int areAlliesSystem ( int a,
int b,
const StarSystem * sys )

Definition at line 1514 of file faction.c.

◆ areEnemies()

int areEnemies ( int a,
int b )

Checks whether two factions are enemies.

Parameters
aFaction A.
bFaction B.
Returns
1 if A and B are enemies, 0 otherwise.

Definition at line 1450 of file faction.c.

◆ areEnemiesSystem()

int areEnemiesSystem ( int a,
int b,
const StarSystem * sys )

Definition at line 1495 of file faction.c.

◆ areNeutral()

int areNeutral ( int a,
int b )

Checks whether two factions are true neutral.

The player isn't true neutral with anyone.

Parameters
aFaction A.
bFaction B.
Returns
1 if A and B are true neutral, 0 otherwise.

Definition at line 1424 of file faction.c.

◆ faction_addAlly()

void faction_addAlly ( int f,
int o )

Adds an ally to the faction's allies list.

Parameters
fThe faction to add an ally to.
oThe other faction to make an ally.

Definition at line 685 of file faction.c.

◆ faction_addEnemy()

void faction_addEnemy ( int f,
int o )

Adds an enemy to the faction's enemies list.

Parameters
fThe faction to add an enemy to.
oThe other faction to make an enemy.

Definition at line 589 of file faction.c.

◆ faction_addStandingScript()

void faction_addStandingScript ( Faction * temp,
const char * scriptname )
static

Sets up a standing script for a faction.

Parameters
tempFaction to associate the script to.
scriptnameName of the lua script to use (e.g., "static").

Definition at line 1712 of file faction.c.

◆ faction_applyLocalThreshold()

void faction_applyLocalThreshold ( int f,
StarSystem * sys )

Definition at line 1913 of file faction.c.

◆ faction_clearAlly()

void faction_clearAlly ( int f)

Clears all the ally of a dynamic faction.

Parameters
fFaction to clear ally of.

Definition at line 664 of file faction.c.

◆ faction_clearEnemy()

void faction_clearEnemy ( int f)

Clears all the enemies of a dynamic faction.

Parameters
fFaction to clear enemies of.

Definition at line 568 of file faction.c.

◆ faction_clearKnown()

void faction_clearKnown ( void )

Clears the known factions.

Definition at line 257 of file faction.c.

◆ faction_cmp()

int faction_cmp ( const void * p1,
const void * p2 )
static

Definition at line 151 of file faction.c.

◆ faction_colour()

const glColour * faction_colour ( int f)

Gets the colour of the faction.

Parameters
fFaction to get the colour of.
Returns
The faction's colour

Definition at line 494 of file faction.c.

◆ faction_computeGrid()

void faction_computeGrid ( void )
static

Computes the faction relationship grid.

Definition at line 2451 of file faction.c.

◆ faction_default_ai()

const char * faction_default_ai ( int f)

Gets the name of the default AI profile for the faction's pilots.

Parameters
fFaction ID.
Returns
The faction's AI profile name.

Definition at line 424 of file faction.c.

◆ faction_description()

const char * faction_description ( int f)

Gets the faction's description (translated).

Parameters
fFaction to get the name of.
Returns
The faction's description (in User's language).

Definition at line 407 of file faction.c.

◆ faction_dynAdd()

int faction_dynAdd ( int base,
const char * name,
const char * display,
const char * ai,
const glColour * colour )

Dynamically add a faction.

Parameters
baseFaction to base it off (negative for none).
nameName of the faction to set.
displayDisplay name to use.
aiDefault pilot AI to use (if NULL, inherit from base).
colourDefault colour to use (if NULL, inherit from base).

Definition at line 2397 of file faction.c.

◆ faction_exists()

int faction_exists ( const char * name)

Checks to see if a faction exists by name.

Parameters
nameName of the faction to seek.
Returns
ID of the faction.

Definition at line 198 of file faction.c.

◆ faction_freeOne()

void faction_freeOne ( Faction * f)
static

Frees a single faction.

Definition at line 2160 of file faction.c.

◆ faction_generators()

const FactionGenerator * faction_generators ( int f)

Gets the faction's generators.

Definition at line 2366 of file faction.c.

◆ faction_get()

int faction_get ( const char * name)

Gets a faction ID by name.

Parameters
nameName of the faction to seek.
Returns
ID of the faction.

Definition at line 209 of file faction.c.

◆ faction_getAll()

int * faction_getAll ( void )

Returns all faction IDs in an array (array.h).

Definition at line 220 of file faction.c.

◆ faction_getAllies()

const int * faction_getAllies ( int f)

Gets the list of allies of a faction.

Parameters
fFaction to get allies of.
Returns
Array (array.h): The allies of the faction.

Definition at line 539 of file faction.c.

◆ faction_getAllVisible()

int * faction_getAllVisible ( void )

Returns all non-invisible faction IDs in an array (array.h).

Definition at line 231 of file faction.c.

◆ faction_getEnemies()

const int * faction_getEnemies ( int f)

Gets the list of enemies of a faction.

Parameters
fFaction to get enemies of.
Returns
Array (array.h): The enemies of the faction.

Definition at line 509 of file faction.c.

◆ faction_getEquipper()

nlua_env faction_getEquipper ( int f)

Gets the equipper state associated to the faction scheduler.

Definition at line 770 of file faction.c.

◆ faction_getGroup()

int * faction_getGroup ( int which)

Returns an array of faction ids.

Parameters
whichWhich factions to get. (0,1,2,3 : all, friendly, neutral, hostile)
Returns
Array (array.h): The faction IDs of the specified alignment.

Definition at line 2294 of file faction.c.

◆ faction_getKnown()

int * faction_getKnown ( )

Gets all the known factions in an array (array.h).

Definition at line 243 of file faction.c.

◆ faction_getRaw()

int faction_getRaw ( const char * name)
static

Gets a faction ID by name.

Parameters
nameName of the faction to seek.
Returns
ID of the faction.

Definition at line 164 of file faction.c.

◆ faction_getScheduler()

nlua_env faction_getScheduler ( int f)

Gets the state associated to the faction scheduler.

Definition at line 758 of file faction.c.

◆ faction_getStandingBroad()

const char * faction_getStandingBroad ( int f,
int bribed,
int override )

Gets the broad faction standing.

Parameters
fFaction to get broad standing of.
bribedWhether or not the respective pilot is bribed.
overrideIf positive sets to ally, if negative sets to hostile.
Returns
Human readable broad player's standing.

Definition at line 1322 of file faction.c.

◆ faction_getStandingText()

const char * faction_getStandingText ( int f)

Gets the player's standing in human readable form.

Parameters
fFaction to get standing of.
Returns
Human readable player's standing (in player's native language).

Definition at line 1257 of file faction.c.

◆ faction_getStandingTextAtValue()

const char * faction_getStandingTextAtValue ( int f,
double value )

Gets the player's standing in human readable form.

Parameters
fFaction to get standing of.
valueValue to get the readable string from.
Returns
Human readable player's standing (in player's native language).

Definition at line 1269 of file faction.c.

◆ faction_hit()

double faction_hit ( int f,
const StarSystem * sys,
double mod,
const char * source,
int single )

Handles a faction hit against a faction and how to apply it.

Definition at line 871 of file faction.c.

◆ faction_hitLua()

double faction_hitLua ( int f,
const StarSystem * sys,
double mod,
const char * source,
int secondary,
int primary_faction )
static

Mods player using the power of Lua.

Definition at line 792 of file faction.c.

◆ faction_hitTest()

double faction_hitTest ( int f,
const StarSystem * sys,
double mod,
const char * source )

Tests a faction hit to see how much it would apply. Does not actually modify standing.

Definition at line 903 of file faction.c.

◆ faction_isDynamic()

int faction_isDynamic ( int id)

Is faction dynamic.

Definition at line 308 of file faction.c.

◆ faction_isFaction()

int faction_isFaction ( int f)

Checks whether or not a faction is valid.

Parameters
fFaction to check for validity.
Returns
1 if faction is valid, 0 otherwise.

Definition at line 1539 of file faction.c.

◆ faction_isInvisible()

int faction_isInvisible ( int id)

Is the faction invisible?

Definition at line 275 of file faction.c.

◆ faction_isKnown()

int faction_isKnown ( int id)

Is the faction known?

Definition at line 300 of file faction.c.

◆ faction_isPlayerEnemy()

int faction_isPlayerEnemy ( int f)

Gets whether or not the player is an enemy of the faction.

Parameters
fFaction to check hostility of.
Returns
1 if the player is an enemy, 0 otherwise.

Definition at line 1179 of file faction.c.

◆ faction_isPlayerEnemySystem()

int faction_isPlayerEnemySystem ( int f,
const StarSystem * sys )

Definition at line 1183 of file faction.c.

◆ faction_isPlayerFriend()

int faction_isPlayerFriend ( int f)

Gets whether or not the player is a friend of the faction.

Parameters
fFaction to check friendliness of.
Returns
1 if the player is a friend, 0 otherwise.

Definition at line 1162 of file faction.c.

◆ faction_isPlayerFriendSystem()

int faction_isPlayerFriendSystem ( int f,
const StarSystem * sys )

Definition at line 1167 of file faction.c.

◆ faction_isStatic()

int faction_isStatic ( int id)

Is the faction static?

Definition at line 267 of file faction.c.

◆ faction_lane_base_cost()

double faction_lane_base_cost ( int f)

Gets the faction's weight for patrolled safe-lane construction;.

Definition at line 464 of file faction.c.

◆ faction_lane_length_per_presence()

double faction_lane_length_per_presence ( int f)

Gets the faction's weight for patrolled safe-lane construction (0 means they don't build lanes).

Definition at line 452 of file faction.c.

◆ faction_logo()

const glTexture * faction_logo ( int f)

Gets the faction's logo (ideally 256x256).

Parameters
fFaction to get the logo of.
Returns
The faction's logo image.

Definition at line 479 of file faction.c.

◆ faction_longname()

const char * faction_longname ( int f)

Gets the faction's long name (formal, human-readable).

Parameters
fFaction to get the name of.
Returns
The faction's long name (in player's native language).

Definition at line 373 of file faction.c.

◆ faction_mapname()

const char * faction_mapname ( int f)

Gets the faction's map name (translated).

Parameters
fFaction to get the name of.
Returns
The faction's map name (in User's language).

Definition at line 390 of file faction.c.

◆ faction_modPlayer()

void faction_modPlayer ( int f,
double mod,
const char * source )

Modifies the player's standing with a faction.

Affects enemies and allies too.

Parameters
fFaction to modify player's standing.
modModifier to modify by.
sourceSource of the faction modifier.

Possible sources:

  • "kill" : Pilot death.
  • "distress" : Pilot distress signal.
  • "script" : Either a mission or an event.

Definition at line 967 of file faction.c.

◆ faction_modPlayerRaw()

void faction_modPlayerRaw ( int f,
double mod )

Modifies the player's standing without affecting others.

Does not affect allies nor enemies and does not run through the Lua script.

Parameters
fFaction whose standing to modify.
modAmount to modify standing by.
See also
faction_modPlayer

Definition at line 1026 of file faction.c.

◆ faction_modPlayerSingle()

void faction_modPlayerSingle ( int f,
double mod,
const char * source )

Modifies the player's standing without affecting others.

Does not affect allies nor enemies.

Parameters
fFaction whose standing to modify.
modAmount to modify standing by.
sourceSource of the faction modifier.

Possible sources:

  • "kill" : Pilot death.
  • "distress" : Pilot distress signal.
  • "script" : Either a mission or an event.
See also
faction_modPlayer

Definition at line 1007 of file faction.c.

◆ faction_name()

const char * faction_name ( int f)

Gets a factions "real" (internal) name.

Parameters
fFaction to get the name of.
Returns
Name of the faction (internal/English).

Definition at line 331 of file faction.c.

◆ faction_parse()

int faction_parse ( Faction * temp,
const char * file )
static

Parses a single faction, but doesn't set the allies/enemies bit.

Parameters
tempFaction to load data into.
fileFile to parse.
Returns
Faction created from parent node.

Definition at line 1553 of file faction.c.

◆ faction_parseSocial()

int faction_parseSocial ( const char * file)
static

Parses the social tidbits of a faction: allies and enemies.

Parameters
fileFile to parse.
Returns
0 on success.

Definition at line 1757 of file faction.c.

◆ faction_reputation()

double faction_reputation ( int f)

Gets the player's standing with a faction.

Parameters
fFaction to get player's standing from.
Returns
The standing the player has with the faction.

Definition at line 1129 of file faction.c.

◆ faction_reputationColour()

const glColour * faction_reputationColour ( int f)

Gets the colour of the faction based on it's standing with the player.

Used to unify the colour checks all over.

Parameters
fFaction to get the colour of based on player's standing.
Returns
Pointer to the colour.

Definition at line 1196 of file faction.c.

◆ faction_reputationColourChar()

char faction_reputationColourChar ( int f)

Gets the faction character associated to its standing with the player.

Use this to do something like "#%c", faction_reputationColourChar( some_faction ) in the font print routines.

Parameters
fFaction to get the colour of based on player's standing.
Returns
The character associated to the faction.

Definition at line 1228 of file faction.c.

◆ faction_reputationColourCharSystem()

char faction_reputationColourCharSystem ( int f,
const StarSystem * sys )

Definition at line 1239 of file faction.c.

◆ faction_reputationColourSystem()

const glColour * faction_reputationColourSystem ( int f,
const StarSystem * sys )

Definition at line 1207 of file faction.c.

◆ faction_reputationDefault()

double faction_reputationDefault ( int f)

Gets the player's default standing with a faction.

Parameters
fFaction to get player's default standing from.
Returns
The default standing the player has with the faction.

Definition at line 1148 of file faction.c.

◆ faction_reputationMax()

double faction_reputationMax ( int f)

Gets the maximum reputation of a faction.

Parameters
fFaction to get maximum reputation of.
Returns
Maximum value of the reputation with a faction.

Definition at line 1374 of file faction.c.

◆ faction_reputationOverride()

double faction_reputationOverride ( int f,
int * set )

Definition at line 2329 of file faction.c.

◆ faction_rmAlly()

void faction_rmAlly ( int f,
int o )

Removes an ally from the faction's allies list.

Parameters
fThe faction to remove an ally from.
oThe other faction to remove as an ally.

Definition at line 732 of file faction.c.

◆ faction_rmEnemy()

void faction_rmEnemy ( int f,
int o )

Removes an enemy from the faction's enemies list.

Parameters
fThe faction to remove an enemy from.
oThe other faction to remove as an enemy.

Definition at line 636 of file faction.c.

◆ faction_sanitizePlayer()

void faction_sanitizePlayer ( Faction * faction)
static

Sanitizes player faction standing.

Parameters
factionFaction to sanitize.

Definition at line 784 of file faction.c.

◆ faction_setInvisible()

int faction_setInvisible ( int id,
int state )

Sets the faction's invisible state.

Definition at line 283 of file faction.c.

◆ faction_setKnown()

int faction_setKnown ( int id,
int state )

Sets the factions known state.

Definition at line 316 of file faction.c.

◆ faction_setReputation()

void faction_setReputation ( int f,
double value )

Sets the player's standing with a faction.

Parameters
fFaction to set the player's standing for.
valueValue to set the player's standing to.

Definition at line 1057 of file faction.c.

◆ faction_setReputationOverride()

void faction_setReputationOverride ( int f,
int set,
double value )

Definition at line 2340 of file faction.c.

◆ faction_shortname()

const char * faction_shortname ( int f)

Gets a factions short name (human-readable).

Parameters
fFaction to get the name of.
Returns
Name of the faction (in player's native language).

Definition at line 350 of file faction.c.

◆ faction_tags()

const char *const * faction_tags ( int f)

Gets the tags the faction has.

Parameters
fFaction ID.
Returns
The tagss the faction has (array.h).

Definition at line 439 of file faction.c.

◆ faction_updateGlobal()

void faction_updateGlobal ( void )

Computes the global faction standing for each of the factions.

Definition at line 1907 of file faction.c.

◆ faction_updateSingle()

void faction_updateSingle ( int f)

Definition at line 1886 of file faction.c.

◆ faction_usesHiddenJumps()

int faction_usesHiddenJumps ( int f)

Checks to see if a faction uses hidden jumps.

Definition at line 2356 of file faction.c.

◆ factions_clearDynamic()

void factions_clearDynamic ( void )

Clears dynamic factions.

Definition at line 2376 of file faction.c.

◆ factions_free()

void factions_free ( void )

Frees the factions.

Definition at line 2188 of file faction.c.

◆ factions_load()

int factions_load ( void )

Loads up all the factions from the data file.

Returns
0 on success.

Definition at line 1994 of file faction.c.

◆ factions_loadPost()

void factions_loadPost ( void )

Definition at line 2102 of file faction.c.

◆ factions_reset()

void factions_reset ( void )

Resets player standing and flags of factions to default.

Definition at line 1858 of file faction.c.

◆ factions_resetLocal()

void factions_resetLocal ( void )

Reset local standing.

Definition at line 1873 of file faction.c.

◆ pfaction_load()

int pfaction_load ( xmlNodePtr parent)

Loads the player's faction standings.

Parameters
parentParent xml node to read from.
Returns
0 on success.

Definition at line 2242 of file faction.c.

◆ pfaction_save()

int pfaction_save ( xmlTextWriterPtr writer)

Saves player's standings with the factions.

Parameters
writerThe xml writer to use.
Returns
0 on success.

Definition at line 2208 of file faction.c.

Variable Documentation

◆ faction_grid

int* faction_grid = NULL
static

Grid of faction status.

Definition at line 130 of file faction.c.

◆ faction_mgrid

size_t faction_mgrid = 0
static

Allocated memory.

Definition at line 131 of file faction.c.

◆ faction_player

int faction_player

Player faction identifier.

Definition at line 57 of file faction.c.

◆ faction_stack

Faction* faction_stack = NULL
static

Faction stack.

Definition at line 129 of file faction.c.