UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cp_installation.cpp File Reference

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_installation.h"
#include "save/save_installation.h"

Go to the source code of this file.

Functions

int INS_GetCount (void)
 Get number of installations. More...
 
installationType_t INS_GetType (const char *type)
 
bool INS_HasAny (installationStatus_t status)
 Checks whether any installation is available. More...
 
bool INS_HasType (installationType_t type, installationStatus_t status)
 Checks whether the given installation type is available. More...
 
installation_tINS_GetByIDX (int idx)
 Get installation by it's index. More...
 
const installationTemplate_tINS_GetInstallationTemplateByID (const char *id)
 Returns the installation Template for a given installation ID. More...
 
const installationTemplate_tINS_GetInstallationTemplateByType (installationType_t type)
 Returns the installation Template for a given installation type. More...
 
installation_tINS_Build (const installationTemplate_t *installationTemplate, const vec2_t pos, const char *name)
 Build a new installation. More...
 
void INS_DestroyInstallation (installation_t *installation)
 Destroys an installation. More...
 
installation_tINS_GetCurrentSelectedInstallation (void)
 Returns the current selected installation. More...
 
void INS_SetCurrentSelectedInstallation (const installation_t *installation)
 Sets the currently selected installation. More...
 
static void INS_FinishInstallation (installation_t *installation)
 Finishes an installation. More...
 
installation_tINS_GetFirstUFOYard (bool free)
 returns the first installation with (free) ufostoring capacity More...
 
void INS_InitStartup (void)
 Resets console commands. More...
 
void INS_Shutdown (void)
 Closing operations for installations subsystem. More...
 
void INS_UpdateInstallationData (void)
 Check if some installation are build. More...
 
void INS_ParseInstallations (const char *name, const char **text)
 Copies an entry from the installation description file into the list of installation templates. More...
 
void INS_LinkTechnologies (void)
 
bool INS_SaveXML (xmlNode_t *p)
 Save callback for savegames in xml. More...
 
bool INS_LoadXML (xmlNode_t *p)
 Load callback for savegames. More...
 

Variables

static const cmdList_t debugInstallationCmds []
 
static const value_t installation_vals []
 

Detailed Description

Handles everything that is located in or accessed through an installation.

Note
Installation functions prefix: INS_*

Definition in file cp_installation.cpp.

Function Documentation

installation_t* INS_GetByIDX ( int  idx)

Get installation by it's index.

Parameters
[in]idxInstalation's index
Returns
Pointer to the installation corresponding to idx or nullptr if not found.

Definition at line 93 of file cp_installation.cpp.

References INS_Foreach.

Referenced by INS_DestroyInstallation_f(), INS_FillUFOYardData_f(), INS_SelectInstallation_f(), MIS_LoadXML(), UR_DialogStartStore_f(), US_FillUFOTransferUFOs_f(), US_LoadXML(), and US_TransferUFO_f().

int INS_GetCount ( void  )
installation_t* INS_GetCurrentSelectedInstallation ( void  )
installation_t* INS_GetFirstUFOYard ( bool  free)

returns the first installation with (free) ufostoring capacity

Parameters
[in]freeOn true it gives the first UFO Yard with free space
Returns
installation_t Pointer to the UFO Yard

Definition at line 313 of file cp_installation.cpp.

References INS_ForeachOfType, and INSTALLATION_UFOYARD.

Referenced by INS_FillUFOYardData_f().

const installationTemplate_t* INS_GetInstallationTemplateByID ( const char *  id)

Returns the installation Template for a given installation ID.

Parameters
[in]idID of the installation template to find.
Returns
corresponding installation Template, nullptr if not found.

Definition at line 108 of file cp_installation.cpp.

References ccs, installationTemplate_s::id, mission_s::idx, ccs_s::installationTemplates, ccs_s::numInstallationTemplates, and Q_streq.

Referenced by INS_BuildInstallation_f(), and INS_SelectType_f().

const installationTemplate_t* INS_GetInstallationTemplateByType ( installationType_t  type)

Returns the installation Template for a given installation type.

Parameters
[in]typeType of the installation template to find.
Returns
corresponding installation Template, nullptr if not found.

Definition at line 126 of file cp_installation.cpp.

References ccs, mission_s::idx, ccs_s::installationTemplates, ccs_s::numInstallationTemplates, and installationTemplate_s::type.

Referenced by CP_SpawnUFOCarrier_f(), CreateInstallation(), INS_LoadXML(), and INS_SetInstallationTitle().

bool INS_HasAny ( installationStatus_t  status)

Checks whether any installation is available.

Parameters
[in]statusStatus of installation to search for

Definition at line 63 of file cp_installation.cpp.

References INS_Foreach, and INSTALLATION_NOT_USED.

Referenced by CP_InterceptMissionSet().

bool INS_HasType ( installationType_t  type,
installationStatus_t  status 
)

Checks whether the given installation type is available.

Parameters
[in]typeInstallation type to search for
[in]statusStatus of installation to search for

Definition at line 78 of file cp_installation.cpp.

References INS_ForeachOfType, and INSTALLATION_NOT_USED.

Referenced by CP_AttackUFOCarrier_f(), CP_CheckTriggerEvent(), CP_UFOCarrierMissionUpdate(), INS_FillTypes_f(), and INS_SelectType_f().

void INS_InitStartup ( void  )

Resets console commands.

Definition at line 335 of file cp_installation.cpp.

References cgi.

Referenced by CP_InitStartup().

bool INS_LoadXML ( xmlNode_t p)

Load callback for savegames.

Parameters
[in]pXML Node structure, where we get the information from
See also
INS_SaveXML
SAV_GameLoadXML
INS_LoadItemSlots

Definition at line 498 of file cp_installation.cpp.

References installation_s::alienInterest, B_LoadBaseSlotsXML(), installation_s::batteries, BDEF_InitialiseInstallationSlots(), installation_s::buildStart, ccs, cgi, capacities_s::cur, cgame_import_s::Cvar_Set(), installation_s::idx, INS_GetCount(), INS_GetInstallationTemplateByType(), INS_GetType(), INSTALLATION_WORKING, installation_s::installationDamage, ccs_s::installations, installation_s::installationStatus, installation_s::installationTemplate, LIST_Add(), capacities_s::max, installationTemplate_s::maxBatteries, installationTemplate_s::maxUFOsStored, installation_s::name, installation_s::numBatteries, OBJZERO, installation_s::pos, Q_strncpyz(), 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_IDX, 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, type, installation_s::ufoCapacity, cgame_import_s::XML_GetNextNode(), cgame_import_s::XML_GetNode(), cgame_import_s::XML_GetPos3(), cgame_import_s::XML_GetString(), and xmlNode_t.

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.

Note
Parses one "installation" entry in the installation.ufo file and writes it into the next free entry in installationTemplates.
Parameters
[in]nameUnique test-id of a installationTemplate_t.
[in]textthe rest of the script file that is tokenized here

Definition at line 391 of file cp_installation.cpp.

References ccs, cgi, cgame_import_s::Com_EParse(), Com_Parse(), cp_campaignPool, DEBUG_CLIENT, i, installationTemplate_s::id, INS_GetType(), INSTALLATION_RADAR, ccs_s::installationTemplates, MAX_INSTALLATION_TEMPLATES, installationTemplate_s::name, ccs_s::numInstallationTemplates, OBJZERO, cgame_import_s::PoolStrDup(), Q_streq, and installationTemplate_s::type.

Referenced by CP_ParseScriptFirst().

void INS_SetCurrentSelectedInstallation ( const installation_t installation)

Sets the currently selected installation.

Parameters
installationPointer to the installation to select
See also
INS_SelectInstallation

Definition at line 214 of file cp_installation.cpp.

References cgi, cgame_import_s::Cvar_Set(), installationTemplate_s::id, INS_Foreach, installation_s::installationTemplate, and installation_s::name.

Referenced by B_SetCurrentSelectedBase(), and INS_SelectInstallation().

void INS_Shutdown ( void  )

Closing operations for installations subsystem.

Definition at line 343 of file cp_installation.cpp.

References ccs, cgi, and ccs_s::installations.

Referenced by CP_Shutdown().

void INS_UpdateInstallationData ( void  )

Variable Documentation

const cmdList_t debugInstallationCmds[]
static
Initial value:
= {
{nullptr, nullptr, nullptr}
}

Definition at line 325 of file cp_installation.cpp.

const value_t installation_vals[]
static
Initial value:
= {
{"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)},
{"buildtime", V_INT, offsetof(installationTemplate_t, buildTime), MEMBER_SIZEOF(installationTemplate_t, buildTime)},
{"model", V_HUNK_STRING, offsetof(installationTemplate_t, model), 0},
{"image", V_HUNK_STRING, offsetof(installationTemplate_t, image), 0},
{nullptr, V_NULL, 0, 0}
}
Definition: scripts.h:49
Definition: scripts.h:50
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition: r_gl.h:110
#define MEMBER_SIZEOF(TYPE, MEMBER)
Definition: scripts.h:34
Definition: scripts.h:52

Definition at line 367 of file cp_installation.cpp.