UFO: Alien Invasion
Loading...
Searching...
No Matches
cp_installation.h
Go to the documentation of this file.
1
5
6/*
7Copyright (C) 2002-2025 UFO: Alien Invasion.
8
9This program is free software; you can redistribute it and/or
10modify it under the terms of the GNU General Public License
11as published by the Free Software Foundation; either version 2
12of the License, or (at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18See the GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23*/
24
25#pragma once
26
27#define MAX_INSTALLATIONS_PER_BASE 3
28#define MAX_INSTALLATION_TEMPLATES 6
29
30#define MAX_INSTALLATION_DAMAGE 100
31#define MAX_INSTALLATION_BATTERIES 5
32
42
51
52typedef struct installationTemplate_s {
53 char* id;
54 char* name;
57
58 int cost;
65 char* model;
66 char* image;
67 struct technology_s* tech;
68 bool once;
70
71
96
99
102
103/* get installation */
104#define INS_Foreach(var) LIST_Foreach(ccs.installations, installation_t, var)
105#define INS_ForeachOfType(var, installationType) \
106 INS_Foreach(var) \
107 if ((var)->installationTemplate->type != (installationType)) continue; else
108
109#define INS_GetInstallationIDX(installation) ((installation)->idx)
112int INS_GetCount(void);
113
114/* Installation template */
115void INS_ParseInstallations(const char* name, const char** text);
118void INS_LinkTechnologies(void);
119
123
124/* Lifecycle: build/update/destroy */
125installation_t* INS_Build(const installationTemplate_t* installationTemplate, const vec2_t pos, const char* name);
127void INS_DestroyInstallation(installation_t* installation);
128
129/* selection */
131void INS_SetCurrentSelectedInstallation(const installation_t* installation);
132void INS_SelectInstallation(installation_t* installation);
133
134void INS_InitStartup(void);
135void INS_Shutdown(void);
void INS_DestroyInstallation(installation_t *installation)
Destroys an installation.
installation_t * INS_Build(const installationTemplate_t *installationTemplate, const vec2_t pos, const char *name)
Build a new installation.
void INS_LinkTechnologies(void)
installationType_t
@ INSTALLATION_UFOYARD
@ INSTALLATION_ORBIT
@ INSTALLATION_DEFENCE
@ INSTALLATION_RADAR
@ INSTALLATION_TYPE_MAX
const installationTemplate_t * INS_GetInstallationTemplateByType(installationType_t type)
Returns the installation Template for a given installation type.
const installationTemplate_t * INS_GetInstallationTemplateByID(const char *id)
Returns the installation Template for a given installation ID.
void INS_ParseInstallations(const char *name, const char **text)
Copies an entry from the installation description file into the list of installation templates.
installation_t * INS_GetCurrentSelectedInstallation(void)
Returns the current selected installation.
void INS_SetCurrentSelectedInstallation(const installation_t *installation)
Sets the currently selected installation.
installation_t * INS_GetFirstUFOYard(bool free)
returns the first installation with (free) ufostoring capacity
void INS_UpdateInstallationData(void)
Check if some installation are build.
int INS_GetCount(void)
Get number of installations.
installation_t * INS_GetByIDX(int idx)
Get installation by it's index.
void INS_InitStartup(void)
Resets console commands.
vec2_t newInstallationPos
void INS_SelectInstallation(installation_t *installation)
Select an installation when clicking on it on geoscape.
installation_t * installationCurrent
#define MAX_INSTALLATION_BATTERIES
bool INS_HasAny(installationStatus_t status=INSTALLATION_WORKING)
Checks whether any installation is available.
void INS_Shutdown(void)
Closing operations for installations subsystem.
installationType_t INS_GetType(const char *type)
installationStatus_t
Possible installation states.
@ INSTALLATION_UNDER_CONSTRUCTION
@ INSTALLATION_NOT_USED
@ INSTALLATION_WORKING
bool INS_HasType(installationType_t type, installationStatus_t status=INSTALLATION_WORKING)
Checks whether the given installation type is available.
QGL_EXTERN GLint GLenum type
Definition r_gl.h:94
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition r_gl.h:110
#define MAX_VAR
Definition shared.h:36
Store capacities in base.
Definition cp_capacity.h:41
A installation with all it's data.
char name[MAX_VAR]
struct radar_s radar
const installationTemplate_t * installationTemplate
baseWeapon_t batteries[MAX_INSTALLATION_BATTERIES]
capacities_t ufoCapacity
installationStatus_t installationStatus
struct technology_s * tech
installationType_t type
vec_t vec3_t[3]
Definition ufotypes.h:39
vec_t vec2_t[2]
Definition ufotypes.h:38