UFO recovery and storing. More...
Go to the source code of this file.
Data Structures | |
struct | storedUFO_s |
Structure for stored UFOs. More... | |
Defines | |
#define | RECOVERY_DELAY 2.0f |
#define | US_UFOStored() (US_GetNext(NULL) != NULL) |
returns if any UFOs are stored in UFO Yards | |
Typedefs | |
typedef struct storedUFO_s | storedUFO_t |
Structure for stored UFOs. | |
Enumerations | |
enum | storedUFOStatus_t { SUFO_RECOVERED, SUFO_STORED, SUFO_TRANSFERED, MAX_SUFO_STATUS } |
different statuses for a stored UFO More... | |
Functions | |
void | UR_ProcessActive (void) |
Function to process active recoveries. | |
storedUFO_t * | US_StoreUFO (const aircraft_t *ufoTemplate, installation_t *installation, date_t date, float condition) |
Adds an UFO to the storage. | |
storedUFO_t * | US_GetNext (storedUFO_t *lastUFO) |
Iterates through the stored UFOs. | |
storedUFO_t * | US_GetStoredUFOByIDX (const int idx) |
Returns a stored ufo. | |
storedUFO_t * | US_GetClosestStoredUFO (const aircraft_t *ufoTemplate, const base_t *base) |
get the closest stored ufo (of a type) from a base | |
void | US_RemoveStoredUFO (storedUFO_t *ufo) |
Removes an UFO from the storage. | |
int | US_UFOsInStorage (const aircraft_t *ufoTemplate, const installation_t *installation) |
Returns the number of UFOs stored (on an installation or anywhere). | |
int | US_StoredUFOCount (void) |
Returns the number of storedUFOs. | |
void | US_RemoveUFOsExceedingCapacity (installation_t *installation) |
Removes ufos which are over the storing capacity. |
UFO recovery and storing.
Definition in file cp_uforecovery.h.
#define RECOVERY_DELAY 2.0f |
Definition at line 30 of file cp_uforecovery.h.
Referenced by UR_DialogStartStore_f().
#define US_UFOStored | ( | ) | (US_GetNext(NULL) != NULL) |
returns if any UFOs are stored in UFO Yards
Definition at line 78 of file cp_uforecovery.h.
typedef struct storedUFO_s storedUFO_t |
Structure for stored UFOs.
enum storedUFOStatus_t |
different statuses for a stored UFO
Definition at line 36 of file cp_uforecovery.h.
void UR_ProcessActive | ( | void | ) |
Function to process active recoveries.
Definition at line 45 of file cp_uforecovery.c.
References _, storedUFO_s::arrive, ccs, Com_sprintf(), cp_messageBuffer, ccs_s::date, date_s::day, storedUFO_s::installation, MSG_TRANSFERFINISHED, MSO_CheckAddNewMessage(), installation_s::name, NT_TRANSFER_UFORECOVERY_FINISHED, qfalse, RS_MarkCollected(), date_s::sec, storedUFO_s::status, technology_s::statusCollected, SUFO_STORED, aircraft_s::tech, UFO_TypeToName(), storedUFO_s::ufoTemplate, aircraft_s::ufotype, and US_GetNext().
Referenced by CL_CampaignRun().
storedUFO_t* US_GetClosestStoredUFO | ( | const aircraft_t * | ufoTemplate, | |
const base_t * | base | |||
) |
get the closest stored ufo (of a type) from a base
[in] | ufoTemplate | Pointer to the aircraft (ufo) template to look for (NULL for any type) |
[in] | base | Pointer to the base. If it's NULL the function simply return the first stored UFO of type |
Definition at line 244 of file cp_uforecovery.c.
References GetDistanceOnGlobe(), storedUFO_s::installation, base_s::pos, installation_s::pos, storedUFO_s::status, SUFO_STORED, storedUFO_s::ufoTemplate, and US_GetNext().
storedUFO_t* US_GetNext | ( | storedUFO_t * | lastUFO | ) |
Iterates through the stored UFOs.
[in] | lastBase | Pointer of the UFO to iterate from. call with NULL to get the first one. |
Definition at line 74 of file cp_uforecovery.c.
References ccs, LIST_GetNext(), and ccs_s::storedUFOs.
Referenced by INS_DestroyInstallation(), PR_UpdateProductionList(), UR_ProcessActive(), US_GetClosestStoredUFO(), US_GetStoredUFOByIDX(), US_RemoveUFOsExceedingCapacity(), US_SaveXML(), and US_UFOsInStorage().
storedUFO_t* US_GetStoredUFOByIDX | ( | const int | idx | ) |
Returns a stored ufo.
[in] | idx | index of the stored UFO |
Definition at line 84 of file cp_uforecovery.c.
References storedUFO_s::idx, and US_GetNext().
Referenced by PR_LoadXML().
void US_RemoveStoredUFO | ( | storedUFO_t * | ufo | ) |
Removes an UFO from the storage.
[in,out] | ufo | stored UFO to remove |
Definition at line 153 of file cp_uforecovery.c.
References ccs, cap_maxcur_s::cur, storedUFO_s::disassembly, base_s::idx, production_s::idx, storedUFO_s::installation, LIST_Remove(), PR_ProductionBase(), PR_QueueDelete(), PR_QueueNext(), ccs_s::productions, RS_RUNNING, RS_StopResearch(), ccs_s::storedUFOs, aircraft_s::tech, installation_s::ufoCapacity, storedUFO_s::ufoTemplate, and US_UFOsInStorage().
Referenced by PR_DisassemblingFrame(), and US_RemoveUFOsExceedingCapacity().
void US_RemoveUFOsExceedingCapacity | ( | installation_t * | installation | ) |
Removes ufos which are over the storing capacity.
[in] | installation | pointer to the ufoyard the ufos are stored in |
Definition at line 214 of file cp_uforecovery.c.
References Com_Error(), cap_maxcur_s::cur, ERR_DROP, storedUFO_s::installation, cap_maxcur_s::max, installation_s::ufoCapacity, US_GetNext(), and US_RemoveStoredUFO().
Referenced by INS_DestroyInstallation().
int US_StoredUFOCount | ( | void | ) |
Returns the number of storedUFOs.
Definition at line 272 of file cp_uforecovery.c.
References ccs, LIST_Count(), and ccs_s::storedUFOs.
Referenced by STATS_LoadXML().
storedUFO_t* US_StoreUFO | ( | const aircraft_t * | ufoTemplate, | |
installation_t * | installation, | |||
date_t | date, | |||
float | condition | |||
) |
Adds an UFO to the storage.
[in] | ufoTemplate | Pointer to the aircraft(ufo)Template to add |
[in,out] | installation | Pointer to the installation it should be added to |
[in] | date | Date when UFO is arrives to the storage (recovery || transfer) |
[in] | condition | Condition of the UFO to store (How much the UFO is damaged) |
[in] | idx | UFO's index. Call with negative value for |
Definition at line 104 of file cp_uforecovery.c.
References storedUFO_s::arrive, ccs_s::campaignStats, ccs, CL_GetComponentsByID(), Com_DPrintf(), storedUFO_s::comp, storedUFO_s::condition, cap_maxcur_s::cur, data, ccs_s::date, date_s::day, DEBUG_CLIENT, storedUFO_s::disassembly, aircraft_s::id, storedUFO_s::id, storedUFO_s::idx, storedUFO_s::installation, LIST_Add(), cap_maxcur_s::max, Q_strncpyz(), RS_MarkCollected(), date_s::sec, storedUFO_s::status, ccs_s::storedUFOs, SUFO_RECOVERED, SUFO_STORED, aircraft_s::tech, installation_s::ufoCapacity, stats_s::ufosStored, and storedUFO_s::ufoTemplate.
Referenced by UR_DialogStartStore_f().
int US_UFOsInStorage | ( | const aircraft_t * | ufoTemplate, | |
const installation_t * | installation | |||
) |
Returns the number of UFOs stored (on an installation or anywhere).
[in] | ufoTemplate | aircraftTemplate of the ufo |
[in] | installation | Pointer to the installation to count at |
Definition at line 191 of file cp_uforecovery.c.
References count, storedUFO_s::installation, storedUFO_s::status, SUFO_STORED, storedUFO_s::ufoTemplate, and US_GetNext().
Referenced by PR_UpdateProductionList(), RS_RequirementsMet(), and US_RemoveStoredUFO().