|
UFO: Alien Invasion
|
#include "cp_transfer_callbacks.h"#include "../../DateTime.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. | |
| static void | TR_TransferStart_f (void) |
| Starts the transfer. | |
| static transferType_t | TR_GetTransferType (const char *id) |
| Returns the transfer type. | |
| static void | TR_CargoList (void) |
| Display cargo list. | |
| static bool | TR_AircraftListSelect (const aircraft_t *aircraft) |
| Check if an aircraft should be displayed for transfer. | |
| static void | TR_FillItems (const base_t *srcBase, const base_t *destBase) |
| Add items to the transfer storages list. | |
| static void | TR_FillEmployees (const base_t *srcBase, const base_t *destBase) |
| Add employees to the transfer storages list. | |
| static void | TR_FillAliens (const base_t *srcBase, const base_t *destBase) |
| Add aliens to the transfer storages list. | |
| static void | TR_FillAircraft (const base_t *srcBase, const base_t *destBase) |
| Add aircraft to the transfer storages list. | |
| 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. | |
| static void | TR_Fill_f (void) |
| Callback for filling list with stuff available for transfer. | |
| static void | TR_Add_f (void) |
| Callback handles adding/removing items to transfercargo. | |
| static void | TR_TransferListClear_f (void) |
| Unload everything from transfer cargo back to base. | |
| static void | TR_TransferBaseSelect (base_t *srcbase, base_t *destbase) |
| Callback for base list click. | |
| static void | TR_InitBaseList (void) |
| Fills the optionlist with available bases to transfer to. | |
| static void | TR_SelectBase_f (void) |
| Callback to select destination base. | |
| static void | TR_Init_f (void) |
| Transfer menu init function. | |
| static void | TR_TransferClose_f (void) |
| Closes Transfer Menu and resets temp arrays. | |
| static void | TR_List_f (void) |
| Assembles the list of transfers for the popup. | |
| static void | TR_CountEmployeeInListArray (linkedList_t *employeeListArray[], int capacity[]) |
| Count capacity need of employee in array of lists. | |
| static void | TR_CountAircraftInList (linkedList_t *aircraftList, int capacity[]) |
| Count capacity need of aircraft in lists. | |
| static void | TR_DestinationCapacityList_f (void) |
| Callback for assemble destination base capacity list. | |
| void | TR_InitCallbacks (void) |
| void | TR_ShutdownCallbacks (void) |
Variables | |
| static char const *const | transferTypeIDs [] |
| transfer typeID strings | |
| 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 39 of file cp_transfer_callbacks.cpp.
| CASSERT | ( | lengthof(transferTypeIDs) | = =TRANS_TYPE_MAX | ) |
References TRANS_TYPE_MAX, and transferTypeIDs.
Callback handles adding/removing items to transfercargo.
Definition at line 418 of file cp_transfer_callbacks.cpp.
References AIR_AircraftGetFromIDX(), base_t::alienContainment, Item::ammoDef(), ANTIMATTER_ITEM_ID, B_AntimatterInBase(), B_GetCurrentSelectedBase(), B_ItemInBase(), B_ItemIsStoredInBaseStorage(), cgi, currentTransferType, Item::def(), E_Foreach, E_GetEmployeeFromChrUCN(), EMPL_SCIENTIST, EMPL_WORKER, ERR_DROP, AlienCargo::getAlive(), Item::getAmmoLeft(), AlienCargo::getDead(), Item::getNext(), Container::getNextItem(), Employee::getType(), objDef_t::id, INVSH_GetItemByID(), Employee::isHiredInBase(), objDef_t::isReloadable(), LIST_Foreach, MAX_VAR, Q_streq, Q_strncpyz(), Q_strstart(), tr, TR_AircraftListSelect(), and TR_Fill().
|
static |
Check if an aircraft should be displayed for transfer.
| [in] | aircraft | Pointer to an aircraft |
Definition at line 203 of file cp_transfer_callbacks.cpp.
References AIR_IsAircraftInBase(), cgi, and tr.
Referenced by TR_Add_f().
Display cargo list.
Definition at line 125 of file cp_transfer_callbacks.cpp.
References _, ANTIMATTER_ITEM_ID, cgi, CL_GetRankByIdx(), E_GetEmployeeString(), EMPL_PILOT, EMPL_ROBOT, EMPL_SCIENTIST, EMPL_SOLDIER, EMPL_WORKER, ERR_DROP, i, objDef_t::id, INVSH_GetItemByID(), LIST_Foreach, MAX_EMPL, objDef_t::name, rank_t::shortname, tr, and va().
Referenced by TR_Fill(), and TR_TransferListClear_f().
Clear temporary cargo arrays.
Definition at line 68 of file cp_transfer_callbacks.cpp.
References cgi, EMPL_SOLDIER, i, MAX_EMPL, and tr.
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 _, B_GetCapacityFromBuildingType(), B_GetFoundedBaseByIDX(), building_t::buildingType, CAP_ALIENS, CAP_ANTIMATTER, CAP_Get, CAP_ITEMS, CAP_LABSPACE, CAP_WORKSPACE, ccs, cgi, capacities_t::cur, i, building_t::id, capacities_t::max, MAX_CAP, building_t::name, OBJZERO, RS_IsResearched_ptr(), building_t::tech, tr, 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 368 of file cp_transfer_callbacks.cpp.
References cgi, currentTransferType, 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 399 of file cp_transfer_callbacks.cpp.
References B_GetCurrentSelectedBase(), cgi, currentTransferType, tr, 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 345 of file cp_transfer_callbacks.cpp.
References AIR_ForeachFromBase, AIR_IsAircraftInBase(), cgi, and tr.
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 310 of file cp_transfer_callbacks.cpp.
References _, base_t::alienContainment, cgi, Com_sprintf(), AlienCargo::getAlive(), AlienCargo::getDead(), AlienCargo::list(), LIST_Foreach, and tr.
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 253 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, ERR_DROP, i, MAX_EMPL, rank_t::shortname, and tr.
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 218 of file cp_transfer_callbacks.cpp.
References _, ANTIMATTER_ITEM_ID, B_AntimatterInBase(), B_ItemInBase(), B_ItemIsStoredInBaseStorage(), cgi, i, objDef_t::id, INVSH_GetItemByID(), INVSH_GetItemByIDX(), objDef_t::name, and tr.
Referenced by TR_Fill().
|
static |
Returns the transfer type.
| [in] | id | Transfer type Id |
Definition at line 113 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 723 of file cp_transfer_callbacks.cpp.
References B_GetCurrentSelectedBase(), B_GetNext(), cgi, ERR_DROP, tr, TR_ClearTempCargo(), TR_InitBaseList(), TR_TransferBaseSelect(), and transferTypeIDs.
Fills the optionlist with available bases to transfer to.
Definition at line 682 of file cp_transfer_callbacks.cpp.
References B_GetCurrentSelectedBase(), B_GetNext(), cgi, base_t::idx, base_t::name, OPTION_BASELIST, and va().
Referenced by TR_Init_f().
Definition at line 935 of file cp_transfer_callbacks.cpp.
References cgi, and transferCallbacks.
Referenced by TR_InitStartup().
Assembles the list of transfers for the popup.
Definition at line 767 of file cp_transfer_callbacks.cpp.
References _, ANTIMATTER_ITEM_ID, ccs, cgi, CP_SecondConvert(), Date_DateToSeconds(), E_GetEmployeeString(), EMPL_SOLDIER, i, objDef_t::id, INVSH_GetItemByID(), LIST_Count(), LIST_Foreach, MAX_EMPL, objDef_t::name, ngettext, TR_Foreach, TR_ForeachAircraft, TR_ForeachEmployee, and va().
Callback to select destination base.
Definition at line 701 of file cp_transfer_callbacks.cpp.
References B_GetCurrentSelectedBase(), B_GetFoundedBaseByIDX(), cgi, and TR_TransferBaseSelect().
Definition at line 940 of file cp_transfer_callbacks.cpp.
References cgi, TR_ClearTempCargo(), and transferCallbacks.
Referenced by TR_Shutdown().
Callback for base list click.
| [in] | srcbase | |
| [in] | destbase | Pointer to base which will be transferBase. |
Definition at line 661 of file cp_transfer_callbacks.cpp.
References cgi, currentTransferType, base_t::idx, base_t::name, tr, and TR_Fill().
Referenced by TR_Init_f(), and TR_SelectBase_f().
Closes Transfer Menu and resets temp arrays.
Definition at line 756 of file cp_transfer_callbacks.cpp.
References TR_ClearTempCargo(), and TR_TransferListClear_f().
Unload everything from transfer cargo back to base.
Definition at line 637 of file cp_transfer_callbacks.cpp.
References B_GetCurrentSelectedBase(), cgi, currentTransferType, tr, TR_CargoList(), TR_ClearTempCargo(), and TR_Fill().
Referenced by TR_TransferClose_f().
Starts the transfer.
Definition at line 89 of file cp_transfer_callbacks.cpp.
References _, B_GetCurrentSelectedBase(), cgi, Com_sprintf(), currentTransferType, MSG_TRANSFERFINISHED, MSO_CheckAddNewMessage(), NT_TRANSFER_STARTED, tr, TR_ClearTempCargo(), TR_TransferStart(), and TRANS_TYPE_INVALID.
|
static |
Definition at line 63 of file cp_transfer_callbacks.cpp.
Referenced by TR_Add_f(), TR_Fill(), TR_Fill_f(), TR_TransferBaseSelect(), TR_TransferListClear_f(), and TR_TransferStart_f().
|
static |
Definition at line 61 of file cp_transfer_callbacks.cpp.
Referenced by CL_ActorVis(), CL_ParticleRun2(), CL_TargetingGrenade(), CL_TargetingStraight(), CM_CompleteBoxTrace(), CM_EntCompleteBoxTrace(), G_ShootGrenade(), G_ShootSingle(), G_SpawnFieldGroup(), G_SplashDamage(), R_Trace(), RT_CheckCell(), RT_FindOpening(), RT_FindOpeningCeilingFrac(), RT_FindOpeningFloorFrac(), RT_MicroTrace(), RT_TraceOpening(), TEST_F(), TR_Add_f(), TR_AircraftListSelect(), TR_CargoList(), TR_ClearTempCargo(), TR_DestinationCapacityList_f(), TR_Fill_f(), TR_FillAircraft(), TR_FillAliens(), TR_FillEmployees(), TR_FillItems(), TR_Init_f(), TR_TileBoxTrace(), TR_TransferBaseSelect(), TR_TransferListClear_f(), and TR_TransferStart_f().
|
static |
Definition at line 923 of file cp_transfer_callbacks.cpp.
Referenced by TR_InitCallbacks(), and TR_ShutdownCallbacks().
|
static |
transfer typeID strings
Definition at line 52 of file cp_transfer_callbacks.cpp.
Referenced by CASSERT(), TR_GetTransferType(), and TR_Init_f().