Header for installation management related stuff. More...
Go to the source code of this file.
Data Structures | |
struct | installationTemplate_s |
struct | installation_s |
A installation with all it's data. More... | |
Defines | |
#define | MAX_INSTALLATIONS 16 |
#define | MAX_INSTALLTAIONS_PER_BASE 3 |
#define | MAX_INSTALLATION_TEMPLATES 6 |
#define | MAX_INSTALLATION_DAMAGE 100 |
#define | MAX_INSTALLATION_BATTERIES 5 |
#define | INS_GetInstallationIDX(installation) ((ptrdiff_t)((installation) - ccs.installations)) |
#define | INS_GetFoundedInstallationCount() (ccs.numInstallations) |
Typedefs | |
typedef struct installationTemplate_s | installationTemplate_t |
typedef struct installation_s | installation_t |
A installation with all it's data. | |
Enumerations | |
enum | installationStatus_t { INSTALLATION_NOT_USED, INSTALLATION_UNDER_CONSTRUCTION, INSTALLATION_WORKING } |
Possible installation states. More... | |
enum | installationType_t { INSTALLATION_RADAR, INSTALLATION_DEFENCE, INSTALLATION_UFOYARD, INSTALLATION_TYPE_MAX } |
Functions | |
installation_t * | INS_GetInstallationByIDX (int instIdx) |
Array bound check for the installation index. | |
installation_t * | INS_GetFoundedInstallationByIDX (int installationIdx) |
Array bound check for the installation index. | |
installation_t * | INS_GetFirstUnfoundedInstallation (void) |
Get first not yet founded installation. | |
installationTemplate_t * | INS_GetInstallationTemplateFromInstallationID (const char *id) |
Returns the installation Template for a given installation ID. | |
installationType_t | INS_GetType (const installation_t *installation) |
Get the type of an installation. | |
installation_t * | INS_GetFirstUFOYard (qboolean free) |
returns the first installation with (free) ufostoring capacity | |
void | INS_SetUpInstallation (installation_t *installation, installationTemplate_t *installationTemplate, vec2_t pos) |
Setup new installation. | |
installation_t * | INS_GetCurrentSelectedInstallation (void) |
Returns the current selected installation. | |
void | INS_SetCurrentSelectedInstallation (const installation_t *installation) |
Sets the currently selected intallation. | |
void | INS_SelectInstallation (installation_t *installation) |
Select an installation when clicking on it on geoscape, or build a new installation. | |
void | INS_UpdateInstallationData (void) |
Check if some installation are build. | |
void | INS_DestroyInstallation (installation_t *installation) |
Destroys an installation. | |
void | INS_InitStartup (void) |
Resets console commands. | |
void | INS_ParseInstallations (const char *name, const char **text) |
Copies an entry from the installation description file into the list of installation templates. | |
Variables | |
installation_t * | installationCurrent |
vec2_t | newInstallationPos |
Header for installation management related stuff.
Definition in file cp_installation.h.
#define INS_GetFoundedInstallationCount | ( | ) | (ccs.numInstallations) |
Definition at line 37 of file cp_installation.h.
#define INS_GetInstallationIDX | ( | installation | ) | ((ptrdiff_t)((installation) - ccs.installations)) |
Definition at line 36 of file cp_installation.h.
Referenced by INS_LoadXML(), and INS_SetUpInstallation().
#define MAX_INSTALLATION_BATTERIES 5 |
Definition at line 34 of file cp_installation.h.
#define MAX_INSTALLATION_DAMAGE 100 |
Definition at line 33 of file cp_installation.h.
#define MAX_INSTALLATION_TEMPLATES 6 |
Definition at line 31 of file cp_installation.h.
Referenced by INS_ParseInstallations().
#define MAX_INSTALLATIONS 16 |
Definition at line 29 of file cp_installation.h.
Referenced by AII_UpdateInstallationDelay(), AIRFIGHT_CampaignRunBaseDefence(), B_GetInstallationLimit(), CL_PopupInterceptBaseClick_f(), CP_InterceptChooseInstallation(), INS_GetCurrentSelectedInstallation(), INS_GetInstallationByIDX(), INS_LoadXML(), INS_SetCurrentSelectedInstallation(), INS_UpdateInstallationData(), MAP_DrawMapMarkers(), MAP_GetGeoscapeAngle(), MAP_MapClick(), RADAR_AddDetectedUFOToEveryRadar(), RADAR_CheckRadarSensored(), RADAR_DeactivateRadarOverlay(), RADAR_NotifyUFORemoved(), RADAR_UpdateStaticRadarCoverage(), UFO_UpdateAlienInterestForAllBasesAndInstallations(), and US_LoadXML().
#define MAX_INSTALLTAIONS_PER_BASE 3 |
Definition at line 30 of file cp_installation.h.
Referenced by B_GetInstallationLimit().
typedef struct installation_s installation_t |
A installation with all it's data.
typedef struct installationTemplate_s installationTemplate_t |
enum installationStatus_t |
Possible installation states.
INSTALLATION_NOT_USED |
installation is not set yet |
INSTALLATION_UNDER_CONSTRUCTION |
installation is under construction |
INSTALLATION_WORKING |
nothing special, it's working |
Definition at line 43 of file cp_installation.h.
enum installationType_t |
Definition at line 65 of file cp_installation.h.
void INS_DestroyInstallation | ( | installation_t * | installation | ) |
Destroys an installation.
[in,out] | installation | Pointer to the installation to be destroyed |
Definition at line 155 of file cp_installation.c.
References _, ccs, Com_sprintf(), cp_messageBuffer, CP_MissionNotifyInstallationDestroyed(), Cvar_Set(), installation_s::founded, installation_s::idx, storedUFO_s::installation, ccs_s::installations, cap_maxcur_s::max, MSG_CONSTRUCTION, MSO_CheckAddNewMessage(), installation_s::name, NT_INSTALLATION_DESTROY, ccs_s::numInstallations, qfalse, RADAR_UpdateInstallationRadarCoverage(), REMOVE_ELEM_ADJUST_IDX, installation_s::ufoCapacity, US_GetNext(), US_RemoveUFOsExceedingCapacity(), and va().
Referenced by CP_InterceptMissionLeave(), and INS_DestroyInstallation_f().
installation_t* INS_GetCurrentSelectedInstallation | ( | void | ) |
Returns the current selected installation.
Definition at line 189 of file cp_installation.c.
References i, INS_GetInstallationByIDX(), MAX_INSTALLATIONS, and installation_s::selected.
Referenced by BDEF_AddItem_f(), BDEF_BaseDefenceMenuUpdate_f(), BDEF_ChangeAutoFire(), BDEF_RemoveItem_f(), BDEF_SelectItem_f(), INS_ChangeInstallationName_f(), and INS_DestroyInstallation_f().
installation_t* INS_GetFirstUFOYard | ( | qboolean | free | ) |
returns the first installation with (free) ufostoring capacity
[in] | free | On qtrue it gives the first UFO Yard with free space |
Definition at line 335 of file cp_installation.c.
References ccs, cap_maxcur_s::cur, INS_GetFoundedInstallationByIDX(), INS_GetType(), INSTALLATION_UFOYARD, cap_maxcur_s::max, ccs_s::numInstallations, and installation_s::ufoCapacity.
installation_t* INS_GetFirstUnfoundedInstallation | ( | void | ) |
Get first not yet founded installation.
Definition at line 141 of file cp_installation.c.
References B_GetInstallationLimit(), ccs, INS_GetInstallationByIDX(), and ccs_s::numInstallations.
Referenced by INS_BuildInstallation_f().
installation_t* INS_GetFoundedInstallationByIDX | ( | int | instIdx | ) |
Array bound check for the installation index.
[in] | instIdx | Instalation's index |
Definition at line 74 of file cp_installation.c.
References installation_s::founded, and INS_GetInstallationByIDX().
Referenced by AII_UpdateInstallationDelay(), AIRFIGHT_CampaignRunBaseDefence(), BDEF_AutoSelectTarget(), CL_DisplayPopupInterceptUFO(), CL_PopupInterceptBaseClick_f(), CP_InterceptChooseInstallation(), INS_DestroyInstallation_f(), INS_GetFirstUFOYard(), INS_SelectInstallation_f(), INS_UpdateInstallationData(), MAP_DrawMapMarkers(), MAP_GetGeoscapeAngle(), MAP_MapClick(), MAP_MultiSelectExecuteAction_f(), RADAR_AddDetectedUFOToEveryRadar(), RADAR_CheckRadarSensored(), RADAR_DeactivateRadarOverlay(), RADAR_NotifyUFORemoved(), RADAR_UpdateStaticRadarCoverage(), UFO_CampaignCheckEvents(), UFO_UpdateAlienInterestForAllBasesAndInstallations(), UR_DialogInitStore_f(), UR_DialogStartStore_f(), and US_LoadXML().
installation_t* INS_GetInstallationByIDX | ( | int | instIdx | ) |
Array bound check for the installation index.
[in] | instIdx | Instalation's index |
Definition at line 61 of file cp_installation.c.
References ccs, ccs_s::installations, and MAX_INSTALLATIONS.
Referenced by CP_LoadMissionsXML(), INS_GetCurrentSelectedInstallation(), INS_GetFirstUnfoundedInstallation(), INS_GetFoundedInstallationByIDX(), INS_LoadXML(), INS_SaveXML(), and INS_SetCurrentSelectedInstallation().
installationTemplate_t* INS_GetInstallationTemplateFromInstallationID | ( | const char * | id | ) |
Returns the installation Template for a given installation ID.
[in] | id | ID of the installation template to find. |
NULL
if not found. Definition at line 89 of file cp_installation.c.
References ccs, installationTemplate_s::id, ccs_s::installationTemplates, and ccs_s::numInstallationTemplates.
Referenced by INS_BuildInstallation_f(), INS_LoadXML(), and INS_SetInstallationTitle().
installationType_t INS_GetType | ( | const installation_t * | installation | ) |
Get the type of an installation.
[in] | installation | Pointer to the isntallation |
Definition at line 45 of file cp_installation.c.
References INSTALLATION_DEFENCE, INSTALLATION_RADAR, INSTALLATION_UFOYARD, installation_s::installationTemplate, installationTemplate_s::maxBatteries, and installationTemplate_s::maxUFOsStored.
Referenced by INS_GetFirstUFOYard().
void INS_InitStartup | ( | void | ) |
Resets console commands.
Definition at line 361 of file cp_installation.c.
References ccs, Cmd_AddCommand(), Com_DPrintf(), installationTemplate_s::cost, DEBUG_CLIENT, installationTemplate_s::id, ccs_s::installationTemplates, installationTemplate_s::maxBatteries, installationTemplate_s::maxUFOsStored, installationTemplate_s::name, ccs_s::numInstallationTemplates, installationTemplate_s::radarRange, and installationTemplate_s::trackingRange.
Referenced by CP_InitStartup().
void INS_ParseInstallations | ( | const char * | name, | |
const char ** | text | |||
) |
Copies an entry from the installation description file into the list of installation templates.
[in] | name | Unique test-id of a installationTemplate_t. |
[in] | text | the rest of the script file that is tokenized here |
Definition at line 430 of file cp_installation.c.
References _, installationTemplate_s::buildTime, ccs, Com_DPrintf(), Com_EParse(), Com_EParseValue(), Com_Parse(), Com_Printf(), Com_sprintf(), installationTemplate_s::cost, cp_campaignPool, Cvar_Set(), DEBUG_CLIENT, installationTemplate_s::id, ccs_s::installationTemplates, MAX_INSTALLATION_TEMPLATES, MAX_VAR, Mem_PoolStrDup, Mem_PoolStrDupTo, installationTemplate_s::name, ngettext, ccs_s::numInstallationTemplates, value_s::ofs, Q_strcat(), value_s::size, value_s::string, value_s::type, V_CLIENT_HUNK_STRING, V_TRANSLATION_STRING, and va().
Referenced by CL_ParseScriptFirst().
void INS_SelectInstallation | ( | installation_t * | installation | ) |
Select an installation when clicking on it on geoscape, or build a new installation.
[in] | installation | If this is NULL we want to build a new installation |
NULL
Definition at line 64 of file cp_installation_callbacks.c.
References B_GetInstallationLimit(), installation_s::buildStart, installationTemplate_s::buildTime, ccs, Com_DPrintf(), Cvar_Set(), ccs_s::date, date_s::day, DEBUG_CLIENT, installation_s::idx, INS_SetCurrentSelectedInstallation(), INS_SetInstallationTitle(), INSTALLATION_WORKING, installation_s::installationStatus, installation_s::installationTemplate, MA_NEWINSTALLATION, MA_NONE, MAP_IsRadarOverlayActivated(), MAP_ResetAction(), MAP_SetOverlay(), ccs_s::mapAction, ngettext, ccs_s::numInstallations, UI_PushWindow(), and va().
Referenced by INS_SelectInstallation_f(), and MAP_MultiSelectExecuteAction_f().
void INS_SetCurrentSelectedInstallation | ( | const installation_t * | installation | ) |
Sets the currently selected intallation.
installation | Pointer to the installation ot select |
Definition at line 207 of file cp_installation.c.
References B_SetCurrentSelectedBase(), Com_Error(), Cvar_Set(), ERR_DROP, installation_s::founded, i, installationTemplate_s::id, INS_GetInstallationByIDX(), installation_s::installationTemplate, MAX_INSTALLATIONS, installation_s::name, qfalse, qtrue, and installation_s::selected.
Referenced by B_SetCurrentSelectedBase(), and INS_SelectInstallation().
void INS_SetUpInstallation | ( | installation_t * | installation, | |
installationTemplate_t * | installationTemplate, | |||
vec2_t | pos | |||
) |
Setup new installation.
[in,out] | installation | Pointer to the installation to set up |
[in] | installationTemplate | Template pointer |
[in] | pos | Position on Globe to build at |
Definition at line 107 of file cp_installation.c.
References installation_s::alienInterest, installation_s::buildStart, installationTemplate_s::buildTime, ccs, Com_DPrintf(), cap_maxcur_s::cur, ccs_s::date, date_s::day, DEBUG_CLIENT, installation_s::founded, installationTemplate_s::id, installation_s::idx, INS_GetInstallationIDX, INSTALLATION_UNDER_CONSTRUCTION, installation_s::installationDamage, installation_s::installationStatus, installation_s::installationTemplate, cap_maxcur_s::max, installationTemplate_s::maxDamage, installation_s::name, installation_s::numBatteries, installation_s::pos, qfalse, qtrue, installation_s::radar, RADAR_Initialise(), installation_s::ufoCapacity, and Vector2Copy.
Referenced by INS_BuildInstallation_f().
void INS_UpdateInstallationData | ( | void | ) |
Check if some installation are build.
Definition at line 388 of file cp_installation.c.
References _, installation_s::buildStart, installationTemplate_s::buildTime, ccs, Com_sprintf(), cp_messageBuffer, ccs_s::date, date_s::day, INS_FinishInstallation(), INS_GetFoundedInstallationByIDX(), INSTALLATION_UNDER_CONSTRUCTION, installation_s::installationStatus, installation_s::installationTemplate, lengthof, MAX_INSTALLATIONS, MSG_CONSTRUCTION, MSO_CheckAddNewMessage(), installation_s::name, NT_INSTALLATION_BUILDFINISH, and qfalse.
Referenced by CL_CampaignRun().
Currently displayed/accessed base.
Coordinates to place the new installation at (long, lat)