UFO recovery and storing callback functions. More...
#include "../cl_shared.h"
#include "cp_campaign.h"
#include "cp_ufo.h"
#include "cp_uforecovery.h"
#include "cp_uforecovery_callbacks.h"
#include "../ui/ui_main.h"
Go to the source code of this file.
Data Structures | |
struct | ufoRecoveryNation_s |
Entries on Sell UFO dialog. More... | |
struct | ufoRecovery_s |
Typedefs | |
typedef struct ufoRecoveryNation_s | ufoRecoveryNation_t |
Entries on Sell UFO dialog. | |
typedef int(* | COMP_FUNCTION )(ufoRecoveryNation_t *a, ufoRecoveryNation_t *b) |
Pointer to compare function. | |
typedef struct ufoRecovery_s | ufoRecovery_t |
Enumerations | |
enum | ufoRecoveryNationOrder_t { ORDER_NATION, ORDER_PRICE, ORDER_HAPPINESS, MAX_ORDER } |
Constants for Sell UFO menu order. More... | |
Functions | |
static void | UR_DialogRecoveryDone (void) |
Updates UFO recovery process. | |
static void | UR_DialogInit_f (void) |
Function to trigger UFO Recovered event. | |
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_DialogFillNations (void) |
Build the Sell UFO dialog's nationlist. | |
static int | UR_CompareByName (ufoRecoveryNation_t *a, ufoRecoveryNation_t *b) |
Compare nations by nation name. | |
static int | UR_CompareByPrice (ufoRecoveryNation_t *a, ufoRecoveryNation_t *b) |
Compare nations by price. | |
static int | UR_CompareByHappiness (ufoRecoveryNation_t *a, ufoRecoveryNation_t *b) |
Compare nations by happiness. | |
static void | UR_SortNations (COMP_FUNCTION comp, qboolean order) |
Sort nations. | |
static COMP_FUNCTION | UR_GetSortFunctionByColumn (ufoRecoveryNationOrder_t column) |
Returns the sort function for a column. | |
static void | UR_DialogInitSell_f (void) |
Function to initialize list to sell recovered UFO to desired nation. | |
static int | UR_DialogGetCurrentNationIndex (void) |
Returns the index of the selected nation in SellUFO list. | |
static ufoRecoveryNationOrder_t | UR_GetOrderTypeByID (const char *id) |
Converts script id string to ordercolumn constant. | |
static void | UR_DialogSortByColumn_f (void) |
Sort Sell UFO dialog. | |
static void | UR_DialogSelectSellNation_f (void) |
Finds the nation to which recovered UFO will be sold. | |
static void | UR_DialogStartSell_f (void) |
Function to start UFO selling process. | |
void | UR_InitCallbacks (void) |
void | UR_ShutdownCallbacks (void) |
Variables | |
static ufoRecovery_t | ufoRecovery |
UFO recovery and storing callback functions.
Definition in file cp_uforecovery_callbacks.c.
typedef int(* COMP_FUNCTION)(ufoRecoveryNation_t *a, ufoRecoveryNation_t *b) |
Pointer to compare function.
Definition at line 52 of file cp_uforecovery_callbacks.c.
typedef struct ufoRecovery_s ufoRecovery_t |
typedef struct ufoRecoveryNation_s ufoRecoveryNation_t |
Entries on Sell UFO dialog.
Constants for Sell UFO menu order.
Definition at line 57 of file cp_uforecovery_callbacks.c.
static int UR_CompareByHappiness | ( | ufoRecoveryNation_t * | a, | |
ufoRecoveryNation_t * | b | |||
) | [static] |
Compare nations by happiness.
[in] | a | First item to compare |
[in] | b | Second item to compare |
Definition at line 282 of file cp_uforecovery_callbacks.c.
References nationInfo_s::happiness, ufoRecoveryNation_s::nation, and nation_s::stats.
Referenced by UR_GetSortFunctionByColumn().
static int UR_CompareByName | ( | ufoRecoveryNation_t * | a, | |
ufoRecoveryNation_t * | b | |||
) | [static] |
Compare nations by nation name.
[in] | a | First item to compare |
[in] | b | Second item to compare |
Definition at line 250 of file cp_uforecovery_callbacks.c.
References _, nation_s::name, and ufoRecoveryNation_s::nation.
Referenced by UR_GetSortFunctionByColumn().
static int UR_CompareByPrice | ( | ufoRecoveryNation_t * | a, | |
ufoRecoveryNation_t * | b | |||
) | [static] |
Compare nations by price.
[in] | a | First item to compare |
[in] | b | Second item to compare |
Definition at line 264 of file cp_uforecovery_callbacks.c.
References ufoRecoveryNation_s::price.
Referenced by UR_GetSortFunctionByColumn().
static void UR_DialogFillNations | ( | void | ) | [static] |
Build the Sell UFO dialog's nationlist.
Definition at line 226 of file cp_uforecovery_callbacks.c.
References _, ccs, Com_sprintf(), i, lengthof, LIST_AddString(), nation_s::name, NAT_GetHappinessString(), ufoRecoveryNation_s::nation, ccs_s::numNations, ufoRecoveryNation_s::price, TEXT_UFORECOVERY_NATIONS, ufoRecovery_s::UFONations, and UI_RegisterLinkedListText().
Referenced by UR_DialogInitSell_f(), and UR_DialogSortByColumn_f().
static int UR_DialogGetCurrentNationIndex | ( | void | ) | [static] |
Returns the index of the selected nation in SellUFO list.
Definition at line 383 of file cp_uforecovery_callbacks.c.
References ccs, i, ufoRecovery_s::nation, ufoRecoveryNation_s::nation, ccs_s::numNations, and ufoRecovery_s::UFONations.
Referenced by UR_DialogSortByColumn_f(), and UR_DialogStartSell_f().
static void UR_DialogInit_f | ( | void | ) | [static] |
Function to trigger UFO Recovered event.
Definition at line 91 of file cp_uforecovery_callbacks.c.
References AIR_GetAircraft(), ccs, Cmd_Argc(), Cmd_Argv(), Com_Printf(), cond(), ufoRecovery_s::condition, missionResults_s::crashsite, Cvar_Set(), Cvar_SetValue(), MAX_VAR, ccs_s::missionResults, ORDER_NATION, Q_strncpyz(), qtrue, missionResults_s::recovery, ufoRecovery_s::sortedColumn, UFO_MissionResultToString(), missionResults_s::ufoCondition, ufoRecovery_s::ufoTemplate, aircraft_s::ufotype, and missionResults_s::ufotype.
Referenced by UR_InitCallbacks().
static void UR_DialogInitSell_f | ( | void | ) | [static] |
Function to initialize list to sell recovered UFO to desired nation.
Definition at line 353 of file cp_uforecovery_callbacks.c.
References ccs, f, frand(), i, int(), NAT_GetNationByIDX(), ufoRecoveryNation_s::nation, ccs_s::numNations, ufoRecoveryNation_s::price, aircraft_s::price, ufoRecovery_s::recoveryDone, ufoRecovery_s::sortDescending, ufoRecovery_s::sortedColumn, nation_s::stats, ufoRecovery_s::UFONations, ufoRecovery_s::ufoTemplate, UI_ExecuteConfunc(), UR_DialogFillNations(), UR_GetSortFunctionByColumn(), UR_SortNations(), and nationInfo_s::xviInfection.
Referenced by UR_InitCallbacks().
static void UR_DialogInitStore_f | ( | void | ) | [static] |
Function to initialize list of storage locations for recovered UFO.
Definition at line 131 of file cp_uforecovery_callbacks.c.
References _, ccs, Com_sprintf(), count, cap_maxcur_s::cur, Cvar_Set(), i, INS_GetFoundedInstallationByIDX(), lengthof, LIST_AddString(), cap_maxcur_s::max, MAX_VAR, installation_s::name, ccs_s::numInstallations, ufoRecovery_s::recoveryDone, TEXT_UFORECOVERY_CAPACITIES, TEXT_UFORECOVERY_UFOYARDS, UFO_MissionResultToString(), installation_s::ufoCapacity, UI_ExecuteConfunc(), and UI_RegisterLinkedListText().
Referenced by UR_InitCallbacks().
static void UR_DialogRecoveryDone | ( | void | ) | [static] |
Updates UFO recovery process.
Definition at line 81 of file cp_uforecovery_callbacks.c.
References qtrue, and ufoRecovery_s::recoveryDone.
Referenced by UR_DialogStartSell_f(), and UR_DialogStartStore_f().
static void UR_DialogSelectSellNation_f | ( | void | ) | [static] |
Finds the nation to which recovered UFO will be sold.
Definition at line 451 of file cp_uforecovery_callbacks.c.
References _, ccs, Cmd_Argc(), Cmd_Argv(), Com_DPrintf(), Com_Printf(), Cvar_Set(), DEBUG_CLIENT, nation_s::name, ufoRecovery_s::nation, ufoRecoveryNation_s::nation, ccs_s::numNations, ufoRecovery_s::UFONations, and UI_ExecuteConfunc().
Referenced by UR_InitCallbacks().
static void UR_DialogSortByColumn_f | ( | void | ) | [static] |
Sort Sell UFO dialog.
Definition at line 414 of file cp_uforecovery_callbacks.c.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), qfalse, ufoRecovery_s::sortDescending, ufoRecovery_s::sortedColumn, UI_ExecuteConfunc(), UR_DialogFillNations(), UR_DialogGetCurrentNationIndex(), UR_GetOrderTypeByID(), UR_GetSortFunctionByColumn(), and UR_SortNations().
Referenced by UR_InitCallbacks().
static void UR_DialogStartSell_f | ( | void | ) | [static] |
Function to start UFO selling process.
Definition at line 480 of file cp_uforecovery_callbacks.c.
References _, ccs, CL_UpdateCredits(), Com_sprintf(), cp_messageBuffer, ccs_s::credits, nationInfo_s::happiness, HAPPINESS_UFO_SALE_GAIN, HAPPINESS_UFO_SALE_LOSS, i, MS_AddNewMessage(), MSG_STANDARD, nation_s::name, NAT_GetNationByIDX(), NAT_SetHappiness(), ufoRecovery_s::nation, ccs_s::numNations, ufoRecoveryNation_s::price, qfalse, nation_s::stats, UFO_TypeToName(), ufoRecovery_s::UFONations, ufoRecovery_s::ufoTemplate, aircraft_s::ufotype, UR_DialogGetCurrentNationIndex(), and UR_DialogRecoveryDone().
Referenced by UR_InitCallbacks().
static void UR_DialogStartStore_f | ( | void | ) | [static] |
Function to start UFO recovery process.
Definition at line 178 of file cp_uforecovery_callbacks.c.
References _, ccs, Cmd_Argc(), Cmd_Argv(), Com_Printf(), Com_sprintf(), ufoRecovery_s::condition, count, cp_messageBuffer, cap_maxcur_s::cur, ccs_s::date, date_s::day, i, INS_GetFoundedInstallationByIDX(), int(), lengthof, cap_maxcur_s::max, MS_AddNewMessage(), MSG_STANDARD, installation_s::name, ccs_s::numInstallations, qfalse, RECOVERY_DELAY, UFO_TypeToName(), installation_s::ufoCapacity, ufoRecovery_s::ufoTemplate, aircraft_s::ufotype, UR_DialogRecoveryDone(), and US_StoreUFO().
Referenced by UR_InitCallbacks().
static ufoRecoveryNationOrder_t UR_GetOrderTypeByID | ( | const char * | id | ) | [static] |
Converts script id string to ordercolumn constant.
[in] | id | Script id for order column |
Definition at line 398 of file cp_uforecovery_callbacks.c.
References MAX_ORDER, ORDER_HAPPINESS, ORDER_NATION, and ORDER_PRICE.
Referenced by UR_DialogSortByColumn_f().
static COMP_FUNCTION UR_GetSortFunctionByColumn | ( | ufoRecoveryNationOrder_t | column | ) | [static] |
Returns the sort function for a column.
[in] | column | Column ordertype. |
Definition at line 334 of file cp_uforecovery_callbacks.c.
References Com_Printf(), ORDER_HAPPINESS, ORDER_NATION, ORDER_PRICE, UR_CompareByHappiness(), UR_CompareByName(), and UR_CompareByPrice().
Referenced by UR_DialogInitSell_f(), and UR_DialogSortByColumn_f().
void UR_InitCallbacks | ( | void | ) |
Definition at line 622 of file cp_uforecovery_callbacks.c.
References Cmd_AddCommand(), UR_DialogInit_f(), UR_DialogInitSell_f(), UR_DialogInitStore_f(), UR_DialogSelectSellNation_f(), UR_DialogSortByColumn_f(), UR_DialogStartSell_f(), and UR_DialogStartStore_f().
Referenced by CP_AddCampaignCallbackCommands().
void UR_ShutdownCallbacks | ( | void | ) |
Definition at line 638 of file cp_uforecovery_callbacks.c.
References Cmd_RemoveCommand().
Referenced by CP_RemoveCampaignCallbackCommands().
static void UR_SortNations | ( | COMP_FUNCTION | comp, | |
qboolean | order | |||
) | [static] |
Sort nations.
[in] | comp | Compare function |
[in] | order | Ascending/Descending order |
Definition at line 303 of file cp_uforecovery_callbacks.c.
References ccs, i, ccs_s::numNations, qfalse, qtrue, and ufoRecovery_s::UFONations.
Referenced by UR_DialogInitSell_f(), and UR_DialogSortByColumn_f().
ufoRecovery_t ufoRecovery [static] |
Definition at line 76 of file cp_uforecovery_callbacks.c.