UFO: Alien Invasion
Loading...
Searching...
No Matches
cp_transfer.cpp File Reference

Deals with the Transfer stuff. More...

#include "../../DateTime.h"
#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"
Include dependency graph for cp_transfer.cpp:

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.
static void TR_TransferEnd (transfer_t *transfer)
 Ends the transfer.
transfer_tTR_TransferStart (base_t *srcBase, transfer_t &transData)
 Starts a transfer.
void TR_NotifyAircraftRemoved (const aircraft_t *aircraft)
 Notify that an aircraft has been removed.
void TR_TransferRun (void)
 Checks whether given transfer should be processed.
bool TR_SaveXML (xmlNode_t *p)
 Save callback for xml savegames.
bool TR_LoadXML (xmlNode_t *p)
 Load callback for xml savegames.
void TR_InitStartup (void)
 Defines commands and cvars for the Transfer menu(s).
void TR_Shutdown (void)
 Closing actions for transfer-subsystem.

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

◆ TR_EmptyTransferCargo()

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 46 of file cp_transfer.cpp.

References _, AlienContainment::add(), AIR_AutoAddPilotToAircraft(), AIR_DeleteAircraft(), AIR_HOME, transfer_t::aircraft, base_t::aircraftCurrent, transfer_t::alienCargo, base_t::alienContainment, transfer_t::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_t::hasEmployees, i, transfer_t::itemCargo, AlienCargo::list(), ItemCargo::list(), LIST_Foreach, MAX_EMPL, MSG_TRANSFERFINISHED, MSO_CheckAddNewMessage(), base_t::name, NT_TRANSFER_LOST, base_t::pos, PR_UpdateProductionCap(), transfer_t::srcBase, TR_ForeachAircraft, TR_ForeachEmployee, type, and VectorCopy.

Referenced by TR_TransferEnd().

◆ TR_InitStartup()

void TR_InitStartup ( void )

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

See also
UI_InitStartup

Definition at line 569 of file cp_transfer.cpp.

References cgi, and TR_InitCallbacks().

Referenced by CP_InitStartup().

◆ TR_LoadXML()

◆ TR_NotifyAircraftRemoved()

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 285 of file cp_transfer.cpp.

References cgi, and TR_Foreach.

Referenced by AIR_DeleteAircraft().

◆ TR_SaveXML()

◆ TR_Shutdown()

void TR_Shutdown ( void )

Closing actions for transfer-subsystem.

Definition at line 580 of file cp_transfer.cpp.

References ccs, cgi, EMPL_SOLDIER, i, MAX_EMPL, TR_Foreach, and TR_ShutdownCallbacks().

Referenced by CP_Shutdown().

◆ TR_TransferEnd()

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 136 of file cp_transfer.cpp.

References _, ccs, cgi, Com_sprintf(), transfer_t::destBase, base_t::founded, MSG_TRANSFERFINISHED, MSO_CheckAddNewMessage(), base_t::name, NT_TRANSFER_COMPLETED_SUCCESS, NT_TRANSFER_LOST, and TR_EmptyTransferCargo().

Referenced by TR_TransferRun().

◆ TR_TransferRun()

void TR_TransferRun ( void )

Checks whether given transfer should be processed.

See also
CP_CampaignRun

Definition at line 300 of file cp_transfer.cpp.

References ccs, TR_Foreach, and TR_TransferEnd().

Referenced by CP_CampaignRun(), and TEST_F().

◆ TR_TransferStart()