cp_uforecovery.h File Reference

UFO recovery and storing. More...

This graph shows which files directly or indirectly include this file:

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_tUS_StoreUFO (const aircraft_t *ufoTemplate, installation_t *installation, date_t date, float condition)
 Adds an UFO to the storage.
storedUFO_tUS_GetNext (storedUFO_t *lastUFO)
 Iterates through the stored UFOs.
storedUFO_tUS_GetStoredUFOByIDX (const int idx)
 Returns a stored ufo.
storedUFO_tUS_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.

Detailed Description

UFO recovery and storing.

Definition in file cp_uforecovery.h.


Define Documentation

#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 Documentation

typedef struct storedUFO_s storedUFO_t

Structure for stored UFOs.


Enumeration Type Documentation

different statuses for a stored UFO

Note:
If you change/reorder this change ufostatus_strings (cp_uforecovery.c) as well
Enumerator:
SUFO_RECOVERED 

UFO just got recovered, it's being transported to the UFO Yard

SUFO_STORED 

UFO is in UFO Yard, nothing special

SUFO_TRANSFERED 

UFO is being transfered to another UFO Yard

MAX_SUFO_STATUS 

Definition at line 36 of file cp_uforecovery.h.


Function Documentation

void UR_ProcessActive ( void   ) 
storedUFO_t* US_GetClosestStoredUFO ( const aircraft_t ufoTemplate,
const base_t base 
)

get the closest stored ufo (of a type) from a base

Parameters:
[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
Returns:
Pointer to the first stored UFO matches the conditions

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.

Parameters:
[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.

Parameters:
[in] idx index of the stored UFO
Returns:
storedUFO_t Pointer

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  ) 
void US_RemoveUFOsExceedingCapacity ( installation_t installation  ) 

Removes ufos which are over the storing capacity.

Parameters:
[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.

Parameters:
[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
Returns:
storedUFO_t pointer to the newly stored UFO (or NULL if failed)

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).

Parameters:
[in] ufoTemplate aircraftTemplate of the ufo
[in] installation Pointer to the installation to count at
Returns:
the number of ufos stored of the given ufotype at given installation or overall
Note:
installation == NULL means count on every ufoyards

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().


Generated by  doxygen 1.6.2