UFO: Alien Invasion
Loading...
Searching...
No Matches
cp_uforecovery_callbacks.cpp File Reference

UFO recovery and storing callback functions. More...

#include "../../DateTime.h"
#include "../../cl_shared.h"
#include "../../ui/ui_dataids.h"
#include "cp_campaign.h"
#include "cp_ufo.h"
#include "cp_uforecovery.h"
#include "cp_uforecovery_callbacks.h"
#include "cp_geoscape.h"
#include "cp_time.h"
Include dependency graph for cp_uforecovery_callbacks.cpp:

Go to the source code of this file.

Macros

#define HAPPINESS_UFO_SALE_GAIN   0.02
#define HAPPINESS_UFO_SALE_LOSS   0.005

Functions

static void UR_DialogInitStore_f (void)
 Function to initialize list of storage locations for recovered UFO.
static void UR_DialogStartStore_f (void)
 Function to start UFO recovery process.
static void UR_DialogInitSell_f (void)
 Function to initialize list to sell recovered UFO to desired nation.
static void UR_DialogStartSell_f (void)
 Function to start UFO selling process.
const char * US_StoredUFOStatus (const storedUFO_t *ufo)
 Returns string representation of the stored UFO's status.
static void US_SelectStoredUfo_f (void)
 Send Stored UFO data to the UI.
static void US_DestroyStoredUFO_f (void)
 Destroys a stored UFO.
static void US_FillUFOTransfer_f (void)
 Fills UFO Yard UI with transfer destinations.
static void US_FillUFOTransferUFOs_f (void)
 Send Stored UFOs of the destination UFO Yard.
static void US_TransferUFO_f (void)
 Callback to start the transfer of a stored UFO.
void UR_InitCallbacks (void)
void UR_ShutdownCallbacks (void)

Variables

static const cmdList_t ufoRecoveryCallbacks []

Detailed Description

UFO recovery and storing callback functions.

Note
UFO recovery functions with UR_*
UFO storing functions with US_*

Definition in file cp_uforecovery_callbacks.cpp.

Macro Definition Documentation

◆ HAPPINESS_UFO_SALE_GAIN

#define HAPPINESS_UFO_SALE_GAIN   0.02

Definition at line 37 of file cp_uforecovery_callbacks.cpp.

Referenced by UR_DialogStartSell_f().

◆ HAPPINESS_UFO_SALE_LOSS

#define HAPPINESS_UFO_SALE_LOSS   0.005

Definition at line 38 of file cp_uforecovery_callbacks.cpp.

Referenced by UR_DialogStartSell_f().

Function Documentation

◆ UR_DialogInitSell_f()

void UR_DialogInitSell_f ( void )
static

Function to initialize list to sell recovered UFO to desired nation.

Note
Command to call this: cp_uforecovery_sell_init.

Definition at line 108 of file cp_uforecovery_callbacks.cpp.

References _, AIR_GetAircraft(), cgi, frand(), nationInfo_t::happiness, int(), NAT_Foreach, NAT_GetCurrentMonthInfo(), NAT_GetHappinessString(), aircraft_t::price, and nationInfo_t::xviInfection.

◆ UR_DialogInitStore_f()

void UR_DialogInitStore_f ( void )
static

Function to initialize list of storage locations for recovered UFO.

Note
Command to call this: cp_uforecovery_store_init.
See also
UR_ConditionsForStoring

Definition at line 45 of file cp_uforecovery_callbacks.cpp.

References cgi, capacities_t::cur, INS_Foreach, and capacities_t::max.

◆ UR_DialogStartSell_f()

void UR_DialogStartSell_f ( void )
static

Function to start UFO selling process.

Note
Command to call this: cp_uforecovery_sell_start.

Definition at line 143 of file cp_uforecovery_callbacks.cpp.

References _, ccs, cgi, Com_sprintf(), cp_messageBuffer, CP_UpdateCredits(), HAPPINESS_UFO_SALE_GAIN, HAPPINESS_UFO_SALE_LOSS, MS_AddNewMessage(), nation_t::name, NAT_Foreach, NAT_GetNationByID(), and NAT_SetHappiness().

◆ UR_DialogStartStore_f()

void UR_DialogStartStore_f ( void )
static

Function to start UFO recovery process.

Note
Command to call this: cp_uforecovery_store_start.

Definition at line 65 of file cp_uforecovery_callbacks.cpp.

References _, AIR_GetAircraftSilent(), AIR_IsUFO, ccs, cgi, Com_sprintf(), cp_messageBuffer, capacities_t::cur, INS_GetByIDX(), lengthof, capacities_t::max, MS_AddNewMessage(), installation_t::name, RECOVERY_DELAY, UFO_GetName(), installation_t::ufoCapacity, and US_StoreUFO().

◆ UR_InitCallbacks()

void UR_InitCallbacks ( void )

Definition at line 356 of file cp_uforecovery_callbacks.cpp.

References cgi, and ufoRecoveryCallbacks.

Referenced by UR_InitStartup().

◆ UR_ShutdownCallbacks()

void UR_ShutdownCallbacks ( void )

Definition at line 361 of file cp_uforecovery_callbacks.cpp.

References cgi, and ufoRecoveryCallbacks.

Referenced by UR_Shutdown().

◆ US_DestroyStoredUFO_f()

void US_DestroyStoredUFO_f ( void )
static

Destroys a stored UFO.

Note
it's called by 'ui_destroystoredufo' command with a parameter of the stored UFO IDX and a confirmation value

Definition at line 240 of file cp_uforecovery_callbacks.cpp.

References _, cgi, Com_sprintf(), DEBUG_CLIENT, installation_t::idx, storedUFO_t::idx, storedUFO_t::installation, US_GetStoredUFOByIDX(), and US_RemoveStoredUFO().

◆ US_FillUFOTransfer_f()

void US_FillUFOTransfer_f ( void )
static

Fills UFO Yard UI with transfer destinations.

Definition at line 270 of file cp_uforecovery_callbacks.cpp.

References _, cgi, DEBUG_CLIENT, GEO_GetNation(), INS_ForeachOfType, storedUFO_t::installation, INSTALLATION_UFOYARD, nation_t::name, and US_GetStoredUFOByIDX().

◆ US_FillUFOTransferUFOs_f()

void US_FillUFOTransferUFOs_f ( void )
static

Send Stored UFOs of the destination UFO Yard.

Definition at line 297 of file cp_uforecovery_callbacks.cpp.

References cgi, DEBUG_CLIENT, installation_t::idx, INS_GetByIDX(), and US_Foreach.

◆ US_SelectStoredUfo_f()

void US_SelectStoredUfo_f ( void )
static

Send Stored UFO data to the UI.

Note
it's called by 'ui_selectstoredufo' command with a parameter of the stored UFO IDX

Definition at line 213 of file cp_uforecovery_callbacks.cpp.

References storedUFO_t::arrive, ccs, cgi, storedUFO_t::condition, CP_SecondConvert(), Date_DateToSeconds(), storedUFO_t::idx, storedUFO_t::installation, aircraft_t::model, installation_t::name, Q_streq, UFO_GetName(), storedUFO_t::ufoTemplate, US_GetStoredUFOByIDX(), and US_StoredUFOStatus().

◆ US_StoredUFOStatus()

const char * US_StoredUFOStatus ( const storedUFO_t * ufo)

Returns string representation of the stored UFO's status.

Note
uses stored ufo status and disassembly

Definition at line 191 of file cp_uforecovery_callbacks.cpp.

References storedUFO_t::disassembly, storedUFO_t::status, SUFO_RECOVERED, SUFO_STORED, and SUFO_TRANSFERED.

Referenced by INS_FillUFOYardData_f(), and US_SelectStoredUfo_f().

◆ US_TransferUFO_f()

void US_TransferUFO_f ( void )
static

Callback to start the transfer of a stored UFO.

Definition at line 321 of file cp_uforecovery_callbacks.cpp.

References cgi, INS_GetByIDX(), US_GetStoredUFOByIDX(), and US_TransferUFO().

Variable Documentation

◆ ufoRecoveryCallbacks

const cmdList_t ufoRecoveryCallbacks[]
static
Initial value:
= {
{"cp_uforecovery_sell_init", UR_DialogInitSell_f, "Function to initialize sell recovered UFO to desired nation."},
{"cp_uforecovery_store_init", UR_DialogInitStore_f, "Function to initialize store recovered UFO in desired base."},
{"cp_uforecovery_store_start", UR_DialogStartStore_f, "Function to start UFO recovery processing."},
{"cp_uforecovery_sell_start", UR_DialogStartSell_f, "Function to start UFO selling processing."},
{"ui_selectstoredufo", US_SelectStoredUfo_f, "Send Stored UFO data to the UI"},
{"ui_destroystoredufo", US_DestroyStoredUFO_f, "Destroy stored UFO"},
{"ui_fill_ufotransfer", US_FillUFOTransfer_f, "Fills UFO Yard UI with transfer destinations"},
{"ui_selecttransferyard", US_FillUFOTransferUFOs_f, "Send Stored UFOs of the destination UFO Yard"},
{"ui_transferufo", US_TransferUFO_f, "Transfer stored UFO to another UFO Yard"},
{nullptr, nullptr, nullptr}
}
static void US_SelectStoredUfo_f(void)
Send Stored UFO data to the UI.
static void US_TransferUFO_f(void)
Callback to start the transfer of a stored UFO.
static void UR_DialogInitStore_f(void)
Function to initialize list of storage locations for recovered UFO.
static void US_FillUFOTransfer_f(void)
Fills UFO Yard UI with transfer destinations.
static void UR_DialogStartStore_f(void)
Function to start UFO recovery process.
static void US_DestroyStoredUFO_f(void)
Destroys a stored UFO.
static void UR_DialogInitSell_f(void)
Function to initialize list to sell recovered UFO to desired nation.
static void UR_DialogStartSell_f(void)
Function to start UFO selling process.
static void US_FillUFOTransferUFOs_f(void)
Send Stored UFOs of the destination UFO Yard.

Definition at line 343 of file cp_uforecovery_callbacks.cpp.

Referenced by UR_InitCallbacks(), and UR_ShutdownCallbacks().