65 if (item->amount <= 0)
71 cgi->LIST_Delete(&cargo);
82 employee->transfer =
false;
112 cgi->LIST_Delete(&cargo);
148 Com_sprintf(message,
sizeof(message),
_(
"Transport mission ended, unloading cargo in %s"), destination->
name);
151 cgi->LIST_Remove(&
ccs.transfers, transfer);
165 if (!transData.
destBase || !srcBase) {
166 cgi->Com_Printf(
"TR_TransferStart: No base selected!\n");
172 if (srcBase !=
nullptr && transData.
destBase !=
nullptr) {
196 if (srcBase ==
nullptr)
201 count += item->amount;
203 cgi->LIST_Delete(&list);
208 if (employee->isAssigned())
209 employee->unassign();
212 if (aircraft &&
cgi->LIST_GetPointer(transData.
aircraft, (
const void*)aircraft) ==
nullptr) {
219 employee->transfer =
true;
220 cgi->LIST_AddPointer(&transfer.
employees[
i], (
void*) employee);
234 count += item->alive;
237 cgi->LIST_Delete(&list);
244 aircraft->homebase = transData.
destBase;
247 if (aircraft->pilot !=
nullptr &&
cgi->LIST_GetPointer(transfer.
employees[aircraft->pilot->getType()], (
void*)aircraft->pilot) ==
nullptr)
251 if (
cgi->LIST_GetPointer(transfer.
employees[employee->getType()], (
void*)employee) ==
nullptr)
255 cgi->LIST_AddPointer(&transfer.
aircraft, (
void*)aircraft);
291 if (
cgi->LIST_Remove(&transfer->aircraft, aircraft))
303 if (transfer->event <=
ccs.date) {
304 assert(transfer->destBase);
315static void TR_ListTransfers_f (
void)
320 if (
cgi->Cmd_Argc() == 2) {
321 transIdx = atoi(
cgi->Cmd_Argv(1));
322 if (transIdx < 0 || transIdx >
cgi->LIST_Count(
ccs.transfers)) {
323 cgi->Com_Printf(
"Usage: %s [transferIDX]\nWithout parameter it lists all.\n",
cgi->Cmd_Argv(0));
332 if (transIdx >= 0 &&
i != transIdx)
338 cgi->Com_Printf(
"Transfer #%d\n",
i);
339 cgi->Com_Printf(
"...From %d (%s) To %d (%s) Arrival: %04i-%02i-%02i %02i:%02i:%02i\n",
340 (transfer->srcBase) ? transfer->srcBase->idx : -1,
341 (transfer->srcBase) ? transfer->srcBase->name :
"(null)",
342 (transfer->destBase) ? transfer->destBase->idx : -1,
343 (transfer->destBase) ? transfer->destBase->name :
"(null)",
347 if (transfer->antimatter > 0)
348 cgi->Com_Printf(
"......Antimatter amount: %i\n", transfer->antimatter);
350 if (transfer->alienCargo !=
nullptr) {
351 cgi->Com_Printf(
"...ItemCargo:\n");
354 cgi->Com_Printf(
"......%s amount: %i\n", item->objDef->id, item->amount);
356 cgi->LIST_Delete(&cargo);
359 if (transfer->hasEmployees) {
362 cgi->Com_Printf(
"...Carried Employee:\n");
366 if (employee->getUGV()) {
368 cgi->Com_Printf(
"......ugv: %s [ucn: %i]\n", employee->getUGV()->id, employee->chr.ucn);
370 cgi->Com_Printf(
"......%s (%s) / %s [ucn: %i]\n", employee->chr.name,
372 (employee->getNation()) ? employee->getNation()->id :
"(nonation)",
374 if (!employee->isHired())
375 cgi->Com_Printf(
"Warning: employee^ not hired!\n");
376 if (!employee->transfer)
377 cgi->Com_Printf(
"Warning: employee^ not marked as being transferred!\n");
383 if (transfer->alienCargo !=
nullptr) {
384 cgi->Com_Printf(
"...AlienCargo:\n");
387 cgi->Com_Printf(
"......%s alive: %i dead: %i\n", item->teamDef->id, item->alive, item->dead);
389 cgi->LIST_Delete(&cargo);
392 if (!
cgi->LIST_IsEmpty(transfer->aircraft)) {
393 cgi->Com_Printf(
"...Transfered Aircraft:\n");
395 cgi->Com_Printf(
"......%s [idx: %i]\n", aircraft->id, aircraft->idx);
419 if (!transfer->destBase) {
420 cgi->Com_Printf(
"Could not save transfer, no destBase is set\n");
426 if (transfer->srcBase)
429 if (transfer->antimatter > 0) {
436 if (transfer->itemCargo !=
nullptr) {
440 transfer->itemCargo->save(itemNode);
443 if (transfer->alienCargo !=
nullptr) {
447 transfer->alienCargo->save(alienNode);
450 if (transfer->hasEmployees) {
491 cgi->Com_Printf(
"Error: Transfer has no destBase set\n");
512 cgi->Com_Error(
ERR_DROP,
"TR_LoadXML: Cannot create ItemCargo object\n");
531 cgi->Com_Error(
ERR_DROP,
"TR_LoadXML: Cannot create AlienCargo object\n");
543 cgi->Com_Printf(
"Error: No employee found with UCN: %i\n", ucn);
557 cgi->LIST_AddPointer(&transfer.
aircraft, (
void*)aircraft);
573 cgi->Cmd_AddCommand(
"debug_listtransfers", TR_ListTransfers_f,
"Lists an/all active transfer(s)");
583 if (transfer->itemCargo !=
nullptr) {
584 delete transfer->itemCargo;
585 transfer->itemCargo =
nullptr;
587 if (transfer->alienCargo !=
nullptr) {
588 delete transfer->alienCargo;
589 transfer->alienCargo =
nullptr;
591 cgi->LIST_Delete(&transfer->aircraft);
593 cgi->LIST_Delete(&transfer->employees[
i]);
596 cgi->LIST_Delete(&
ccs.transfers);
600 cgi->Cmd_RemoveCommand(
"debug_listtransfers");
DateTime class definition.
Alien cargo class header.
Alien containment class header.
CGAME_HARD_LINKED_FUNCTIONS linkedList_t * LIST_Add(linkedList_t **listDest, void const *data, size_t length)
Share stuff between the different cgame implementations.
linkedList_t * list(void) const
Returns a copy of the cargo list.
bool load(xmlNode_t *root)
Load alien cargo from xml savegame.
virtual bool add(const teamDef_t *team, int alive, int dead)
Add aliens to the containment by teamDef.
Class describing a point of time.
static const int SECONDS_PER_DAY
employeeType_t getType() const
bool load(xmlNode_t *root)
Load item cargo from xml savegame.
linkedList_t * list(void) const
Returns a copy of the cargo list.
virtual bool add(const objDef_t *od, int amount, int looseAmount)
Add items to the cargo.
void AIR_DeleteAircraft(aircraft_t *aircraft)
Removes an aircraft from its base and the game.
bool AIR_RemoveEmployee(Employee *employee, aircraft_t *aircraft)
Removes a soldier from an aircraft.
void AIR_AutoAddPilotToAircraft(const base_t *base, Employee *pilot)
Adds the pilot to the first available aircraft at the specified base.
baseCapacities_t AIR_GetHangarCapacityType(const aircraft_t *aircraft)
Returns capacity type needed for an aircraft.
aircraft_t * AIR_GetFirstFromBase(const base_t *b)
Iterates through the aircraft of a base.
const aircraft_t * AIR_IsEmployeeInAircraft(const Employee *employee, const aircraft_t *aircraft)
Tells you if an employee is assigned to an aircraft.
aircraft_t * AIR_AircraftGetFromIDX(int aircraftIdx)
Returns aircraft for a given global index.
bool B_ItemIsStoredInBaseStorage(const objDef_t *obj)
Check if an item is stored in storage.
int B_AddAntimatter(base_t *base, int amount)
Manages antimatter (adding, removing) through Antimatter Storage Facility.
base_t * B_GetBaseByIDX(int baseIdx)
Array bound check for the base index. Will also return unfounded bases as long as the index is in the...
int B_AddToStorage(base_t *base, const objDef_t *obj, int amount)
Add/remove items to/from the storage.
bool B_GetBuildingStatus(const base_t *const base, const buildingType_t buildingType)
Get the status associated to a building.
bool PR_ProductionAllowed(const base_t *base)
Returns true if the current base is able to produce items.
#define B_AtLeastOneExists()
bool RS_ResearchAllowed(const base_t *base)
Returns true if the current base is able to handle research.
Header file for single player campaign control.
const cgame_import_t * cgi
void CAP_AddCurrent(base_t *base, baseCapacities_t capacity, int value)
Changes the current (used) capacity on a base.
baseCapacities_t
All possible capacities in base.
bool E_DeleteEmployee(Employee *employee)
Removes the employee completely from the game (buildings + global list).
Employee * E_GetEmployeeFromChrUCN(int uniqueCharacterNumber)
Searches all employee for the ucn (character id).
bool E_MoveIntoNewBase(Employee *employee, base_t *newBase)
const char * E_GetEmployeeString(employeeType_t type, int n)
Convert employeeType_t to translated string.
employeeType_t
The types of employees.
uiMessageListNodeMessage_t * MSO_CheckAddNewMessage(const notify_t messagecategory, const char *title, const char *text, messageType_t type, technology_t *pedia, bool popup)
Adds a new message to message stack. It uses message settings to verify whether sound should be playe...
@ NT_TRANSFER_COMPLETED_SUCCESS
char cp_messageBuffer[MAX_MESSAGE_TEXT]
void PR_UpdateProductionCap(base_t *base, int workerChange)
Update the current capacity of Workshop.
void CP_DateConvertLong(const DateTime &date, dateLong_t *dateLong)
Converts a date from the engine in a (longer) human-readable format.
Campaign geoscape time header.
static void TR_TransferEnd(transfer_t *transfer)
Ends the transfer.
bool TR_SaveXML(xmlNode_t *p)
Save callback for xml savegames.
void TR_InitStartup(void)
Defines commands and cvars for the Transfer menu(s).
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.
transfer_t * TR_TransferStart(base_t *srcBase, transfer_t &transData)
Starts a transfer.
bool TR_LoadXML(xmlNode_t *p)
Load callback for xml savegames.
void TR_TransferRun(void)
Checks whether given transfer should be processed.
void TR_Shutdown(void)
Closing actions for transfer-subsystem.
void TR_NotifyAircraftRemoved(const aircraft_t *aircraft)
Notify that an aircraft has been removed.
#define TR_ForeachEmployee(var, transfer, employeeType)
#define DEFAULT_TRANSFER_TIME
Default transfer time for cases with no source/dest base.
#define TR_ForeachAircraft(var, transfer)
void TR_InitCallbacks(void)
void TR_ShutdownCallbacks(void)
Header file for menu related console command callbacks.
#define LIST_Foreach(list, type, var)
Iterates over a linked list, it's safe to delete the returned entry from the list while looping over ...
double GetDistanceOnGlobe(const vec2_t pos1, const vec2_t pos2)
Calculate distance on the geoscape.
QGL_EXTERN GLint GLenum type
XML tag constants for savegame.
#define SAVE_TRANSFER_ITEMCARGO
#define SAVE_TRANSFER_AIRCRAFT
#define SAVE_TRANSFER_TRANSFERS
#define SAVE_TRANSFER_DESTBASE
#define SAVE_TRANSFER_SEC
#define SAVE_TRANSFER_SRCBASE
#define SAVE_TRANSFER_ITEMID
#define SAVE_TRANSFER_ANTIMATTER
#define SAVE_TRANSFER_TRANSFER
#define SAVE_TRANSFER_ITEM
#define SAVE_TRANSFER_EMPLOYEE
#define SAVE_TRANSFER_AMOUNT
#define SAVE_TRANSFER_ANTIMATTER_AMOUNT
#define SAVE_TRANSFER_UCN
#define SAVE_TRANSFER_ALIENCARGO
#define SAVE_TRANSFER_DAY
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
An aircraft with all it's data.
A base with all it's data.
aircraft_t * aircraftCurrent
class AlienContainment * alienContainment
Human readable time information in the game.
Transfer information (they are being stored in ccs.transfers).
class AlienCargo * alienCargo
class ItemCargo * itemCargo
linkedList_t * employees[MAX_EMPL]
#define VectorCopy(src, dest)