UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cp_uforecovery_callbacks.cpp File Reference

UFO recovery and storing callback functions. More...

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

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. More...
 
static void UR_DialogStartStore_f (void)
 Function to start UFO recovery process. More...
 
static void UR_DialogInitSell_f (void)
 Function to initialize list to sell recovered UFO to desired nation. More...
 
static void UR_DialogStartSell_f (void)
 Function to start UFO selling process. More...
 
const char * US_StoredUFOStatus (const storedUFO_t *ufo)
 Returns string representation of the stored UFO's status. More...
 
static void US_SelectStoredUfo_f (void)
 Send Stored UFO data to the UI. More...
 
static void US_DestroyStoredUFO_f (void)
 Destroys a stored UFO. More...
 
static void US_FillUFOTransfer_f (void)
 Fills UFO Yard UI with transfer destinations. More...
 
static void US_FillUFOTransferUFOs_f (void)
 Send Stored UFOs of the destination UFO Yard. More...
 
static void US_TransferUFO_f (void)
 Callback to start the transfer of a stored UFO. More...
 
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

#define HAPPINESS_UFO_SALE_GAIN   0.02

Definition at line 36 of file cp_uforecovery_callbacks.cpp.

Referenced by UR_DialogStartSell_f().

#define HAPPINESS_UFO_SALE_LOSS   0.005

Definition at line 37 of file cp_uforecovery_callbacks.cpp.

Referenced by UR_DialogStartSell_f().

Function Documentation

static 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, cgame_import_s::Cmd_Argv(), f, frand(), nationInfo_s::happiness, int(), NAT_Foreach, NAT_GetCurrentMonthInfo(), NAT_GetHappinessString(), aircraft_s::price, and nationInfo_s::xviInfection.

static 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 44 of file cp_uforecovery_callbacks.cpp.

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

static void UR_DialogStartSell_f ( void  )
static
static void UR_DialogStartStore_f ( void  )
static
void UR_InitCallbacks ( void  )

Definition at line 357 of file cp_uforecovery_callbacks.cpp.

References cgi.

Referenced by UR_InitStartup().

void UR_ShutdownCallbacks ( void  )

Definition at line 362 of file cp_uforecovery_callbacks.cpp.

References cgi.

Referenced by UR_Shutdown().

static 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 241 of file cp_uforecovery_callbacks.cpp.

References _, cgi, cgame_import_s::Cmd_Argv(), Com_sprintf(), DEBUG_CLIENT, storedUFO_s::idx, installation_s::idx, storedUFO_s::installation, US_GetStoredUFOByIDX(), and US_RemoveStoredUFO().

static void US_FillUFOTransfer_f ( void  )
static
static void US_FillUFOTransferUFOs_f ( void  )
static

Send Stored UFOs of the destination UFO Yard.

Definition at line 298 of file cp_uforecovery_callbacks.cpp.

References cgi, cgame_import_s::Cmd_Argv(), DEBUG_CLIENT, installation_s::idx, INS_GetByIDX(), and US_Foreach.

static void US_SelectStoredUfo_f ( void  )
static
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_s::disassembly, storedUFO_s::status, SUFO_RECOVERED, SUFO_STORED, and SUFO_TRANSFERED.

Referenced by INS_FillUFOYardData_f(), and US_SelectStoredUfo_f().

static void US_TransferUFO_f ( void  )
static

Callback to start the transfer of a stored UFO.

Definition at line 322 of file cp_uforecovery_callbacks.cpp.

References cgi, cgame_import_s::Cmd_Argv(), INS_GetByIDX(), US_GetStoredUFOByIDX(), and US_TransferUFO().

Variable Documentation

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_DestroyStoredUFO_f(void)
Destroys a stored 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 US_FillUFOTransferUFOs_f(void)
Send Stored UFOs of the destination UFO Yard.
static void US_FillUFOTransfer_f(void)
Fills UFO Yard UI with transfer destinations.
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_DialogStartSell_f(void)
Function to start UFO selling process.
static void UR_DialogInitStore_f(void)
Function to initialize list of storage locations for recovered UFO.

Definition at line 344 of file cp_uforecovery_callbacks.cpp.