UFO: Alien Invasion
|
UFO recovery and storing. More...
Go to the source code of this file.
Data Structures | |
struct | storedUFO_s |
Structure for stored UFOs. More... | |
Macros | |
#define | RECOVERY_DELAY 2.0f |
#define | US_Foreach(var) LIST_Foreach(ccs.storedUFOs, storedUFO_t, var) |
#define | US_UFOStored() (US_GetNext(nullptr) != nullptr) |
returns if any UFOs are stored in UFO Yards More... | |
Typedefs | |
typedef struct storedUFO_s | storedUFO_t |
Structure for stored UFOs. More... | |
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. More... | |
storedUFO_t * | US_StoreUFO (const aircraft_t *ufoTemplate, installation_t *installation, date_t date, float condition) |
Adds an UFO to the storage. More... | |
storedUFO_t * | US_GetStoredUFOByIDX (const int idx) |
Returns a stored ufo. More... | |
storedUFO_t * | US_GetClosestStoredUFO (const aircraft_t *ufoTemplate, const base_t *base) |
get the closest stored ufo (of a type) from a base More... | |
void | US_RemoveStoredUFO (storedUFO_t *ufo) |
Removes an UFO from the storage. More... | |
int | US_UFOsInStorage (const aircraft_t *ufoTemplate, const installation_t *installation) |
Returns the number of UFOs stored (on an installation or anywhere) More... | |
int | US_StoredUFOCount (void) |
Returns the number of storedUFOs. More... | |
void | US_RemoveUFOsExceedingCapacity (installation_t *installation) |
Removes ufos which are over the storing capacity. More... | |
bool | US_TransferUFO (storedUFO_t *ufo, installation_t *ufoyard) |
Start transferring of a stored UFO. More... | |
void | UR_InitStartup (void) |
Init actions for ufostoring-subsystem. More... | |
void | UR_Shutdown (void) |
Closing actions for ufostoring-subsystem. More... | |
UFO recovery and storing.
Definition in file cp_uforecovery.h.
#define RECOVERY_DELAY 2.0f |
Definition at line 29 of file cp_uforecovery.h.
Referenced by UR_DialogStartStore_f(), and US_TransferUFO().
#define US_Foreach | ( | var | ) | LIST_Foreach(ccs.storedUFOs, storedUFO_t, var) |
Definition at line 65 of file cp_uforecovery.h.
Referenced by INS_FillUFOYardData_f(), PR_UpdateProductionList(), UR_ProcessActive(), US_FillUFOTransferUFOs_f(), US_GetClosestStoredUFO(), US_GetStoredUFOByIDX(), US_RemoveUFOsExceedingCapacity(), US_SaveXML(), and US_UFOsInStorage().
returns if any UFOs are stored in UFO Yards
Definition at line 79 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 35 of file cp_uforecovery.h.
Init actions for ufostoring-subsystem.
Definition at line 489 of file cp_uforecovery.cpp.
References cgi, and UR_InitCallbacks().
Referenced by CP_InitStartup().
Function to process active recoveries.
Definition at line 46 of file cp_uforecovery.cpp.
References _, ccs, Com_sprintf(), cp_messageBuffer, ccs_s::date, Date_LaterThan(), MSG_TRANSFERFINISHED, MSO_CheckAddNewMessage(), NT_TRANSFER_UFORECOVERY_FINISHED, RS_MarkCollected(), SUFO_RECOVERED, SUFO_STORED, SUFO_TRANSFERED, UFO_GetName(), and US_Foreach.
Referenced by CP_CampaignRun(), and TEST_F().
Closing actions for ufostoring-subsystem.
Definition at line 498 of file cp_uforecovery.cpp.
References ccs, cgi, ccs_s::storedUFOs, and UR_ShutdownCallbacks().
Referenced by CP_Shutdown().
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 (nullptr for any type) |
[in] | base | Pointer to the base. If it's nullptr the function simply return the first stored UFO of type |
Definition at line 265 of file cp_uforecovery.cpp.
References GetDistanceOnGlobe(), base_s::pos, SUFO_STORED, and US_Foreach.
storedUFO_t* US_GetStoredUFOByIDX | ( | const int | idx | ) |
Returns a stored ufo.
[in] | idx | index of the stored UFO |
Definition at line 82 of file cp_uforecovery.cpp.
References US_Foreach.
Referenced by PR_LoadXML(), US_DestroyStoredUFO_f(), US_FillUFOTransfer_f(), US_SelectStoredUfo_f(), and US_TransferUFO_f().
void US_RemoveStoredUFO | ( | storedUFO_t * | ufo | ) |
Removes an UFO from the storage.
[in,out] | ufo | stored UFO to remove |
Definition at line 147 of file cp_uforecovery.cpp.
References ccs, cgi, capacities_s::cur, storedUFO_s::disassembly, production_s::idx, storedUFO_s::installation, PR_GetProductionForBase, PR_ProductionBase(), PR_QueueDelete(), PR_QueueNext(), RS_CheckRequirements(), ccs_s::storedUFOs, and installation_s::ufoCapacity.
Referenced by PR_FinishDisassembly(), US_DestroyStoredUFO_f(), 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 201 of file cp_uforecovery.cpp.
References cgi, capacities_s::cur, ERR_DROP, capacities_s::max, installation_s::ufoCapacity, US_Foreach, and US_RemoveStoredUFO().
Referenced by INS_DestroyInstallation().
Returns the number of storedUFOs.
Definition at line 292 of file cp_uforecovery.cpp.
References ccs, cgi, and ccs_s::storedUFOs.
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) |
Definition at line 99 of file cp_uforecovery.cpp.
References storedUFO_s::arrive, ccs_s::campaignStats, ccs, cgi, storedUFO_s::comp, COMP_GetComponentsByID(), storedUFO_s::condition, capacities_s::cur, ccs_s::date, Date_LaterThan(), DEBUG_CLIENT, storedUFO_s::disassembly, f, storedUFO_s::id, aircraft_s::id, storedUFO_s::idx, storedUFO_s::installation, LIST_Add(), capacities_s::max, Q_strncpyz(), RS_MarkCollected(), 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 TEST_F(), and UR_DialogStartStore_f().
bool US_TransferUFO | ( | storedUFO_t * | ufo, |
installation_t * | ufoyard | ||
) |
Start transferring of a stored UFO.
[in,out] | ufo | Stored UFO to transfer |
[in,out] | ufoyard | Destination of the UFO transfer |
Definition at line 224 of file cp_uforecovery.cpp.
References _, storedUFO_s::arrive, ccs, cgi, Com_sprintf(), cp_messageBuffer, capacities_s::cur, ccs_s::date, date_s::day, storedUFO_s::disassembly, ERR_DROP, storedUFO_s::installation, int(), capacities_s::max, MSG_TRANSFERFINISHED, MSO_CheckAddNewMessage(), installation_s::name, NT_TRANSFER_STARTED, RECOVERY_DELAY, storedUFO_s::status, SUFO_STORED, SUFO_TRANSFERED, and installation_s::ufoCapacity.
Referenced by US_TransferUFO_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 179 of file cp_uforecovery.cpp.
References count, SUFO_STORED, and US_Foreach.
Referenced by PR_UpdateProductionList(), and RS_RequirementsMet().