UFO: Alien Invasion
cp_uforecovery.h
Go to the documentation of this file.
1 
6 /*
7 Copyright (C) 2002-2022 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 #include "../../DateTime.h"
28 
29 /* time the recovery takes in days */
30 #define RECOVERY_DELAY 2.0f
31 
36 typedef enum {
43 
45 typedef struct storedUFO_s {
46  int idx;
47  char id[MAX_VAR];
48  struct components_s* comp;
50 
53 
54  float condition;
55 
56  /* installation UFO is stored */
58 
59  /* link to disassembly item */
61 } storedUFO_t;
62 
63 void UR_ProcessActive(void);
64 
65 #define US_Foreach(var) LIST_Foreach(ccs.storedUFOs, storedUFO_t, var)
66 
67 storedUFO_t* US_StoreUFO(const aircraft_t* ufoTemplate, installation_t* installation, DateTime& date, float condition);
68 storedUFO_t* US_GetStoredUFOByIDX(const int idx);
69 storedUFO_t* US_GetClosestStoredUFO(const aircraft_t* ufoTemplate, const base_t* base);
71 int US_UFOsInStorage(const aircraft_t* ufoTemplate, const installation_t* installation);
72 int US_StoredUFOCount(void);
74 bool US_TransferUFO(storedUFO_t* ufo, installation_t* ufoyard);
75 
79 #define US_UFOStored() (US_GetNext(nullptr) != nullptr)
80 
81 void UR_InitStartup(void);
82 void UR_Shutdown(void);
void UR_Shutdown(void)
Closing actions for ufostoring-subsystem.
int US_UFOsInStorage(const aircraft_t *ufoTemplate, const installation_t *installation)
Returns the number of UFOs stored (on an installation or anywhere)
void UR_InitStartup(void)
Init actions for ufostoring-subsystem.
A base with all it's data.
Definition: cp_base.h:84
Holds all information for the production of one item-type.
Definition: cp_produce.h:59
void UR_ProcessActive(void)
Function to process active recoveries.
Class describing a point of time.
Definition: DateTime.h:30
Structure for stored UFOs.
A installation with all it's data.
int US_StoredUFOCount(void)
Returns the number of storedUFOs.
bool US_TransferUFO(storedUFO_t *ufo, installation_t *ufoyard)
Start transferring of a stored UFO.
storedUFO_t * US_GetStoredUFOByIDX(const int idx)
Returns a stored ufo.
DateTime arrive
#define MAX_VAR
Definition: shared.h:36
void US_RemoveStoredUFO(storedUFO_t *ufo)
Removes an UFO from the storage.
production_t * disassembly
const aircraft_t * ufoTemplate
An aircraft with all it's data.
Definition: cp_aircraft.h:115
storedUFOStatus_t
different statuses for a stored UFO
installation_t * installation
storedUFO_t * US_StoreUFO(const aircraft_t *ufoTemplate, installation_t *installation, DateTime &date, float condition)
Adds an UFO to the storage.
void US_RemoveUFOsExceedingCapacity(installation_t *installation)
Removes ufos which are over the storing capacity.
storedUFOStatus_t status
storedUFO_t * US_GetClosestStoredUFO(const aircraft_t *ufoTemplate, const base_t *base)
get the closest stored ufo (of a type) from a base
struct components_s * comp