cp_installation.h File Reference

Header for installation management related stuff. More...

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

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_tINS_GetInstallationByIDX (int instIdx)
 Array bound check for the installation index.
installation_tINS_GetFoundedInstallationByIDX (int installationIdx)
 Array bound check for the installation index.
installation_tINS_GetFirstUnfoundedInstallation (void)
 Get first not yet founded installation.
installationTemplate_tINS_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_tINS_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_tINS_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_tinstallationCurrent
vec2_t newInstallationPos

Detailed Description

Header for installation management related stuff.

Definition in file cp_installation.h.


Define Documentation

 
#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
#define MAX_INSTALLTAIONS_PER_BASE   3

Definition at line 30 of file cp_installation.h.

Referenced by B_GetInstallationLimit().


Typedef Documentation

A installation with all it's data.


Enumeration Type Documentation

Possible installation states.

Note:
: Don't change the order or you have to change the installationmenu scriptfiles, too
Enumerator:
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.

Enumerator:
INSTALLATION_RADAR 
INSTALLATION_DEFENCE 
INSTALLATION_UFOYARD 
INSTALLATION_TYPE_MAX 

Definition at line 65 of file cp_installation.h.


Function Documentation

void INS_DestroyInstallation ( installation_t installation  ) 
installation_t* INS_GetCurrentSelectedInstallation ( void   ) 
installation_t* INS_GetFirstUFOYard ( qboolean  free  ) 

returns the first installation with (free) ufostoring capacity

Parameters:
[in] free On qtrue it gives the first UFO Yard with free space
Returns:
installation_t Pointer to the UFO Yard

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.

Returns:
installation Pointer to the first unfounded installation
Note:
it returns NULL if installation limit has reached

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  ) 
installation_t* INS_GetInstallationByIDX ( int  instIdx  ) 

Array bound check for the installation index.

Parameters:
[in] instIdx Instalation's index
Returns:
Pointer to the installation corresponding to instIdx.

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.

Parameters:
[in] id ID of the installation template to find.
Returns:
corresponding installation Template, 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.

Parameters:
[in] installation Pointer to the isntallation
Returns:
type of the installation
See also:
installationType_t

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   ) 
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] 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.

Parameters:
[in] installation If this is NULL we want to build a new installation
Note:
This is (and should be) the only place where installationCurrent is set to a value that is not 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  ) 
void INS_SetUpInstallation ( installation_t installation,
installationTemplate_t installationTemplate,
vec2_t  pos 
)
void INS_UpdateInstallationData ( void   ) 

Variable Documentation

Currently displayed/accessed base.

Coordinates to place the new installation at (long, lat)


Generated by  doxygen 1.6.2