50 assert(ufo->ufoTemplate);
51 assert(ufo->ufoTemplate->tech);
55 if (ufo->arrive >
ccs.date)
59 switch (ufo->status) {
71 if (!ufo->ufoTemplate->tech->statusCollected)
103 cgi->Com_DPrintf(
DEBUG_CLIENT,
"US_StoreUFO: Invalid aircraft (UFO) Template.\n");
113 cgi->Com_DPrintf(
DEBUG_CLIENT,
"US_StoreUFO: Installation is full with UFOs.\n");
119 ufo.
idx =
ccs.campaignStats.ufosStored++;
127 assert(ufoTemplate->
tech);
139 ufo.
condition = std::min(std::max(0.0f, condition), 1.0f);
169 cgi->LIST_Remove(&
ccs.storedUFOs, (
void*)ufo);
185 if (ufo->ufoTemplate != ufoTemplate)
187 if (installation && ufo->installation != installation)
205 cgi->Com_Error(
ERR_DROP,
"US_RemoveUFOsExceedingCapacity: No installation given!\n");
210 if (ufoCap->
cur <= ufoCap->
max)
212 if (ufo->installation != installation) {
228 cgi->Com_Error(
ERR_DROP,
"No UFO cannot be transferred!");
230 cgi->Com_Error(
ERR_DROP,
"UFO cannot be transferred to void!");
263 float minDistance = -1;
269 if (ufoTemplate && ufo->ufoTemplate != ufoTemplate)
273 assert(ufo->installation);
277 if (minDistance < 0 || minDistance > distance) {
278 minDistance = distance;
290 return cgi->LIST_Count(
ccs.storedUFOs);
313 if (ufo->installation)
342 cgi->Com_Printf(
"Invalid or no IDX defined for stored UFO.\n");
347 cgi->Com_Printf(
"Invalid storedUFOStatus '%s'\n",
id);
354 cgi->Com_Printf(
"UFO has no/invalid installation assigned\n");
367 cgi->Com_Printf(
"UFO has no/invalid aircraftTemplare assigned\n");
372 cgi->Com_Printf(
"UFO has no/invalid components set\n");
392static void US_ListStoredUFOs_f (
void)
398 cgi->Com_Printf(
"IDX: %i\n", ufo->idx);
399 cgi->Com_Printf(
"id: %s\n", ufo->id);
400 cgi->Com_Printf(
"stored at %s\n", (ufo->installation) ? ufo->installation->name :
"NOWHERE");
403 cgi->Com_Printf(
"arrived at: %i %s %02i, %02i:%02i\n", date.
year,
406 if (ufo->ufoTemplate->tech->base)
407 cgi->Com_Printf(
"tech being researched at %s\n", ufo->ufoTemplate->tech->base->name);
409 cgi->Com_Printf(
"being disassembled at %s\n", prodBase->
name);
416static void US_StoreUFO_f (
void)
420 if (
cgi->Cmd_Argc() <= 2) {
421 cgi->Com_Printf(
"Usage: %s <ufoType> <installationIdx>\n",
cgi->Cmd_Argv(0));
426 int installationIDX = atoi(
cgi->Cmd_Argv(2));
429 if (installationIDX < 0) {
430 cgi->Com_Printf(
"US_StoreUFO_f: Invalid Installation index.\n");
435 cgi->Com_Printf(
"US_StoreUFO_f: There is no Installation: idx=%i.\n", installationIDX);
442 for (
int i = 0;
i <
ccs.numAircraftTemplates;
i++) {
443 if (strstr(
ccs.aircraftTemplates[
i].id, ufoId)) {
444 ufoType = &
ccs.aircraftTemplates[
i];
448 if (ufoType ==
nullptr) {
449 cgi->Com_Printf(
"US_StoreUFO_f: In valid UFO Id.\n");
460static void US_RemoveStoredUFO_f (
void)
462 if (
cgi->Cmd_Argc() < 2) {
463 cgi->Com_Printf(
"Usage: %s <idx>\n",
cgi->Cmd_Argv(0));
466 const int idx = atoi(
cgi->Cmd_Argv(1));
469 cgi->Com_Printf(
"US_RemoveStoredUFO_f: No such ufo index.\n");
479 {
"debug_liststoredufos", US_ListStoredUFOs_f,
"Debug function to list UFOs in Hangars."},
480 {
"debug_storeufo", US_StoreUFO_f,
"Debug function to Add UFO to Hangars."},
481 {
"debug_removestoredufo", US_RemoveStoredUFO_f,
"Debug function to Remove UFO from Hangars."},
483 {
nullptr,
nullptr,
nullptr}
500 cgi->LIST_Delete(&
ccs.storedUFOs);
DateTime class definition.
CGAME_HARD_LINKED_FUNCTIONS linkedList_t * LIST_Add(linkedList_t **listDest, void const *data, size_t length)
Share stuff between the different cgame implementations.
Class describing a point of time.
const aircraft_t * AIR_GetAircraft(const char *name)
Searches the global array of aircraft types for a given aircraft.
Header file for aircraft stuff.
Header file for single player campaign control.
const cgame_import_t * cgi
components_t * COMP_GetComponentsByID(const char *id)
Returns components definition by ID.
Header file for Aircraft and item components.
Header for Geoscape management.
installation_t * INS_GetByIDX(int idx)
Get installation by it's index.
uiMessageListNodeMessage_t * MSO_CheckAddNewMessage(const notify_t messagecategory, const char *title, const char *text, messageType_t type, technology_t *pedia, bool popup)
Adds a new message to message stack. It uses message settings to verify whether sound should be playe...
@ NT_TRANSFER_UFORECOVERY_FINISHED
char cp_messageBuffer[MAX_MESSAGE_TEXT]
void PR_QueueDelete(base_t *base, production_queue_t *queue, int index)
Delete the selected entry from the queue.
base_t * PR_ProductionBase(const production_t *production)
Returns the base pointer the production belongs to.
void PR_QueueNext(base_t *base)
Queues the next production in the queue.
#define PR_GetProductionForBase(base)
void RS_MarkCollected(technology_t *tech)
Marks a give technology as collected.
void RS_CheckRequirements(void)
Checks if running researches still meet their requirements.
void CP_DateConvertLong(const DateTime &date, dateLong_t *dateLong)
Converts a date from the engine in a (longer) human-readable format.
const char * Date_GetMonthName(int month)
Returns the short monthame to the given month index.
Campaign geoscape time header.
const char * UFO_GetName(const aircraft_t *ufocraft)
Returns name of the UFO if UFO has been researched.
bool US_SaveXML(xmlNode_t *p)
Save callback for savegames in XML Format.
int US_StoredUFOCount(void)
Returns the number of storedUFOs.
storedUFO_t * US_GetStoredUFOByIDX(const int idx)
Returns a stored ufo.
void UR_Shutdown(void)
Closing actions for ufostoring-subsystem.
bool US_LoadXML(xmlNode_t *p)
Load callback for xml savegames.
static const cmdList_t debugStoredUfosCmds[]
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.
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.
void UR_InitStartup(void)
Init 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).
bool US_TransferUFO(storedUFO_t *ufo, installation_t *ufoyard)
Start transferring of a stored UFO.
void UR_ProcessActive(void)
Function to process active recoveries.
UFO recovery and storing.
storedUFOStatus_t
different statuses for a stored UFO
void UR_InitCallbacks(void)
void UR_ShutdownCallbacks(void)
UFO recovery and storing callback header file.
double GetDistanceOnGlobe(const vec2_t pos1, const vec2_t pos2)
Calculate distance on the geoscape.
XML tag constants for savegame.
#define SAVE_UFORECOVERY_INSTALLATIONIDX
#define SAVE_UFORECOVERY_UFOIDX
#define SAVE_UFORECOVERY_UFOID
static const constListEntry_t saveStoredUFOConstants[]
#define SAVE_STOREDUFOSTATUS_NAMESPACE
#define SAVE_UFORECOVERY_STOREDUFOS
#define SAVE_UFORECOVERY_STATUS
#define SAVE_UFORECOVERY_DATE
#define SAVE_UFORECOVERY_UFO
#define SAVE_UFORECOVERY_CONDITION
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
An aircraft with all it's data.
struct technology_s * tech
A base with all it's data.
Store capacities in base.
Human readable time information in the game.
A installation with all it's data.
Structure for stored UFOs.
production_t * disassembly
struct components_s * comp
const aircraft_t * ufoTemplate
installation_t * installation