Deals with the Transfer stuff. More...
#include "../cl_shared.h"
#include "cp_campaign.h"
#include "save/save_transfer.h"
#include "cp_transfer_callbacks.h"
#include "../ui/ui_main.h"
Go to the source code of this file.
Functions | |
transfer_t * | TR_GetNext (transfer_t *lastTransfer) |
Iterates through transfers. | |
static void | TR_EmptyTransferCargo (base_t *destination, transfer_t *transfer, qboolean success) |
Unloads transfer cargo when finishing the transfer or destroys it when no buildings/base. | |
void | TR_TransferAlienAfterMissionStart (const base_t *base, aircraft_t *transferAircraft) |
Starts alien bodies transfer between mission and base. | |
static void | TR_TransferEnd (transfer_t *transfer) |
Ends the transfer. | |
void | TR_TransferStart (base_t *srcBase, struct transferData_s *transData) |
Starts a transfer. | |
void | TR_NotifyAircraftRemoved (const aircraft_t *aircraft) |
Notify that an aircraft has been removed. | |
void | TR_TransferCheck (void) |
Checks whether given transfer should be processed. | |
qboolean | TR_SaveXML (mxml_node_t *p) |
Save callback for xml savegames. | |
qboolean | TR_LoadXML (mxml_node_t *p) |
Load callback for xml savegames. | |
void | TR_InitStartup (void) |
Defines commands and cvars for the Transfer menu(s). |
Deals with the Transfer stuff.
Definition in file cp_transfer.c.
static void TR_EmptyTransferCargo | ( | base_t * | destination, | |
transfer_t * | transfer, | |||
qboolean | success | |||
) | [static] |
Unloads transfer cargo when finishing the transfer or destroys it when no buildings/base.
[in,out] | destination | The destination base - might be NULL in case the base is already destroyed |
[in] | transfer | Pointer to transfer in ccs.transfers. |
[in] | success | True if the transfer reaches dest base, false if the base got destroyed. |
Definition at line 68 of file cp_transfer.c.
References _, AIR_AircraftGetFromIDX(), AIR_CalculateHangarStorage(), AIR_DeleteAircraft(), AIR_MoveAircraftIntoNewHomebase(), transfer_s::aircraftArray, AL_ChangeAliveAlienNumber(), transfer_s::alienAmount, base_s::alienscont, aliensCont_s::amountDead, ANTIMATTER_TECH_ID, B_ALIEN_CONTAINMENT, B_ANTIMATTER, B_GetBuildingStatus(), B_ItemIsStoredInBaseStorage(), B_ManageAntimatter(), B_QUARTERS, B_STORAGE, B_UpdateStorageAndCapacity(), employee_s::baseHired, ccs, Com_sprintf(), cp_messageBuffer, csi, E_HireEmployee(), E_UnhireEmployee(), transfer_s::employeeArray, transfer_s::hasAircraft, transfer_s::hasAliens, transfer_s::hasEmployees, transfer_s::hasItems, i, objDef_s::idx, INVSH_GetItemByID(), INVSH_GetItemByIDX(), transfer_s::itemAmount, MAX_EMPL, MSG_TRANSFERFINISHED, MSO_CheckAddNewMessage(), base_s::name, NT_TRANSFER_LOST, ccs_s::numAircraft, ccs_s::numAliensTD, ccs_s::numEmployees, csi_s::numODs, qfalse, qtrue, transfer_s::srcBase, aircraft_s::tpl, TRANS_ALIEN_ALIVE, TRANS_ALIEN_DEAD, TRANS_LIST_EMPTY_SLOT, and employee_s::transfer.
Referenced by TR_TransferEnd().
transfer_t* TR_GetNext | ( | transfer_t * | lastTransfer | ) |
Iterates through transfers.
[in] | lastTransfer | Pointer of the transfer to iterate from. call with NULL to get the first one. |
Definition at line 38 of file cp_transfer.c.
References ccs, ccs_s::numTransfers, and ccs_s::transfers.
Referenced by TR_NotifyAircraftRemoved(), TR_SaveXML(), and TR_TransferCheck().
void TR_InitStartup | ( | void | ) |
Defines commands and cvars for the Transfer menu(s).
Definition at line 756 of file cp_transfer.c.
References Cmd_AddCommand().
Referenced by CP_InitStartup().
qboolean TR_LoadXML | ( | mxml_node_t * | p | ) |
Load callback for xml savegames.
[in] | p | XML Node structure, where we get the information from |
Definition at line 646 of file cp_transfer.c.
References transfer_s::active, transfer_s::aircraftArray, transfer_s::alienAmount, ccs_s::alienTeams, B_GetBaseByIDX(), BYTES_NONE, ccs, Com_Printf(), date_s::day, transfer_s::destBase, E_GetEmployeeFromChrUCN(), transfer_s::employeeArray, transfer_s::event, transfer_s::hasAircraft, transfer_s::hasAliens, transfer_s::hasEmployees, transfer_s::hasItems, teamDef_s::id, employee_s::idx, objDef_s::idx, INVSH_GetItemByID(), transfer_s::itemAmount, mxml_GetInt(), mxml_GetNextNode(), mxml_GetNode(), mxml_GetString(), ccs_s::numAircraft, ccs_s::numAliensTD, ccs_s::numBases, ccs_s::numTransfers, qfalse, qtrue, SAVE_TRANSFER_AIRCRAFT, SAVE_TRANSFER_ALIEN, SAVE_TRANSFER_ALIENID, SAVE_TRANSFER_ALIVEAMOUNT, SAVE_TRANSFER_AMOUNT, SAVE_TRANSFER_DAY, SAVE_TRANSFER_DEADAMOUNT, SAVE_TRANSFER_DESTBASE, SAVE_TRANSFER_EMPLOYEE, SAVE_TRANSFER_ID, SAVE_TRANSFER_ITEM, SAVE_TRANSFER_ITEMID, SAVE_TRANSFER_SEC, SAVE_TRANSFER_SRCBASE, SAVE_TRANSFER_TRANSFER, SAVE_TRANSFER_TRANSFERS, SAVE_TRANSFER_UCN, date_s::sec, transfer_s::srcBase, TRANS_ALIEN_ALIVE, TRANS_ALIEN_DEAD, TRANS_LIST_EMPTY_SLOT, employee_s::transfer, ccs_s::transfers, and employee_s::type.
Referenced by SAV_Init().
void TR_NotifyAircraftRemoved | ( | const aircraft_t * | aircraft | ) |
Notify that an aircraft has been removed.
[in] | aircraft | Aircraft that was removed from the game |
Definition at line 418 of file cp_transfer.c.
References transfer_s::active, transfer_s::aircraftArray, ccs, transfer_s::hasAircraft, aircraft_s::idx, MAX_AIRCRAFT, ccs_s::numAircraft, REMOVE_ELEM_MEMSET, TR_GetNext(), and TRANS_LIST_EMPTY_SLOT.
Referenced by AIR_DeleteAircraft().
qboolean TR_SaveXML | ( | mxml_node_t * | p | ) |
Save callback for xml savegames.
[out] | p | XML Node structure, where we write the information to |
Definition at line 563 of file cp_transfer.c.
References transfer_s::aircraftArray, transfer_s::alienAmount, ccs_s::alienTeams, ccs, employee_s::chr, Com_Printf(), date_s::day, transfer_s::destBase, transfer_s::employeeArray, transfer_s::event, transfer_s::hasAircraft, transfer_s::hasAliens, transfer_s::hasEmployees, transfer_s::hasItems, teamDef_s::id, objDef_s::id, base_s::idx, INVSH_GetItemByIDX(), transfer_s::itemAmount, MAX_OBJDEFS, mxml_AddInt(), mxml_AddIntValue(), mxml_AddNode(), mxml_AddString(), ccs_s::numAircraft, ccs_s::numAliensTD, qfalse, qtrue, SAVE_TRANSFER_AIRCRAFT, SAVE_TRANSFER_ALIEN, SAVE_TRANSFER_ALIENID, SAVE_TRANSFER_ALIVEAMOUNT, SAVE_TRANSFER_AMOUNT, SAVE_TRANSFER_DAY, SAVE_TRANSFER_DEADAMOUNT, SAVE_TRANSFER_DESTBASE, SAVE_TRANSFER_EMPLOYEE, SAVE_TRANSFER_ID, SAVE_TRANSFER_ITEM, SAVE_TRANSFER_ITEMID, SAVE_TRANSFER_SEC, SAVE_TRANSFER_SRCBASE, SAVE_TRANSFER_TRANSFER, SAVE_TRANSFER_TRANSFERS, SAVE_TRANSFER_UCN, date_s::sec, transfer_s::srcBase, TR_GetNext(), TRANS_ALIEN_ALIVE, TRANS_ALIEN_DEAD, TRANS_LIST_EMPTY_SLOT, and character_s::ucn.
Referenced by SAV_Init().
void TR_TransferAlienAfterMissionStart | ( | const base_t * | base, | |
aircraft_t * | transferAircraft | |||
) |
Starts alien bodies transfer between mission and base.
[in] | base | Pointer to the base to send the alien bodies. |
Definition at line 191 of file cp_transfer.c.
References _, transfer_s::active, AL_GetAircraftAlienCargo, AL_GetAircraftAlienCargoTypes, AL_SetAircraftAlienCargoTypes, transfer_s::alienAmount, base_s::alienscont, aliensTmp_s::amountAlive, aliensTmp_s::amountDead, B_GetFoundedBaseByIDX(), BREATHINGAPPARATUS_TECH, ccs, CHRSH_IsTeamDefAlien(), Com_DPrintf(), Com_Error(), Com_Printf(), Com_sprintf(), csi, ccs_s::date, date_s::day, DEBUG_CLIENT, transfer_s::destBase, ERR_DROP, transfer_s::event, GetDistanceOnGlobe(), transfer_s::hasAliens, transfer_s::hasItems, i, objDef_s::idx, base_s::idx, INVSH_GetItemByID(), transfer_s::itemAmount, MAX_TRANSFERS, MSG_TRANSFERFINISHED, MSO_CheckAddNewMessage(), base_s::name, NT_TRANSFER_ALIENBODIES_DEFERED, ccs_s::numAliensTD, ccs_s::numTransfers, aircraft_s::pos, base_s::pos, technology_s::provides, qfalse, qtrue, RS_GetTechByID(), RS_IsResearched_ptr(), date_s::sec, SECONDS_PER_DAY, transfer_s::srcBase, aliensTmp_s::teamDef, aliensCont_s::teamDef, csi_s::teamDef, TRANS_ALIEN_ALIVE, TRANS_ALIEN_DEAD, ccs_s::transfers, and UI_PopWindow().
Referenced by TR_TransferBaseListClick_f().
void TR_TransferCheck | ( | void | ) |
Checks whether given transfer should be processed.
Definition at line 438 of file cp_transfer.c.
References transfer_s::active, ccs, ccs_s::date, date_s::day, transfer_s::destBase, transfer_s::event, ccs_s::numTransfers, REMOVE_ELEM, date_s::sec, TR_GetNext(), TR_TransferEnd(), and ccs_s::transfers.
Referenced by CL_CampaignRun().
static void TR_TransferEnd | ( | transfer_t * | transfer | ) | [static] |
Ends the transfer.
[in] | transfer | Pointer to transfer in ccs.transfers |
Definition at line 290 of file cp_transfer.c.
References _, transfer_s::active, Com_sprintf(), transfer_s::destBase, base_s::founded, MSG_TRANSFERFINISHED, MSO_CheckAddNewMessage(), base_s::name, NT_TRANSFER_COMPLETED_SUCCESS, NT_TRANSFER_LOST, qfalse, qtrue, and TR_EmptyTransferCargo().
Referenced by TR_TransferCheck().
void TR_TransferStart | ( | base_t * | srcBase, | |
struct transferData_s * | transData | |||
) |
Starts a transfer.
[in] | srcBase | start transfer from this base |
[in] | transData | Container holds transfer details |
Definition at line 313 of file cp_transfer.c.
References transfer_s::active, AIR_AircraftGetFromIDX(), AIR_RemoveEmployees(), AIR_TRANSFER, transfer_s::aircraftArray, transfer_s::alienAmount, employee_s::baseHired, ccs, CHRSH_IsTeamDefAlien(), Com_DPrintf(), Com_Error(), Com_Printf(), csi, ccs_s::date, date_s::day, DEBUG_CLIENT, transfer_s::destBase, E_IsInBase(), E_ResetEmployee(), transfer_s::employeeArray, ERR_DROP, transfer_s::event, GetDistanceOnGlobe(), transfer_s::hasAircraft, transfer_s::hasAliens, transfer_s::hasEmployees, transfer_s::hasItems, i, transfer_s::itemAmount, MAX_EMPL, MAX_TRANSFERS, ccs_s::numAircraft, ccs_s::numAliensTD, ccs_s::numEmployees, csi_s::numODs, ccs_s::numTransfers, base_s::pos, PR_ProductionAllowed(), qtrue, RS_ResearchAllowed(), date_s::sec, SECONDS_PER_DAY, transfer_s::srcBase, aircraft_s::status, csi_s::teamDef, transferData_s::trAircraftsTmp, transferData_s::trAliensTmp, TRANS_ALIEN_ALIVE, TRANS_ALIEN_DEAD, TRANS_LIST_EMPTY_SLOT, employee_s::transfer, transferData_s::transferBase, ccs_s::transfers, transferData_s::trCargoCountTmp, transferData_s::trEmployeesTmp, and transferData_s::trItemsTmp.
Referenced by TR_TransferStart_f().