Handles everything that is located in or accessed through an installation. More...
#include "../cl_shared.h"
#include "../../shared/parse.h"
#include "cp_campaign.h"
#include "cp_mapfightequip.h"
#include "cp_aircraft.h"
#include "cp_missions.h"
#include "cp_map.h"
#include "cp_ufo.h"
#include "cp_installation.h"
#include "cp_installation_callbacks.h"
#include "save/save_installation.h"
Go to the source code of this file.
Functions | |
installationType_t | INS_GetType (const installation_t *installation) |
Get the type of an installation. | |
installation_t * | INS_GetInstallationByIDX (int instIdx) |
Array bound check for the installation index. | |
installation_t * | INS_GetFoundedInstallationByIDX (int instIdx) |
Array bound check for the installation index. | |
installationTemplate_t * | INS_GetInstallationTemplateFromInstallationID (const char *id) |
Returns the installation Template for a given installation ID. | |
void | INS_SetUpInstallation (installation_t *installation, installationTemplate_t *installationTemplate, vec2_t pos) |
Setup new installation. | |
installation_t * | INS_GetFirstUnfoundedInstallation (void) |
Get first not yet founded installation. | |
void | INS_DestroyInstallation (installation_t *installation) |
Destroys an installation. | |
installation_t * | INS_GetCurrentSelectedInstallation (void) |
Returns the current selected installation. | |
void | INS_SetCurrentSelectedInstallation (const installation_t *installation) |
Sets the currently selected intallation. | |
static void | INS_FinishInstallation (installation_t *installation) |
Finishes an installation. | |
installation_t * | INS_GetFirstUFOYard (qboolean free) |
returns the first installation with (free) ufostoring capacity | |
void | INS_InitStartup (void) |
Resets console commands. | |
void | INS_UpdateInstallationData (void) |
Check if some installation are build. | |
void | INS_ParseInstallations (const char *name, const char **text) |
Copies an entry from the installation description file into the list of installation templates. | |
qboolean | INS_SaveXML (mxml_node_t *p) |
Save callback for savegames in xml. | |
qboolean | INS_LoadXML (mxml_node_t *p) |
Load callback for savegames. | |
Variables | |
static const value_t | installation_vals [] |
Handles everything that is located in or accessed through an installation.
Definition in file cp_installation.c.
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().
static void INS_FinishInstallation | ( | installation_t * | installation | ) | [static] |
Finishes an installation.
[in,out] | installation | Pointer to the installation to be finished |
Definition at line 237 of file cp_installation.c.
References BDEF_InitialiseInstallationSlots(), Com_DPrintf(), Com_Error(), DEBUG_CLIENT, ERR_DROP, installation_s::founded, INSTALLATION_UNDER_CONSTRUCTION, INSTALLATION_WORKING, installation_s::installationStatus, installation_s::installationTemplate, cap_maxcur_s::max, installationTemplate_s::maxBatteries, installationTemplate_s::maxUFOsStored, installation_s::numBatteries, RADAR_UpdateInstallationRadarCoverage(), installationTemplate_s::radarRange, installationTemplate_s::trackingRange, and installation_s::ufoCapacity.
Referenced by INS_UpdateInstallationData().
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().
qboolean INS_LoadXML | ( | mxml_node_t * | p | ) |
Load callback for savegames.
[in] | p | XML Node structure, where we get the information from |
Definition at line 576 of file cp_installation.c.
References installation_s::alienInterest, B_LoadBaseSlotsXML(), installation_s::batteries, BDEF_InitialiseInstallationSlots(), installation_s::buildStart, ccs, Com_GetConstIntFromNamespace(), Com_Printf(), Com_RegisterConstList(), Com_UnregisterConstList(), cap_maxcur_s::cur, Cvar_Set(), installation_s::founded, installation_s::idx, INS_GetInstallationByIDX(), INS_GetInstallationIDX, INS_GetInstallationTemplateFromInstallationID(), INSTALLATION_WORKING, installation_s::installationDamage, installation_s::installationStatus, installation_s::installationTemplate, cap_maxcur_s::max, MAX_INSTALLATIONS, installationTemplate_s::maxBatteries, installationTemplate_s::maxUFOsStored, mxml_GetFloat(), mxml_GetInt(), mxml_GetNextNode(), mxml_GetNode(), mxml_GetPos3(), mxml_GetString(), installation_s::name, installation_s::numBatteries, ccs_s::numInstallations, installation_s::pos, Q_strncpyz(), qfalse, qtrue, installation_s::radar, RADAR_Initialise(), RADAR_InitialiseUFOs(), RADAR_UpdateInstallationRadarCoverage(), installationTemplate_s::radarRange, SAVE_INSTALLATION_ALIENINTEREST, SAVE_INSTALLATION_BATTERIES, SAVE_INSTALLATION_BUILDSTART, SAVE_INSTALLATION_DAMAGE, SAVE_INSTALLATION_INSTALLATION, SAVE_INSTALLATION_INSTALLATIONS, SAVE_INSTALLATION_NAME, SAVE_INSTALLATION_NUM, SAVE_INSTALLATION_POS, SAVE_INSTALLATION_STATUS, SAVE_INSTALLATION_TEMPLATEID, SAVE_INSTALLATIONSTATUS_NAMESPACE, saveInstallationConstants, installationTemplate_s::trackingRange, installation_s::ufoCapacity, and va().
Referenced by SAV_Init().
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().
qboolean INS_SaveXML | ( | mxml_node_t * | p | ) |
Save callback for savegames in xml.
[out] | p | XML Node structure, where we write the information to |
Definition at line 538 of file cp_installation.c.
References installation_s::alienInterest, B_SaveBaseSlotsXML(), installation_s::batteries, installation_s::buildStart, ccs, Com_GetConstVariable(), Com_RegisterConstList(), Com_UnregisterConstList(), installation_s::founded, installationTemplate_s::id, INS_GetInstallationByIDX(), installation_s::installationDamage, installation_s::installationStatus, installation_s::installationTemplate, mxml_AddFloat(), mxml_AddInt(), mxml_AddIntValue(), mxml_AddNode(), mxml_AddPos3(), mxml_AddString(), installation_s::name, installation_s::numBatteries, ccs_s::numInstallations, installation_s::pos, qtrue, SAVE_INSTALLATION_ALIENINTEREST, SAVE_INSTALLATION_BATTERIES, SAVE_INSTALLATION_BUILDSTART, SAVE_INSTALLATION_DAMAGE, SAVE_INSTALLATION_INSTALLATION, SAVE_INSTALLATION_INSTALLATIONS, SAVE_INSTALLATION_NAME, SAVE_INSTALLATION_NUM, SAVE_INSTALLATION_POS, SAVE_INSTALLATION_STATUS, SAVE_INSTALLATION_TEMPLATEID, SAVE_INSTALLATIONSTATUS_NAMESPACE, and saveInstallationConstants.
Referenced by SAV_Init().
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().
const value_t installation_vals[] [static] |
{ {"name", V_TRANSLATION_STRING, offsetof(installationTemplate_t, name), 0}, {"description", V_TRANSLATION_STRING, offsetof(installationTemplate_t, description), 0}, {"radar_range", V_INT, offsetof(installationTemplate_t, radarRange), MEMBER_SIZEOF(installationTemplate_t, radarRange)}, {"radar_tracking_range", V_INT, offsetof(installationTemplate_t, trackingRange), MEMBER_SIZEOF(installationTemplate_t, trackingRange)}, {"max_batteries", V_INT, offsetof(installationTemplate_t, maxBatteries), MEMBER_SIZEOF(installationTemplate_t, maxBatteries)}, {"max_ufo_stored", V_INT, offsetof(installationTemplate_t, maxUFOsStored), MEMBER_SIZEOF(installationTemplate_t, maxUFOsStored)}, {"max_damage", V_INT, offsetof(installationTemplate_t, maxDamage), MEMBER_SIZEOF(installationTemplate_t, maxDamage)}, {"model", V_CLIENT_HUNK_STRING, offsetof(installationTemplate_t, model), 0}, {"image", V_CLIENT_HUNK_STRING, offsetof(installationTemplate_t, image), 0}, {NULL, 0, 0, 0} }
Definition at line 409 of file cp_installation.c.