UFO: Alien Invasion
Loading...
Searching...
No Matches
cp_building.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
28#include "../../DateTime.h"
29
39
48
71
73typedef struct building_s {
74 int idx;
75 struct building_s* tpl;
76 struct base_s* base;
77
78 const char* id;
79 char* name;
80 const char* image, *mapPart, *pedia;
81
84
89 float level;
90
93
95
98 char* onDestroy;
99 char* onEnable;
101
103
106
109
111 struct technology_s* tech;
112 const struct building_s* dependsBuilding;
113
115} building_t;
116
117void B_ParseBuildings(const char* name, const char** text, bool link);
119
120building_t* B_GetBuildingTemplate(const char* buildingName);
121building_t* B_GetBuildingTemplateSilent(const char* buildingName);
123
124buildingType_t B_GetBuildingTypeByBuildingID(const char* buildingID);
125bool B_CheckBuildingDependencesStatus(const building_t* building);
126bool B_IsBuildingBuiltUp(const building_t* building);
127float B_GetConstructionTimeRemain(const building_t* building);
128
129bool B_FireEvent(const building_t* buildingTemplate, const struct base_s* base, buildingEvent_t eventType);
DateTime class definition.
Class describing a point of time.
Definition DateTime.h:31
buildingEvent_t
Building events.
Definition cp_building.h:41
@ B_MAXEVENT
Definition cp_building.h:46
@ B_ONDISABLE
Definition cp_building.h:44
@ B_ONENABLE
Definition cp_building.h:43
@ B_ONCONSTRUCT
Definition cp_building.h:42
@ B_ONDESTROY
Definition cp_building.h:45
bool B_CheckBuildingDependencesStatus(const building_t *building)
Check that the dependences of a building is operationnal.
buildingType_t B_GetBuildingTypeByBuildingID(const char *buildingID)
Returns the building type for a given building identified by its building id from the ufo script file...
buildingType_t
All different building types.
Definition cp_building.h:51
@ B_ENTRANCE
Definition cp_building.h:64
@ B_QUARTERS
Definition cp_building.h:54
@ B_DEFENCE_LASER
Definition cp_building.h:66
@ B_COMMAND
Definition cp_building.h:62
@ B_RADAR
Definition cp_building.h:67
@ B_HANGAR
Definition cp_building.h:58
@ MAX_BUILDING_TYPE
Definition cp_building.h:69
@ B_MISC
Definition cp_building.h:52
@ B_POWER
Definition cp_building.h:61
@ B_STORAGE
Definition cp_building.h:55
@ B_LAB
Definition cp_building.h:53
@ B_HOSPITAL
Definition cp_building.h:57
@ B_WORKSHOP
Definition cp_building.h:56
@ B_SMALL_HANGAR
Definition cp_building.h:60
@ B_DEFENCE_MISSILE
Definition cp_building.h:65
@ B_ALIEN_CONTAINMENT
Definition cp_building.h:59
@ B_ANTIMATTER
Definition cp_building.h:63
bool B_BuildingScriptSanityCheck(void)
Checks the parsed buildings for errors.
const building_t * B_GetBuildingTemplateByType(buildingType_t type)
Returns the building template in the global building-types list for a buildingType.
bool B_FireEvent(const building_t *buildingTemplate, const struct base_s *base, buildingEvent_t eventType)
building_t * B_GetBuildingTemplateSilent(const char *buildingName)
Returns the building in the global building-types list that has the unique name buildingID.
bool B_IsBuildingBuiltUp(const building_t *building)
Returns if a building is fully buildt up.
float B_GetConstructionTimeRemain(const building_t *building)
Returns the time remaining time of a building construction.
void B_ParseBuildings(const char *name, const char **text, bool link)
Copies an entry from the building description file into the list of building types.
buildingStatus_t
All possible building status.
Definition cp_building.h:31
@ B_STATUS_CONSTRUCTION_FINISHED
Definition cp_building.h:34
@ B_STATUS_NOT_SET
Definition cp_building.h:32
@ B_STATUS_UNDER_CONSTRUCTION
Definition cp_building.h:33
@ B_STATUS_WORKING
Definition cp_building.h:36
@ B_STATUS_DOWN
Definition cp_building.h:37
building_t * B_GetBuildingTemplate(const char *buildingName)
Returns the building in the global building-types list that has the unique name buildingID.
QGL_EXTERN GLint GLenum type
Definition r_gl.h:94
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition r_gl.h:110
A building with all it's data.
Definition cp_building.h:73
struct building_s * tpl
Definition cp_building.h:75
vec2_t size
Definition cp_building.h:82
const char * image
Definition cp_building.h:80
char * name
Definition cp_building.h:79
const struct building_s * dependsBuilding
char * onEnable
Definition cp_building.h:99
float level
Definition cp_building.h:89
buildingType_t buildingType
struct base_s * base
Definition cp_building.h:76
char * onDisable
buildingStatus_t buildingStatus
Definition cp_building.h:94
class DateTime timeStart
Definition cp_building.h:91
const char * pedia
Definition cp_building.h:80
const char * mapPart
Definition cp_building.h:80
const char * id
Definition cp_building.h:78
char * onConstruct
Definition cp_building.h:97
char * onDestroy
Definition cp_building.h:98
struct technology_s * tech
vec_t vec2_t[2]
Definition ufotypes.h:38