UFO recovery and storing. More...
#include "../cl_shared.h"
#include "cp_campaign.h"
#include "cp_ufo.h"
#include "cp_map.h"
#include "cp_uforecovery.h"
#include "cp_uforecovery_callbacks.h"
#include "cp_aircraft.h"
#include "save/save_uforecovery.h"
Go to the source code of this file.
Functions | |
void | UR_ProcessActive (void) |
Function to process active recoveries. | |
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_StoreUFO (const aircraft_t *ufoTemplate, installation_t *installation, date_t date, float condition) |
Adds an UFO to the storage. | |
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). | |
void | US_RemoveUFOsExceedingCapacity (installation_t *installation) |
Removes ufos which are over the storing capacity. | |
storedUFO_t * | US_GetClosestStoredUFO (const aircraft_t *ufoTemplate, const base_t *base) |
get the closest stored ufo (of a type) from a base | |
int | US_StoredUFOCount (void) |
Returns the number of storedUFOs. | |
qboolean | US_SaveXML (mxml_node_t *p) |
Save callback for savegames in XML Format. | |
qboolean | US_LoadXML (mxml_node_t *p) |
Load callback for xml savegames. |
UFO recovery and storing.
Definition in file cp_uforecovery.c.
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().
qboolean US_LoadXML | ( | mxml_node_t * | p | ) |
Load callback for xml savegames.
[in] | p | XML Node structure, where we get the information from |
<
Definition at line 311 of file cp_uforecovery.c.
References AIR_GetAircraft(), storedUFO_s::arrive, ccs, CL_GetComponentsByID(), Com_GetConstIntFromNamespace(), Com_Printf(), Com_RegisterConstList(), Com_UnregisterConstList(), storedUFO_s::comp, storedUFO_s::condition, cap_maxcur_s::cur, date_s::day, storedUFO_s::disassembly, f, i, storedUFO_s::id, installation_s::idx, storedUFO_s::idx, INS_GetFoundedInstallationByIDX(), storedUFO_s::installation, LIST_Add(), cap_maxcur_s::max, MAX_INSTALLATIONS, mxml_GetDate(), mxml_GetFloat(), mxml_GetInt(), mxml_GetNextNode(), mxml_GetNode(), mxml_GetString(), Q_strncpyz(), qtrue, SAVE_STOREDUFOSTATUS_NAMESPACE, SAVE_UFORECOVERY_CONDITION, SAVE_UFORECOVERY_DATE, SAVE_UFORECOVERY_INSTALLATIONIDX, SAVE_UFORECOVERY_STATUS, SAVE_UFORECOVERY_STOREDUFOS, SAVE_UFORECOVERY_UFO, SAVE_UFORECOVERY_UFOID, SAVE_UFORECOVERY_UFOIDX, saveStoredUFOConstants, date_s::sec, storedUFO_s::status, ccs_s::storedUFOs, installation_s::ufoCapacity, and storedUFO_s::ufoTemplate.
Referenced by SAV_Init().
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().
qboolean US_SaveXML | ( | mxml_node_t * | p | ) |
Save callback for savegames in XML Format.
[out] | p | XML Node structure, where we write the information to |
Definition at line 283 of file cp_uforecovery.c.
References storedUFO_s::arrive, Com_GetConstVariable(), Com_RegisterConstList(), Com_UnregisterConstList(), storedUFO_s::condition, date_s::day, storedUFO_s::id, installation_s::idx, storedUFO_s::idx, storedUFO_s::installation, mxml_AddDate(), mxml_AddFloat(), mxml_AddInt(), mxml_AddNode(), mxml_AddString(), qtrue, SAVE_STOREDUFOSTATUS_NAMESPACE, SAVE_UFORECOVERY_CONDITION, SAVE_UFORECOVERY_DATE, SAVE_UFORECOVERY_INSTALLATIONIDX, SAVE_UFORECOVERY_STATUS, SAVE_UFORECOVERY_STOREDUFOS, SAVE_UFORECOVERY_UFO, SAVE_UFORECOVERY_UFOID, SAVE_UFORECOVERY_UFOIDX, saveStoredUFOConstants, date_s::sec, storedUFO_s::status, and US_GetNext().
Referenced by SAV_Init().
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().