UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cp_installation.h
Go to the documentation of this file.
1 
6 /*
7 Copyright (C) 2002-2020 UFO: Alien Invasion.
8 
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 
18 See the GNU General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, 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 
37 typedef enum {
42 
43 typedef enum {
48 
51 
52 typedef struct installationTemplate_s {
53  char* id;
54  char* name;
55  char* description;
58  int cost;
59  int radarRange;
63  int maxDamage;
64  int buildTime;
65  char* model;
66  char* image;
67  struct technology_s* tech;
68  bool once;
70 
71 
73 typedef struct installation_s {
74  int idx;
75  char name[MAX_VAR];
83  float alienInterest;
85  struct radar_s radar;
93  int buildStart;
94  bool selected;
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)
110 installation_t* INS_GetByIDX(int idx);
112 int INS_GetCount(void);
113 
114 /* Installation template */
115 void INS_ParseInstallations(const char* name, const char** text);
118 void INS_LinkTechnologies(void);
119 
122 installationType_t INS_GetType(const char* type);
123 
124 /* Lifecycle: build/update/destroy */
125 installation_t* INS_Build(const installationTemplate_t* installationTemplate, const vec2_t pos, const char* name);
126 void INS_UpdateInstallationData(void);
127 void INS_DestroyInstallation(installation_t* installation);
128 
129 /* selection */
131 void INS_SetCurrentSelectedInstallation(const installation_t* installation);
132 void INS_SelectInstallation(installation_t* installation);
133 
134 void INS_InitStartup(void);
135 void INS_Shutdown(void);
void INS_LinkTechnologies(void)
installationStatus_t installationStatus
A installation with all it's data.
QGL_EXTERN GLint GLenum type
Definition: r_gl.h:94
struct installationTemplate_s installationTemplate_t
installationStatus_t
Possible installation states.
installationType_t INS_GetType(const char *type)
installation_t * INS_GetByIDX(int idx)
Get installation by it's index.
void INS_SelectInstallation(installation_t *installation)
Select an installation when clicking on it on geoscape.
void INS_UpdateInstallationData(void)
Check if some installation are build.
const installationTemplate_t * INS_GetInstallationTemplateByType(installationType_t type)
Returns the installation Template for a given installation type.
void INS_SetCurrentSelectedInstallation(const installation_t *installation)
Sets the currently selected installation.
installation_t * INS_GetCurrentSelectedInstallation(void)
Returns the current selected installation.
installationType_t
#define MAX_VAR
Definition: shared.h:36
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...
struct radar_s radar
int INS_GetCount(void)
Get number of installations.
This is the technology parsed from research.ufo.
Definition: cp_research.h:137
struct technology_s * tech
capacities_t ufoCapacity
const installationTemplate_t * installationTemplate
char name[MAX_VAR]
const installationTemplate_t * INS_GetInstallationTemplateByID(const char *id)
Returns the installation Template for a given installation ID.
installationType_t type
bool INS_HasType(installationType_t type, installationStatus_t status=INSTALLATION_WORKING)
Checks whether the given installation type is available.
bool INS_HasAny(installationStatus_t status=INSTALLATION_WORKING)
Checks whether any installation is available.
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition: r_gl.h:110
vec_t vec3_t[3]
Definition: ufotypes.h:39
vec2_t newInstallationPos
vec_t vec2_t[2]
Definition: ufotypes.h:38
installation_t * INS_Build(const installationTemplate_t *installationTemplate, const vec2_t pos, const char *name)
Build a new installation.
Store capacities in base.
Definition: cp_capacity.h:41
struct installation_s installation_t
A installation with all it's data.
installation_t * INS_GetFirstUFOYard(bool free)
returns the first installation with (free) ufostoring capacity
void INS_Shutdown(void)
Closing operations for installations subsystem.
installation_t * installationCurrent
#define MAX_INSTALLATION_BATTERIES
baseWeapon_t batteries[MAX_INSTALLATION_BATTERIES]
void INS_DestroyInstallation(installation_t *installation)
Destroys an installation.