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

Deals with the Transfer stuff. More...

#include "../../cl_shared.h"
#include "cp_campaign.h"
#include "cp_capacity.h"
#include "cp_time.h"
#include "save/save_transfer.h"
#include "cp_transfer_callbacks.h"
#include "aliencargo.h"
#include "aliencontainment.h"
#include "itemcargo.h"

Go to the source code of this file.

Functions

static void TR_EmptyTransferCargo (base_t *destination, transfer_t *transfer, bool success)
 Unloads transfer cargo when finishing the transfer or destroys it when no buildings/base. More...
 
static void TR_TransferEnd (transfer_t *transfer)
 Ends the transfer. More...
 
transfer_tTR_TransferStart (base_t *srcBase, transfer_t &transData)
 Starts a transfer. More...
 
void TR_NotifyAircraftRemoved (const aircraft_t *aircraft)
 Notify that an aircraft has been removed. More...
 
void TR_TransferRun (void)
 Checks whether given transfer should be processed. More...
 
bool TR_SaveXML (xmlNode_t *p)
 Save callback for xml savegames. More...
 
bool TR_LoadXML (xmlNode_t *p)
 Load callback for xml savegames. More...
 
void TR_InitStartup (void)
 Defines commands and cvars for the Transfer menu(s). More...
 
void TR_Shutdown (void)
 Closing actions for transfer-subsystem. More...
 

Detailed Description

Deals with the Transfer stuff.

Note
Transfer menu functions prefix: TR_
Todo:
Remove direct access to nodes

Definition in file cp_transfer.cpp.

Function Documentation

static void TR_EmptyTransferCargo ( base_t destination,
transfer_t transfer,
bool  success 
)
static

Unloads transfer cargo when finishing the transfer or destroys it when no buildings/base.

Parameters
[in,out]destinationThe destination base - might be nullptr in case the base is already destroyed
[in]transferPointer to transfer in ccs.transfers.
[in]successTrue if the transfer reaches dest base, false if the base got destroyed.
See also
TR_TransferEnd

Definition at line 45 of file cp_transfer.cpp.

References _, AlienContainment::add(), AIR_AutoAddPilotToAircraft(), AIR_DeleteAircraft(), AIR_HOME, transfer_s::aircraft, base_s::aircraftCurrent, transfer_s::alienCargo, base_s::alienContainment, transfer_s::antimatter, B_AddAntimatter(), B_AddToStorage(), B_ANTIMATTER, B_GetBuildingStatus(), B_ItemIsStoredInBaseStorage(), cgi, Com_sprintf(), cp_messageBuffer, E_DeleteEmployee(), EMPL_PILOT, EMPL_SOLDIER, EMPL_WORKER, transfer_s::hasEmployees, i, transfer_s::itemCargo, ItemCargo::list(), AlienCargo::list(), LIST_Foreach, MAX_EMPL, MSG_TRANSFERFINISHED, MSO_CheckAddNewMessage(), base_s::name, NT_TRANSFER_LOST, base_s::pos, PR_UpdateProductionCap(), transfer_s::srcBase, TR_ForeachAircraft, TR_ForeachEmployee, type, and VectorCopy.

Referenced by TR_TransferEnd().

void TR_InitStartup ( void  )

Defines commands and cvars for the Transfer menu(s).

See also
UI_InitStartup

Definition at line 567 of file cp_transfer.cpp.

References cgi, and TR_InitCallbacks().

Referenced by CP_InitStartup().

void TR_NotifyAircraftRemoved ( const aircraft_t aircraft)

Notify that an aircraft has been removed.

Parameters
[in]aircraftAircraft that was removed from the game
See also
AIR_DeleteAircraft

Definition at line 291 of file cp_transfer.cpp.

References cgi, and TR_Foreach.

Referenced by AIR_DeleteAircraft().

void TR_Shutdown ( void  )

Closing actions for transfer-subsystem.

Definition at line 578 of file cp_transfer.cpp.

References ccs, cgi, EMPL_SOLDIER, MAX_EMPL, TR_Foreach, TR_ShutdownCallbacks(), and ccs_s::transfers.

Referenced by CP_Shutdown().

static void TR_TransferEnd ( transfer_t transfer)
static

Ends the transfer.

Parameters
[in]transferPointer to transfer in ccs.transfers
Todo:
what if source base is lost? we won't be able to unhire transferred employees.

Definition at line 135 of file cp_transfer.cpp.

References _, ccs, cgi, Com_sprintf(), transfer_s::destBase, base_s::founded, MSG_TRANSFERFINISHED, MSO_CheckAddNewMessage(), base_s::name, NT_TRANSFER_COMPLETED_SUCCESS, NT_TRANSFER_LOST, TR_EmptyTransferCargo(), and ccs_s::transfers.

Referenced by TR_TransferRun().

void TR_TransferRun ( void  )

Checks whether given transfer should be processed.

See also
CP_CampaignRun

Definition at line 306 of file cp_transfer.cpp.

References Date_IsDue(), TR_Foreach, and TR_TransferEnd().

Referenced by CP_CampaignRun(), and TEST_F().