|
UFO: Alien Invasion
|
Nation code. More...
#include "../../DateTime.h"

Go to the source code of this file.
Data Structures | |
| struct | nationInfo_t |
| Detailed information about the nation relationship (currently per month, but could be used elsewhere). More... | |
| struct | nation_t |
| Nation definition. More... | |
| struct | city_t |
| City definition. More... | |
Macros | |
| #define | NAT_Foreach(var) |
| iterates trough nations | |
Functions | |
| nation_t * | NAT_GetNationByID (const char *nationID) |
| Return a nation-pointer by the nations id. | |
| nation_t * | NAT_GetRandom (void) |
| Return a pointer to a random nation. | |
| void | NAT_UpdateHappinessForAllNations (const float minhappiness) |
| Lower happiness of nations depending on alien activity. | |
| void | NAT_SetHappiness (const float minhappiness, nation_t *nation, const float happiness) |
| Updates the nation happiness. | |
| int | NAT_GetFunding (const nation_t *const nation, int month) |
| Get the funding of a nation at a certain month. | |
| const nationInfo_t * | NAT_GetCurrentMonthInfo (const nation_t *const nation) |
| Get the current month nation stats. | |
| const char * | NAT_GetHappinessString (const float happiness) |
| Translates the nation happiness float value to a string. | |
| const char * | NAT_GetCurrentHappinessString (const nation_t *nation) |
| Translates the current nation happiness float value to a string. | |
| void | CP_HandleNationData (float minHappiness, struct mission_s *mis, const nation_t *nation, const struct missionResults_s *results, bool won) |
| void | CL_ParseNations (const char *name, const char **text) |
| Parse the nation data from script file. | |
| city_t * | CITY_GetById (const char *cityId) |
| Finds a city by it's scripted identifier. | |
| city_t * | CITY_GetByPos (vec2_t pos) |
| Finds a city by it's geoscape coordinates. | |
| void | CITY_Parse (const char *name, const char **text) |
| Parse the city data from script file. | |
| bool | NAT_ScriptSanityCheck (void) |
| Checks the parsed nations and cities for errors. | |
| void | NAT_HandleBudget (const struct campaign_s *campaign) |
| void | NAT_BackupMonthlyData (void) |
| Backs up each nation's relationship values. | |
| void | NAT_InitStartup (void) |
| Init actions for nation-subsystem. | |
| void | NAT_Shutdown (void) |
| Closing actions for nation-subsystem. | |
Nation code.
Definition in file cp_nation.h.
| #define NAT_Foreach | ( | var | ) |
iterates trough nations
| [out] | var | variable to point to the nation structure |
Definition at line 80 of file cp_nation.h.
Referenced by CL_ParseNations(), CP_CheckLostCondition(), CP_CheckTriggerEvent(), CP_ChooseNation(), CP_GetAverageXVIRate(), CP_HandleNationData(), CP_UpdateNationXVIInfection(), GEO_DrawMarkers(), GEO_GetNation(), NAT_BackupMonthlyData(), NAT_DrawCharts_f(), NAT_GetNationByID(), NAT_GetRandom(), NAT_HandleBudget(), NAT_ListStats_f(), NAT_SaveXML(), TEST_F(), UR_DialogInitSell_f(), and UR_DialogStartSell_f().
| city_t * CITY_GetById | ( | const char * | cityId | ) |
Finds a city by it's scripted identifier.
| [in] | cityId | Scripted ID of the city |
Definition at line 412 of file cp_nation.cpp.
References ccs, LIST_Foreach, and Q_streq.
Referenced by CITY_Parse().
Finds a city by it's geoscape coordinates.
| [in] | pos | Position of the city |
Definition at line 425 of file cp_nation.cpp.
References ccs, LIST_Foreach, and Vector2Equal.
Referenced by MIS_LoadXML().
| void CITY_Parse | ( | const char * | name, |
| const char ** | text ) |
Parse the city data from script file.
| [in] | name | ID of the found nation |
| [in] | text | The text of the nation node |
Definition at line 446 of file cp_nation.cpp.
References ccs, cgi, CITY_GetById(), city_vals, cp_campaignPool, city_t::id, LIST_Add(), name, and OBJZERO.
Referenced by CP_ParseScriptFirst().
| void CL_ParseNations | ( | const char * | name, |
| const char ** | text ) |
Parse the nation data from script file.
| [in] | name | Name or ID of the found nation |
| [in] | text | The text of the nation node |
Definition at line 383 of file cp_nation.cpp.
References ccs, cgi, cp_campaignPool, DEBUG_CLIENT, nation_t::id, nation_t::idx, nationInfo_t::inuse, LIST_Add(), name, NAT_Foreach, nation_vals, OBJZERO, Q_streq, and nation_t::stats.
Referenced by CP_ParseScriptFirst().
| void CP_HandleNationData | ( | float | minHappiness, |
| struct mission_s * | mis, | ||
| const nation_t * | nation, | ||
| const struct missionResults_s * | results, | ||
| bool | won ) |
References name.
Backs up each nation's relationship values.
Back up nation relationship . "inuse" is copied as well so we do not need to set it anywhere.
Definition at line 826 of file cp_nation.cpp.
References i, DateTime::MONTHS_PER_YEAR, and NAT_Foreach.
Referenced by CP_CampaignRun().
| const char * NAT_GetCurrentHappinessString | ( | const nation_t * | nation | ) |
Translates the current nation happiness float value to a string.
| [in] | nation |
Definition at line 177 of file cp_nation.cpp.
References nationInfo_t::happiness, NAT_GetCurrentMonthInfo(), and NAT_GetHappinessString().
Referenced by NAT_HandleBudget(), and NAT_SetHappiness().
| const nationInfo_t * NAT_GetCurrentMonthInfo | ( | const nation_t *const | nation | ) |
Get the current month nation stats.
| [in] | nation | Pointer to the nation |
Definition at line 133 of file cp_nation.cpp.
References nation_t::stats.
Referenced by AB_BaseSearchedByNations(), CP_BuildBaseGovernmentLeave(), CP_ChangeNationHappiness_f(), CP_CheckLostCondition(), CP_CheckTriggerEvent(), CP_ChooseNation(), CP_GetAverageXVIRate(), CP_HandleNationData(), GEO_DrawMarkers(), NAT_GetCurrentHappinessString(), NAT_HandleBudget(), NAT_UpdateHappinessForAllNations(), and UR_DialogInitSell_f().
Get the funding of a nation at a certain month.
| [in] | nation | Pointer to the nation |
| [in] | month | idx of the month – 0 for current month |
Definition at line 121 of file cp_nation.cpp.
References nationInfo_t::happiness, nation_t::maxFunding, DateTime::MONTHS_PER_YEAR, and nation_t::stats.
Referenced by NAT_DrawCharts_f(), NAT_HandleBudget(), and NAT_ListStats_f().
| const char * NAT_GetHappinessString | ( | const float | happiness | ) |
Translates the nation happiness float value to a string.
| [in] | happiness | value |
Definition at line 144 of file cp_nation.cpp.
References _.
Referenced by NAT_GetCurrentHappinessString(), NAT_ListStats_f(), and UR_DialogInitSell_f().
| nation_t * NAT_GetNationByID | ( | const char * | nationID | ) |
Return a nation-pointer by the nations id.
| [in] | nationID | nation id as defined in scripts |
Definition at line 64 of file cp_nation.cpp.
References cgi, NAT_Foreach, and Q_streq.
Referenced by E_LoadXML(), NAT_LoadXML(), TEST_F(), TEST_F(), and UR_DialogStartSell_f().
Return a pointer to a random nation.
Definition at line 46 of file cp_nation.cpp.
References ccs, i, and NAT_Foreach.
Referenced by E_InitialEmployees().
| void NAT_HandleBudget | ( | const struct campaign_s * | campaign | ) |
Init actions for nation-subsystem.
Definition at line 852 of file cp_nation.cpp.
References cgi, and nationCmds.
Referenced by CP_InitStartup().
| bool NAT_ScriptSanityCheck | ( | void | ) |
Checks the parsed nations and cities for errors.
Definition at line 470 of file cp_nation.cpp.
References ccs, cgi, mapDef_t::cultures, GEO_GetColor(), GEO_PositionFitsTCPNTypes(), GEO_PrintParameterStringByPos(), i, INTERESTCATEGORY_TERROR_ATTACK, LIST_Foreach, MapDef_ForeachSingleplayerCampaign, MapIsWater, MAPTYPE_TERRAIN, mapDef_t::populations, REMOVE_ELEM, mapDef_t::storyRelated, mapDef_t::terrains, UFO_GetAvailableUFOsForMission(), UFO_MAX, and mapDef_t::ufos.
Updates the nation happiness.
| [in] | minhappiness | Minimum value of mean happiness before the game is lost |
| [in] | nation | The nation to update the happiness for |
| [in] | happiness | The new happiness value to set for the given nation |
Definition at line 189 of file cp_nation.cpp.
References _, Com_sprintf(), cp_messageBuffer, nationInfo_t::happiness, MSO_CheckAddNewMessage(), nation_t::name, NAT_GetCurrentHappinessString(), NT_HAPPINESS_CHANGED, NT_HAPPINESS_MIN, NT_HAPPINESS_PLEASED, NT_NUM_NOTIFYTYPE, and nation_t::stats.
Referenced by CP_BuildBaseGovernmentLeave(), CP_ChangeNationHappiness_f(), CP_HandleNationData(), NAT_UpdateHappinessForAllNations(), and UR_DialogStartSell_f().
Closing actions for nation-subsystem.
Definition at line 860 of file cp_nation.cpp.
References ccs, cgi, and nationCmds.
Referenced by CP_Shutdown().
| void NAT_UpdateHappinessForAllNations | ( | const float | minhappiness | ) |
Lower happiness of nations depending on alien activity.
Definition at line 84 of file cp_nation.cpp.
References cgi, DEBUG_CLIENT, GEO_GetNation(), nationInfo_t::happiness, HAPPINESS_ALIEN_MISSION_LOSS, MIS_Foreach, nation_t::name, NAT_GetCurrentMonthInfo(), NAT_SetHappiness(), STAGE_HARVEST, STAGE_RECON_GROUND, STAGE_SPREAD_XVI, STAGE_SUBVERT_GOV, and STAGE_TERROR_MISSION.
Referenced by CP_CampaignRun().