UFO: Alien Invasion
|
#include "cp_transfer_callbacks.h"
#include "../../cl_shared.h"
#include "cp_campaign.h"
#include "cp_capacity.h"
#include "cp_transfer.h"
#include "cp_popup.h"
#include "cp_time.h"
#include "aliencargo.h"
#include "aliencontainment.h"
#include "itemcargo.h"
Go to the source code of this file.
Enumerations | |
enum | transferType_t { TRANS_TYPE_INVALID = -1, TRANS_TYPE_ITEM, TRANS_TYPE_EMPLOYEE, TRANS_TYPE_ALIEN, TRANS_TYPE_AIRCRAFT, TRANS_TYPE_MAX } |
transfer types More... | |
Functions | |
CASSERT (lengthof(transferTypeIDs)==TRANS_TYPE_MAX) | |
static void | TR_ClearTempCargo (void) |
Clear temporary cargo arrays. More... | |
static void | TR_TransferStart_f (void) |
Starts the transfer. More... | |
static transferType_t | TR_GetTransferType (const char *id) |
Returns the transfer type. More... | |
static void | TR_CargoList (void) |
Display cargo list. More... | |
static bool | TR_AircraftListSelect (const aircraft_t *aircraft) |
Check if an aircraft should be displayed for transfer. More... | |
static void | TR_FillItems (const base_t *srcBase, const base_t *destBase) |
Add items to the transfer storages list. More... | |
static void | TR_FillEmployees (const base_t *srcBase, const base_t *destBase) |
Add employees to the transfer storages list. More... | |
static void | TR_FillAliens (const base_t *srcBase, const base_t *destBase) |
Add aliens to the transfer storages list. More... | |
static void | TR_FillAircraft (const base_t *srcBase, const base_t *destBase) |
Add aircraft to the transfer storages list. More... | |
static void | TR_Fill (const base_t *srcBase, const base_t *destBase, transferType_t transferType) |
Fills the items-in-base list with stuff available for transfer. More... | |
static void | TR_Fill_f (void) |
Callback for filling list with stuff available for transfer. More... | |
static void | TR_Add_f (void) |
Callback handles adding/removing items to transfercargo. More... | |
static void | TR_TransferListClear_f (void) |
Unload everything from transfer cargo back to base. More... | |
static void | TR_TransferBaseSelect (base_t *srcbase, base_t *destbase) |
Callback for base list click. More... | |
static void | TR_InitBaseList (void) |
Fills the optionlist with available bases to transfer to. More... | |
static void | TR_SelectBase_f (void) |
Callback to select destination base. More... | |
static void | TR_Init_f (void) |
Transfer menu init function. More... | |
static void | TR_TransferClose_f (void) |
Closes Transfer Menu and resets temp arrays. More... | |
static void | TR_List_f (void) |
Assembles the list of transfers for the popup. More... | |
static void | TR_CountEmployeeInListArray (linkedList_t *employeeListArray[], int capacity[]) |
Count capacity need of employee in array of lists. More... | |
static void | TR_CountAircraftInList (linkedList_t *aircraftList, int capacity[]) |
Count capacity need of aircraft in lists. More... | |
static void | TR_DestinationCapacityList_f (void) |
Callback for assemble destination base capacity list. More... | |
void | TR_InitCallbacks (void) |
void | TR_ShutdownCallbacks (void) |
Variables | |
static char const *const | transferTypeIDs [] |
transfer typeID strings More... | |
static transfer_t | tr |
static transferType_t | currentTransferType |
static const cmdList_t | transferCallbacks [] |
enum transferType_t |
transfer types
Enumerator | |
---|---|
TRANS_TYPE_INVALID | |
TRANS_TYPE_ITEM | |
TRANS_TYPE_EMPLOYEE | |
TRANS_TYPE_ALIEN | |
TRANS_TYPE_AIRCRAFT | |
TRANS_TYPE_MAX |
Definition at line 38 of file cp_transfer_callbacks.cpp.
CASSERT | ( | lengthof(transferTypeIDs) | = =TRANS_TYPE_MAX | ) |
Callback handles adding/removing items to transfercargo.
Definition at line 417 of file cp_transfer_callbacks.cpp.
References aircraft_s::acTeam, ItemCargo::add(), AlienCargo::add(), AIR_AircraftGetFromIDX(), transfer_s::aircraft, transfer_s::alienCargo, AlienCargo::AlienCargo(), base_s::alienContainment, Item::ammoDef(), transfer_s::antimatter, ANTIMATTER_ITEM_ID, B_AntimatterInBase(), B_GetCurrentSelectedBase(), B_ItemInBase(), B_ItemIsStoredInBaseStorage(), AlienCargo::cargo, cgi, Employee::chr, cgame_import_s::Cmd_Argv(), cgame_import_s::Com_GetTeamDefinitionByID(), Item::def(), transfer_s::destBase, E_Foreach, E_GetEmployeeFromChrUCN(), EMPL_SCIENTIST, EMPL_WORKER, transfer_s::employees, ERR_DROP, AlienCargo::getAlive(), Item::getAmmoLeft(), ItemCargo::getAmount(), AlienCargo::getDead(), Item::getNext(), Inventory::getNextCont(), Container::getNextItem(), Employee::getType(), objDef_s::id, base_s::idx, character_s::inv, INVSH_GetItemByID(), Employee::isHiredInBase(), objDef_s::isReloadable(), transfer_s::itemCargo, LIST_Foreach, cgame_import_s::LIST_GetPointer(), MAX_VAR, aircraft_s::pilot, Q_streq, Q_strncpyz(), Q_strstart(), TR_AircraftListSelect(), TR_Fill(), and character_s::ucn.
|
static |
Check if an aircraft should be displayed for transfer.
[in] | aircraft | Pointer to an aircraft |
Definition at line 202 of file cp_transfer_callbacks.cpp.
References AIR_IsAircraftInBase(), transfer_s::aircraft, cgi, and cgame_import_s::LIST_GetPointer().
Referenced by TR_Add_f().
Display cargo list.
Definition at line 124 of file cp_transfer_callbacks.cpp.
References _, transfer_s::aircraft, transfer_s::alienCargo, transfer_s::antimatter, ANTIMATTER_ITEM_ID, AlienCargo::cargo, cgi, CL_GetRankByIdx(), E_GetEmployeeString(), EMPL_PILOT, EMPL_ROBOT, EMPL_SCIENTIST, EMPL_SOLDIER, EMPL_WORKER, transfer_s::employees, ERR_DROP, i, objDef_s::id, INVSH_GetItemByID(), transfer_s::itemCargo, ItemCargo::list(), AlienCargo::list(), LIST_Foreach, MAX_EMPL, objDef_s::name, rank_s::shortname, and va().
Referenced by TR_Fill(), and TR_TransferListClear_f().
Clear temporary cargo arrays.
Definition at line 67 of file cp_transfer_callbacks.cpp.
References transfer_s::aircraft, transfer_s::alienCargo, transfer_s::antimatter, cgi, EMPL_SOLDIER, transfer_s::employees, i, transfer_s::itemCargo, and MAX_EMPL.
Referenced by TR_Init_f(), TR_ShutdownCallbacks(), TR_TransferClose_f(), TR_TransferListClear_f(), and TR_TransferStart_f().
|
static |
Count capacity need of aircraft in lists.
[in] | aircraftList | List to count aircraft in |
[in,out] | capacity | Capacity need array to update |
Definition at line 849 of file cp_transfer_callbacks.cpp.
References AIR_GetHangarCapacityType(), and LIST_Foreach.
Referenced by TR_DestinationCapacityList_f().
|
static |
Count capacity need of employee in array of lists.
[in] | employeeListArray | Array to count employee in |
[in,out] | capacity | Capacity need array to update |
Definition at line 837 of file cp_transfer_callbacks.cpp.
References CAP_EMPLOYEES, cgi, EMPL_ROBOT, EMPL_SOLDIER, and i.
Referenced by TR_DestinationCapacityList_f().
Callback for assemble destination base capacity list.
Definition at line 860 of file cp_transfer_callbacks.cpp.
References _, transfer_s::aircraft, transfer_s::alienCargo, transfer_s::antimatter, B_GetCapacityFromBuildingType(), B_GetFoundedBaseByIDX(), ccs_s::buildingTemplates, building_s::buildingType, CAP_ALIENS, CAP_ANTIMATTER, CAP_Get, CAP_ITEMS, CAP_LABSPACE, CAP_WORKSPACE, ccs, cgi, cgame_import_s::Cmd_Argv(), capacities_s::cur, transfer_s::employees, AlienCargo::getAlive(), i, building_s::id, transfer_s::itemCargo, capacities_s::max, MAX_CAP, building_s::name, ccs_s::numBuildingTemplates, OBJZERO, RS_IsResearched_ptr(), ItemCargo::size(), building_s::tech, TR_CountAircraftInList(), TR_CountEmployeeInListArray(), and TR_Foreach.
|
static |
Fills the items-in-base list with stuff available for transfer.
[in] | srcBase | Pointer to the base the transfer starts from |
[in] | destBase | Pointer to the base to transfer |
[in] | transferType | Transfer category |
Definition at line 367 of file cp_transfer_callbacks.cpp.
References cgi, ERR_DROP, TR_CargoList(), TR_FillAircraft(), TR_FillAliens(), TR_FillEmployees(), TR_FillItems(), TRANS_TYPE_AIRCRAFT, TRANS_TYPE_ALIEN, TRANS_TYPE_EMPLOYEE, and TRANS_TYPE_ITEM.
Referenced by TR_Add_f(), TR_Fill_f(), TR_TransferBaseSelect(), and TR_TransferListClear_f().
Callback for filling list with stuff available for transfer.
Definition at line 398 of file cp_transfer_callbacks.cpp.
References B_GetCurrentSelectedBase(), cgi, cgame_import_s::Cmd_Argv(), transfer_s::destBase, TR_Fill(), TR_GetTransferType(), TRANS_TYPE_INVALID, and type.
Add aircraft to the transfer storages list.
[in] | srcBase | Source base of the transfer |
[in] | destBase | Destination base of the transfer |
Definition at line 344 of file cp_transfer_callbacks.cpp.
References AIR_ForeachFromBase, AIR_IsAircraftInBase(), transfer_s::aircraft, cgi, and cgame_import_s::LIST_GetPointer().
Referenced by TR_Fill().
Add aliens to the transfer storages list.
[in] | srcBase | Source base of the transfer |
[in] | destBase | Destination base of the transfer |
Definition at line 309 of file cp_transfer_callbacks.cpp.
References _, transfer_s::alienCargo, base_s::alienContainment, cgi, Com_sprintf(), AlienCargo::getAlive(), AlienCargo::getDead(), AlienCargo::list(), and LIST_Foreach.
Referenced by TR_Fill().
Add employees to the transfer storages list.
[in] | srcBase | Source base of the transfer |
[in] | destBase | Destination base of the transfer |
Definition at line 252 of file cp_transfer_callbacks.cpp.
References _, cgi, CL_GetRankByIdx(), Com_sprintf(), E_CountHired(), E_Foreach, E_GetEmployeeString(), EMPL_PILOT, EMPL_ROBOT, EMPL_SCIENTIST, EMPL_SOLDIER, EMPL_WORKER, transfer_s::employees, ERR_DROP, i, cgame_import_s::LIST_GetPointer(), MAX_EMPL, and rank_s::shortname.
Referenced by TR_Fill().
Add items to the transfer storages list.
[in] | srcBase | Source base of the transfer |
[in] | destBase | Destination base of the transfer |
Definition at line 217 of file cp_transfer_callbacks.cpp.
References _, transfer_s::antimatter, ANTIMATTER_ITEM_ID, B_AntimatterInBase(), B_ItemInBase(), B_ItemIsStoredInBaseStorage(), cgi, cgame_import_s::csi, ItemCargo::getAmount(), i, objDef_s::id, INVSH_GetItemByID(), INVSH_GetItemByIDX(), transfer_s::itemCargo, objDef_s::name, and csi_s::numODs.
Referenced by TR_Fill().
|
static |
Returns the transfer type.
[in] | id | Transfer type Id |
Definition at line 112 of file cp_transfer_callbacks.cpp.
References i, Q_streq, TRANS_TYPE_INVALID, TRANS_TYPE_MAX, and transferTypeIDs.
Referenced by TR_Fill_f().
Transfer menu init function.
Definition at line 722 of file cp_transfer_callbacks.cpp.
References B_GetCurrentSelectedBase(), B_GetNext(), cgi, cgame_import_s::Cvar_Set(), transfer_s::destBase, ERR_DROP, base_s::idx, base_s::name, TR_ClearTempCargo(), TR_InitBaseList(), TR_TransferBaseSelect(), and transferTypeIDs.
Fills the optionlist with available bases to transfer to.
Definition at line 681 of file cp_transfer_callbacks.cpp.
References B_GetCurrentSelectedBase(), B_GetNext(), cgi, base_s::idx, base_s::name, OPTION_BASELIST, cgame_import_s::UI_AddOption(), and va().
Referenced by TR_Init_f().
Definition at line 935 of file cp_transfer_callbacks.cpp.
References cgi.
Referenced by TR_InitStartup().
Assembles the list of transfers for the popup.
Definition at line 766 of file cp_transfer_callbacks.cpp.
References _, ANTIMATTER_ITEM_ID, AlienCargo::cargo, ccs, cgi, CP_SecondConvert(), ccs_s::date, Date_DateToSeconds(), Date_Substract(), E_GetEmployeeString(), EMPL_SOLDIER, i, objDef_s::id, INVSH_GetItemByID(), LIST_Foreach, MAX_EMPL, objDef_s::name, TR_Foreach, TR_ForeachAircraft, TR_ForeachEmployee, and va().
Callback to select destination base.
Definition at line 700 of file cp_transfer_callbacks.cpp.
References B_GetCurrentSelectedBase(), B_GetFoundedBaseByIDX(), cgi, cgame_import_s::Cmd_Argv(), and TR_TransferBaseSelect().
Definition at line 940 of file cp_transfer_callbacks.cpp.
References cgi, and TR_ClearTempCargo().
Referenced by TR_Shutdown().
Callback for base list click.
[in] | srcbase | |
[in] | destbase | Pointer to base which will be transferBase. |
Definition at line 660 of file cp_transfer_callbacks.cpp.
References cgi, cgame_import_s::Cvar_Set(), transfer_s::destBase, base_s::idx, base_s::name, and TR_Fill().
Referenced by TR_Init_f(), and TR_SelectBase_f().
Closes Transfer Menu and resets temp arrays.
Definition at line 755 of file cp_transfer_callbacks.cpp.
References TR_ClearTempCargo(), and TR_TransferListClear_f().
Unload everything from transfer cargo back to base.
Definition at line 636 of file cp_transfer_callbacks.cpp.
References B_GetCurrentSelectedBase(), cgi, transfer_s::destBase, base_s::idx, TR_CargoList(), TR_ClearTempCargo(), and TR_Fill().
Referenced by TR_TransferClose_f().
Starts the transfer.
Definition at line 88 of file cp_transfer_callbacks.cpp.
References _, B_GetCurrentSelectedBase(), cgi, Com_sprintf(), transfer_s::destBase, MSG_TRANSFERFINISHED, MSO_CheckAddNewMessage(), base_s::name, NT_TRANSFER_STARTED, TR_ClearTempCargo(), TR_TransferStart(), and TRANS_TYPE_INVALID.
|
static |
Definition at line 62 of file cp_transfer_callbacks.cpp.
|
static |
Definition at line 60 of file cp_transfer_callbacks.cpp.
Referenced by CL_ActorVis(), CL_ParticleRun2(), CL_TargetingGrenade(), CL_TargetingStraight(), CM_CompleteBoxTrace(), CM_EntCompleteBoxTrace(), G_ShootGrenade(), G_SpawnFieldGroup(), R_Trace(), RT_CheckCell(), RT_FindOpening(), RT_FindOpeningCeilingFrac(), RT_FindOpeningFloorFrac(), RT_MicroTrace(), RT_TraceOpening(), TEST_F(), and TR_TileBoxTrace().
|
static |
Definition at line 923 of file cp_transfer_callbacks.cpp.
|
static |
transfer typeID strings
Definition at line 51 of file cp_transfer_callbacks.cpp.
Referenced by TR_GetTransferType(), and TR_Init_f().