cp_nation.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  nationInfo_s
 Detailed information about the nation relationship (currently per month, but could be used elsewhere). More...
struct  nation_s
 Nation definition. More...
struct  city_s
 City definition. More...

Defines

#define MAX_NATIONS   8

Typedefs

typedef struct nationInfo_s nationInfo_t
 Detailed information about the nation relationship (currently per month, but could be used elsewhere).
typedef struct nation_s nation_t
 Nation definition.
typedef struct city_s city_t
 City definition.

Functions

nation_tNAT_GetNationByIDX (const int index)
nation_tNAT_GetNationByID (const char *nationID)
 Return a nation-pointer by the nations id (nation_t->id) text.
void NAT_UpdateHappinessForAllNations (void)
 Lower happiness of nations depending on alien activity.
void NAT_SetHappiness (nation_t *nation, const float happiness)
 Updates the nation happiness.
int NAT_GetFunding (const nation_t *const nation, int month)
 Get the actual funding of a nation.
const char * NAT_GetHappinessString (const nation_t *nation)
 Translates the nation happiness float value to a string.
void CL_ParseNations (const char *name, const char **text)
 Parse the nation data from script file.
void CL_ParseCities (const char *name, const char **text)
 Parse the city data from script file.
qboolean NAT_ScriptSanityCheck (void)
 Checks the parsed nations and cities for errors.
void NAT_InitStartup (void)

Define Documentation

#define MAX_NATIONS   8

Typedef Documentation

typedef struct city_s city_t

City definition.

typedef struct nation_s nation_t

Nation definition.

typedef struct nationInfo_s nationInfo_t

Detailed information about the nation relationship (currently per month, but could be used elsewhere).

Todo:
Maybe we should also move the "funding" stuff (see nation_t) in here? It is static right now though so i see no reason to do that yet.

Function Documentation

void CL_ParseCities ( const char *  name,
const char **  text 
)

Parse the city data from script file.

Parameters:
[in] name ID of the found nation
[in] text The text of the nation node
See also:
city_vals
CL_ParseScriptFirst
Note:
write into cp_campaignPool - free on every game restart and reparse

Definition at line 379 of file cp_nation.c.

References byte, ccs, ccs_s::cities, Com_DPrintf(), Com_EParse(), Com_EParseValue(), Com_Parse(), Com_Printf(), cp_campaignPool, linkedList_s::data, DEBUG_CLIENT, city_s::id, city_s::idx, LIST_Add(), Mem_PoolStrDup, Mem_PoolStrDupTo, linkedList_s::next, ccs_s::numCities, value_s::ofs, value_s::size, value_s::string, value_s::type, V_CLIENT_HUNK_STRING, and V_TRANSLATION_STRING.

Referenced by CL_ParseScriptFirst().

void CL_ParseNations ( const char *  name,
const char **  text 
)

Parse the nation data from script file.

Parameters:
[in] name Name or ID of the found nation
[in] text The text of the nation node
See also:
nation_vals
CL_ParseScriptFirst
Note:
write into cp_campaignPool - free on every game restart and reparse

Definition at line 286 of file cp_nation.c.

References ccs, Com_DPrintf(), Com_EParse(), Com_EParseValue(), Com_Parse(), Com_Printf(), cp_campaignPool, DEBUG_CLIENT, i, nation_s::id, nation_s::idx, nationInfo_s::inuse, MAX_NATIONS, Mem_PoolStrDup, Mem_PoolStrDupTo, ccs_s::nations, ccs_s::numNations, value_s::ofs, qtrue, value_s::size, nation_s::stats, value_s::string, value_s::type, V_CLIENT_HUNK_STRING, and V_TRANSLATION_STRING.

Referenced by CL_ParseScriptFirst().

int NAT_GetFunding ( const nation_t *const   nation,
int  month 
)

Get the actual funding of a nation.

Parameters:
[in] nation Pointer to the nation
[in] month idx of the month -- 0 for current month (sa nation_t)
Returns:
actual funding of a nation
See also:
CL_NationsMaxFunding

Definition at line 115 of file cp_nation.c.

References nationInfo_s::happiness, nation_s::maxFunding, and nation_s::stats.

Referenced by CL_NationDrawStats(), CL_NationsMaxFunding(), CL_NationStatsUpdate_f(), CL_StatsUpdate_f(), and CP_NationHandleBudget().

const char* NAT_GetHappinessString ( const nation_t nation  ) 

Translates the nation happiness float value to a string.

Parameters:
[in] nation 
Returns:
Translated happiness string
Note:
happiness is between 0 and 1.0

Definition at line 126 of file cp_nation.c.

References _, nationInfo_s::happiness, and nation_s::stats.

Referenced by CL_StatsUpdate_f(), CP_NationHandleBudget(), NAT_SetHappiness(), and UR_DialogFillNations().

nation_t* NAT_GetNationByID ( const char *  nationID  ) 

Return a nation-pointer by the nations id (nation_t->id) text.

Parameters:
[in] nationID nation id as defined in (nation_t->id)
Returns:
nation_t pointer or NULL if nothing found (=error).

Definition at line 50 of file cp_nation.c.

References ccs, Com_Printf(), i, nation_s::id, ccs_s::nations, and ccs_s::numNations.

Referenced by E_LoadXML(), and NAT_LoadXML().

nation_t* NAT_GetNationByIDX ( const int  index  ) 

Definition at line 37 of file cp_nation.c.

References ccs, ccs_s::nations, and ccs_s::numNations.

Referenced by NAT_SaveXML(), UR_DialogInitSell_f(), and UR_DialogStartSell_f().

void NAT_InitStartup ( void   ) 
qboolean NAT_ScriptSanityCheck ( void   ) 
void NAT_SetHappiness ( nation_t nation,
const float  happiness 
)

Updates the nation happiness.

Parameters:
[in] nation The nation to update the happiness for
[in] happiness The new happiness value to set for the given nation

Todo:
need to more specific message

Definition at line 157 of file cp_nation.c.

References _, ccs, Com_sprintf(), cp_messageBuffer, ccs_s::curCampaign, nationInfo_s::happiness, campaign_s::minhappiness, MSG_STANDARD, MSO_CheckAddNewMessage(), nation_s::name, NAT_GetHappinessString(), NT_HAPPINESS_CHANGED, NT_HAPPINESS_MIN, NT_HAPPINESS_PLEASED, NT_NUM_NOTIFYTYPE, qfalse, and nation_s::stats.

Referenced by CL_HandleNationData(), CP_BuildBaseGovernmentLeave(), CP_ChangeNationHappiness_f(), NAT_UpdateHappinessForAllNations(), and UR_DialogStartSell_f().

void NAT_UpdateHappinessForAllNations ( void   ) 

Generated by  doxygen 1.6.2