|
UFO: Alien Invasion
|
Header file for aircraft stuff. More...


Go to the source code of this file.
Data Structures | |
| struct | mapline_t |
| A path on the map described by 2D points. More... | |
| struct | aircraftSlot_t |
| slot of aircraft More... | |
| struct | aircraft_t |
| An aircraft with all it's data. More... | |
Macros | |
| #define | MAX_AIRCRAFT 64 |
| #define | LINE_MAXSEG 64 |
| #define | LINE_MAXPTS (LINE_MAXSEG + 2) |
| #define | AIRCRAFT_REFUEL_FACTOR 16 |
| #define | MAX_AIRCRAFTSLOT 8 |
| #define | AIR_Foreach(var) |
| iterates trough all aircraft | |
| #define | AIR_IsAircraftOfBase(aircraft, base) |
| #define | AIR_ForeachFromBase(var, base) |
| iterates trough all aircraft from a specific homebase | |
| #define | AIR_IsUFO(aircraft) |
Enumerations | |
| enum | itemWeight_t { ITEM_LIGHT , ITEM_MEDIUM , ITEM_HEAVY } |
| different weight for aircraft items More... | |
| enum | itemPos_t { AIR_NOSE_LEFT , AIR_NOSE_CENTER , AIR_NOSE_RIGHT , AIR_WING_LEFT , AIR_WING_RIGHT , AIR_REAR_LEFT , AIR_REAR_CENTER , AIR_REAR_RIGHT , AIR_POSITIONS_MAX } |
| different positions for aircraft items More... | |
| enum | aircraft_notifications_t { AIR_CANNOT_REFUEL , MAX_AIR_NOTIFICATIONS } |
| notification signals for aircraft events More... | |
| enum | aircraftStatus_t { AIR_NONE , AIR_REFUEL , AIR_HOME , AIR_IDLE , AIR_TRANSIT , AIR_MISSION , AIR_UFO , AIR_DROP , AIR_INTERCEPT , AIR_TRANSFER , AIR_CRASHED , AIR_RETURNING } |
Functions | |
| aircraft_t * | AIR_NewAircraft (struct base_s *base, const aircraft_t *aircraftTemplate) |
| aircraft_t * | AIR_Add (struct base_s *base, const aircraft_t *aircraftTemplate) |
| bool | AIR_Delete (struct base_s *base, aircraft_t *aircraft) |
| void | AIR_DeleteAircraft (aircraft_t *aircraft) |
| Removes an aircraft from its base and the game. | |
| void | AIR_DestroyAircraft (aircraft_t *aircraft, bool killPilot=true) |
| Removes an aircraft from its base and the game. | |
| const aircraft_t * | AIR_GetAircraftSilent (const char *name) |
| Searches the global array of aircraft types for a given aircraft. | |
| const aircraft_t * | AIR_GetAircraft (const char *name) |
| Searches the global array of aircraft types for a given aircraft. | |
| aircraft_t * | AIR_GetFirstFromBase (const struct base_s *base) |
| bool | AIR_BaseHasAircraft (const struct base_s *base) |
| int | AIR_BaseCountAircraft (const struct base_s *base) |
| aircraft_t * | AIR_GetAircraftFromBaseByIDXSafe (const struct base_s *base, int index) |
| aircraft_t * | AIR_AircraftGetFromIDX (int idx) |
| Returns aircraft for a given global index. | |
| const char * | AIR_AircraftStatusToName (const aircraft_t *aircraft) |
| Translates the aircraft status id to a translatable string. | |
| bool | AIR_IsAircraftInBase (const aircraft_t *aircraft) |
| Checks whether given aircraft is in its homebase. | |
| bool | AIR_IsAircraftOnGeoscape (const aircraft_t *aircraft) |
| Checks whether given aircraft is on geoscape. | |
| void | AIR_ResetAircraftTeam (aircraft_t *aircraft) |
| Resets team in given aircraft. | |
| bool | AIR_AddToAircraftTeam (aircraft_t *aircraft, class Employee *employee) |
| Adds given employee to given aircraft. | |
| bool | AIR_IsInAircraftTeam (const aircraft_t *aircraft, const class Employee *employee) |
| int | AIR_GetTeamSize (const aircraft_t *aircraft) |
| Counts the number of soldiers in given aircraft. | |
| void | AIR_CampaignRun (const struct campaign_s *campaign, int dt, bool updateRadarOverlay) |
| bool | AIR_AircraftMakeMove (int dt, aircraft_t *aircraft) |
| Moves given aircraft. | |
| void | AIR_ParseAircraft (const char *name, const char **text, bool assignAircraftItems) |
| Parses all aircraft that are defined in our UFO-scripts. | |
| bool | AIR_AircraftHasEnoughFuel (const aircraft_t *aircraft, const vec2_t destination) |
| check if aircraft has enough fuel to go to destination, and then come back home | |
| bool | AIR_AircraftHasEnoughFuelOneWay (const aircraft_t *aircraft, const vec2_t destination) |
| check if aircraft has enough fuel to go to destination | |
| void | AIR_AircraftReturnToBase (aircraft_t *aircraft) |
| Calculates the way back to homebase for given aircraft and returns it. | |
| bool | AIR_SendAircraftToMission (aircraft_t *aircraft, struct mission_s *mission) |
| void | AIR_AircraftsNotifyMissionRemoved (const struct mission_s *mission) |
| void | AIR_AircraftsNotifyUFORemoved (const aircraft_t *const ufo, bool destroyed) |
| Notify that a UFO has been removed. | |
| void | AIR_GetDestinationWhilePursuing (const aircraft_t *shooter, const aircraft_t *target, vec2_t dest) |
| Calculates the point where aircraft should go to intecept a moving target. | |
| bool | AIR_SendAircraftPursuingUFO (aircraft_t *aircraft, aircraft_t *ufo) |
| Make the specified aircraft purchasing a UFO. | |
| void | AIR_AircraftsUFODisappear (const aircraft_t *const ufo) |
| Notify that a UFO disappear from radars. | |
| bool | AIR_ScriptSanityCheck (void) |
| Checks the parsed aircraft for errors. | |
| int | AIR_AircraftMenuStatsValues (const int value, const int stat) |
| Some of the aircraft values needs special calculations when they are shown in the menus. | |
| int | AIR_CountInBaseByTemplate (const struct base_s *base, const aircraft_t *aircraftTemplate) |
| int | AIR_GetAircraftWeaponRanges (const aircraftSlot_t *slot, int maxSlot, float *weaponRanges) |
| Get the all the unique weapon ranges of this aircraft. | |
| baseCapacities_t | AIR_GetHangarCapacityType (const aircraft_t *aircraft) |
| Returns capacity type needed for an aircraft. | |
| const char * | AIR_CheckMoveIntoNewHomebase (const aircraft_t *aircraft, const struct base_s *base) |
| void | AIR_MoveAircraftIntoNewHomebase (aircraft_t *aircraft, struct base_s *base) |
| void | AII_CollectItem (aircraft_t *aircraft, const objDef_t *item, int amount) |
| Add an item to aircraft inventory. | |
| void | AII_CollectingItems (aircraft_t *aircraft, int won) |
| Collect items from the battlefield. | |
| bool | AIR_SetPilot (aircraft_t *aircraft, class Employee *pilot) |
| Assign a pilot to an aircraft. | |
| Employee * | AIR_GetPilot (const aircraft_t *aircraft) |
| Get pilot of an aircraft. | |
| bool | AIR_PilotSurvivedCrash (const aircraft_t *aircraft) |
| Determine if an aircraft's pilot survived a crash, based on his piloting skill (and a bit of randomness). | |
| bool | AIR_AddEmployee (Employee *employee, aircraft_t *aircraft) |
| Assigns a soldier to an aircraft. | |
| void | AIR_RemoveEmployees (aircraft_t &aircraft) |
| Removes all soldiers from an aircraft. | |
| bool | AIR_RemoveEmployee (Employee *employee, aircraft_t *aircraft) |
| Removes a soldier from an aircraft. | |
| const aircraft_t * | AIR_IsEmployeeInAircraft (const class Employee *employee, const aircraft_t *aircraft) |
| void | AIR_AutoAddPilotToAircraft (const struct base_s *base, class Employee *pilot) |
| void | AIR_RemovePilotFromAssignedAircraft (const struct base_s *base, const class Employee *pilot) |
| void | AIR_MoveEmployeeInventoryIntoStorage (const aircraft_t &aircraft, equipDef_t &equip) |
| Move all the equipment carried by the team on the aircraft into the given equipment. | |
| void | AIR_AssignInitial (aircraft_t *aircraft) |
| Assigns initial team of soldiers to aircraft. | |
| bool | AIR_CanIntercept (const aircraft_t *aircraft) |
| int | AIR_GetOperationRange (const aircraft_t *aircraft) |
| Calculates the range an aircraft can fly on the geoscape. | |
| int | AIR_GetRemainingRange (const aircraft_t *aircraft) |
| Calculates the remaining range the aircraft can fly. | |
| void | AIR_InitStartup (void) |
| Init actions for aircraft-subsystem. | |
| void | AIR_Shutdown (void) |
| Closing actions for aircraft-subsystem. | |
Header file for aircraft stuff.
Definition in file cp_aircraft.h.
| #define AIR_Foreach | ( | var | ) |
iterates trough all aircraft
| [out] | var | variable to point to the aircraft structure |
Definition at line 193 of file cp_aircraft.h.
Referenced by AII_UpdateInstallationDelay(), AIR_AircraftGetFromIDX(), AIR_AircraftsNotifyMissionRemoved(), AIR_AircraftsNotifyUFORemoved(), AIR_AircraftsUFODisappear(), AIR_CampaignRun(), AIR_IsEmployeeInAircraft(), AIR_PostLoadInitMissions(), AIR_RemoveEmployee(), AIR_SaveXML(), AIR_Shutdown(), CP_ResetCampaignData(), GEO_Click(), GEO_DrawMarkers(), GEO_GetGeoscapeAngle(), Employee::isAwayFromBase(), NAT_HandleBudget(), RADAR_AddDetectedUFOToEveryRadar(), RADAR_DeactivateRadarOverlay(), RADAR_UpdateWholeRadarOverlay(), RS_InitTree(), STAT_GetExpenses_f(), TEST_F(), TEST_F(), UFO_CampaignCheckEvents(), and UFO_SearchAircraftTarget().
| #define AIR_ForeachFromBase | ( | var, | |
| base ) |
iterates trough all aircraft from a specific homebase
| [out] | var | variable to point to the aircraft structure |
| [in] | base | pointer to the homebase structure |
Definition at line 202 of file cp_aircraft.h.
Referenced by AB_UpdateStealthForAllBase(), AII_RepairAircraft(), AIM_PilotAssignedAircraft(), AIR_AircraftFillList_f(), AIR_AircraftSelect(), AIR_AutoAddPilotToAircraft(), AIR_BaseCountAircraft(), AIR_CountInBaseByTemplate(), AIR_GetAircraftFromBaseByIDXSafe(), AIR_GetFirstFromBase(), AIR_RemovePilotFromAssignedAircraft(), AIR_ShowAircraft_f(), B_Destroy(), B_MoveAircraftOnGeoscapeToOtherBases(), BS_FillMarket_f(), GEO_GetGeoscapeAngle(), RADAR_NotifyUFORemoved(), TEST_F(), TEST_F(), and TR_FillAircraft().
| #define AIR_IsAircraftOfBase | ( | aircraft, | |
| base ) |
Definition at line 195 of file cp_aircraft.h.
| #define AIR_IsUFO | ( | aircraft | ) |
Definition at line 206 of file cp_aircraft.h.
Referenced by AII_AutoAddAmmo(), AII_ReloadWeapon(), AIR_ScriptSanityCheck(), AIRFIGHT_ExecuteActions(), AIRFIGHT_ProbabilityToHit(), AIRFIGHT_ProjectileHits(), AIRFIGHT_RemoveProjectileAimingAircraft(), AIRFIGHT_SaveXML(), BS_AddAircraftToMarket(), BS_AircraftIsOnMarket(), BS_GetAircraftBuyingPrice(), BS_GetAircraftSellingPrice(), BS_RemoveAircraftFromMarket(), PR_UpdateProductionList(), UFO_CreateFromTemplate(), UFO_GetTemplate(), UFO_GetTemplateForGeoscape(), UP_AircraftDescription(), and UR_DialogStartStore_f().
| #define AIRCRAFT_REFUEL_FACTOR 16 |
factor to speed up refuelling
Definition at line 36 of file cp_aircraft.h.
Referenced by AIR_Refuel().
| #define LINE_MAXPTS (LINE_MAXSEG + 2) |
Definition at line 33 of file cp_aircraft.h.
Referenced by AIR_LoadRouteXML(), GEO_3DMapDrawLine(), GEO_CalcLine(), and GEO_MapDrawLine().
| #define LINE_MAXSEG 64 |
Definition at line 32 of file cp_aircraft.h.
Referenced by GEO_CalcLine().
| #define MAX_AIRCRAFT 64 |
Definition at line 31 of file cp_aircraft.h.
Referenced by AIR_ParseAircraft().
| #define MAX_AIRCRAFTSLOT 8 |
Definition at line 75 of file cp_aircraft.h.
Referenced by AII_InitialiseAircraftSlots(), AII_SetAircraftInSlots(), AIR_DeleteAircraft(), AIR_GetAircraftWeaponRanges(), and AIR_GetSlotItems().
notification signals for aircraft events
| Enumerator | |
|---|---|
| AIR_CANNOT_REFUEL | |
| MAX_AIR_NOTIFICATIONS | |
Definition at line 69 of file cp_aircraft.h.
| enum aircraftStatus_t |
possible aircraft states
Definition at line 99 of file cp_aircraft.h.
| enum itemPos_t |
different positions for aircraft items
| Enumerator | |
|---|---|
| AIR_NOSE_LEFT | |
| AIR_NOSE_CENTER | |
| AIR_NOSE_RIGHT | |
| AIR_WING_LEFT | |
| AIR_WING_RIGHT | |
| AIR_REAR_LEFT | |
| AIR_REAR_CENTER | |
| AIR_REAR_RIGHT | |
| AIR_POSITIONS_MAX | |
Definition at line 55 of file cp_aircraft.h.
| enum itemWeight_t |
different weight for aircraft items
| Enumerator | |
|---|---|
| ITEM_LIGHT | |
| ITEM_MEDIUM | |
| ITEM_HEAVY | |
Definition at line 48 of file cp_aircraft.h.
| void AII_CollectingItems | ( | aircraft_t * | aircraft, |
| int | won ) |
Collect items from the battlefield.
Definition at line 294 of file cp_aircraft.cpp.
References ItemCargo::add(), AII_CarriedItems(), AII_CollectAmmo(), AII_CollectItem_(), cgi, DEBUG_CLIENT, ItemCargo::empty(), aircraft_t::itemCargo, ItemCargo::list(), LIST_Foreach, and aircraft_t::mission.
Referenced by GAME_CP_Results().
| void AII_CollectItem | ( | aircraft_t * | aircraft, |
| const objDef_t * | item, | ||
| int | amount ) |
Add an item to aircraft inventory.
| [in,out] | aircraft | Aircraft to load to |
| [in] | item | Item to add |
| amount | Number of items to add |
Definition at line 237 of file cp_aircraft.cpp.
References ItemCargo::add(), and aircraft_t::itemCargo.
Referenced by AII_CollectItem_(), and AM_MoveCharacterInventoryIntoItemCargo().
| aircraft_t * AIR_Add | ( | struct base_s * | base, |
| const aircraft_t * | aircraftTemplate ) |
| bool AIR_AddEmployee | ( | Employee * | employee, |
| aircraft_t * | aircraft ) |
Assigns a soldier to an aircraft.
| [in] | employee | The employee to be assigned to the aircraft. |
| [in] | aircraft | What aircraft to assign employee to. |
Definition at line 2853 of file cp_aircraft.cpp.
References AIR_AddToAircraftTeam(), AIR_GetTeamSize(), AIR_IsEmployeeInAircraft(), and aircraft_t::maxTeamSize.
Referenced by AIR_AssignInitial().
| bool AIR_AddToAircraftTeam | ( | aircraft_t * | aircraft, |
| Employee * | employee ) |
Adds given employee to given aircraft.
| [in] | aircraft | Pointer to an aircraft, to which we will add employee. |
| [in] | employee | The employee to add to the aircraft. |
Definition at line 1945 of file cp_aircraft.cpp.
References aircraft_t::acTeam, AIR_GetTeamSize(), cgi, and aircraft_t::maxTeamSize.
Referenced by AIR_AddEmployee(), and CP_TEAM_AssignSoldierByUCN_f().
| aircraft_t * AIR_AircraftGetFromIDX | ( | int | aircraftIdx | ) |
Returns aircraft for a given global index.
| [in] | aircraftIdx | Global aircraft index. |
Definition at line 1132 of file cp_aircraft.cpp.
References AIR_Foreach, cgi, and DEBUG_CLIENT.
Referenced by AIM_AircraftReturnToBase_f(), AIR_GeoSelectAircraft_f(), AIR_LoadAircraftXML(), AIR_SendAircraftToMission_f(), AIR_ShowChangeHomebaseAircraft_f(), AIR_StopAircraft_f(), AIRFIGHT_LoadXML(), BS_Buy_f(), BS_ShowInfo_f(), CP_TEAM_FillEmployeeList_f(), CP_TEAM_FillEquipSoldierList_f(), MIS_LoadXML(), TR_Add_f(), TR_LoadXML(), and TR_TransferStart().
| bool AIR_AircraftHasEnoughFuel | ( | const aircraft_t * | aircraft, |
| const vec2_t | destination ) |
check if aircraft has enough fuel to go to destination, and then come back home
| [in] | aircraft | Pointer to the aircraft |
| [in] | destination | Pointer to the position the aircraft should go to |
Definition at line 472 of file cp_aircraft.cpp.
References AIR_GetRemainingRange(), GetDistanceOnGlobe(), aircraft_t::homebase, aircraft_t::pos, base_t::pos, and DateTime::SECONDS_PER_HOUR.
Referenced by AIR_CampaignRun(), AIR_GeoSelectAircraft_f(), AIR_SendAircraftPursuingUFO(), AIR_SendAircraftToMission(), CL_DisplayPopupInterceptUFO(), and GEO_Click().
| bool AIR_AircraftHasEnoughFuelOneWay | ( | const aircraft_t * | aircraft, |
| const vec2_t | destination ) |
check if aircraft has enough fuel to go to destination
| [in] | aircraft | Pointer to the aircraft |
| [in] | destination | Pointer to the position the aircraft should go to |
Definition at line 498 of file cp_aircraft.cpp.
References AIR_GetRemainingRange(), GetDistanceOnGlobe(), aircraft_t::pos, and DateTime::SECONDS_PER_HOUR.
Referenced by AIR_CheckMoveIntoNewHomebase().
| bool AIR_AircraftMakeMove | ( | int | dt, |
| aircraft_t * | aircraft ) |
Moves given aircraft.
| [in] | dt | time delta |
| [in] | aircraft | Pointer to aircraft on its way. |
Definition at line 926 of file cp_aircraft.cpp.
References AIR_STATS_SPEED, mapline_t::distance, aircraft_t::fuel, GEO_CheckPositionBoundaries(), int(), mapline_t::numPoints, aircraft_t::point, mapline_t::point, aircraft_t::pos, aircraft_t::projectedPos, aircraft_t::route, DateTime::SECONDS_PER_HOUR, aircraft_t::stats, aircraft_t::time, and VectorSet.
Referenced by AIR_Move(), and UFO_CampaignRunUFOs().
Some of the aircraft values needs special calculations when they are shown in the menus.
Definition at line 429 of file cp_aircraft.cpp.
References AIR_STATS_FUELSIZE, AIR_STATS_MAXSPEED, AIR_STATS_SPEED, and int().
Referenced by AIR_AircraftSelect(), GEO_GetAircraftText(), GEO_GetUFOText(), UP_AircraftDescription(), and UP_AircraftItemDescription().
| void AIR_AircraftReturnToBase | ( | aircraft_t * | aircraft | ) |
Calculates the way back to homebase for given aircraft and returns it.
| [in] | aircraft | Pointer to aircraft, which should return to base. |
Definition at line 516 of file cp_aircraft.cpp.
References AIR_IsAircraftOnGeoscape(), AIR_RETURNING, aircraft_t::aircraftTarget, GEO_CalcLine(), aircraft_t::homebase, aircraft_t::mission, aircraft_t::point, aircraft_t::pos, base_t::pos, aircraft_t::route, aircraft_t::status, and aircraft_t::time.
Referenced by AIM_AircraftReturnToBase_f(), AIR_AircraftsNotifyMissionRemoved(), AIR_AircraftsNotifyUFORemoved(), AIR_AircraftsUFODisappear(), AIR_CampaignRun(), AIR_MoveAircraftIntoNewHomebase(), AIR_PostLoadInitMissions(), AIR_SendAircraftPursuingUFO(), AIRFIGHT_ExecuteActions(), AIRFIGHT_RemoveProjectileAimingAircraft(), and CP_MissionEndActions().
| void AIR_AircraftsNotifyUFORemoved | ( | const aircraft_t *const | ufo, |
| bool | destroyed ) |
Notify that a UFO has been removed.
| [in] | ufo | Pointer to UFO that has been removed. |
| [in] | destroyed | True if the UFO has been destroyed, false if it only landed. |
Definition at line 1609 of file cp_aircraft.cpp.
References AIR_AircraftReturnToBase(), AIR_Foreach, aircraft_t::aircraftTarget, B_GetNext(), base_t::batteries, i, base_t::lasers, base_t::numBatteries, base_t::numLasers, and baseWeapon_t::target.
Referenced by CP_UFORemoveFromGeoscape().
| const char * AIR_AircraftStatusToName | ( | const aircraft_t * | aircraft | ) |
Translates the aircraft status id to a translatable string.
| [in] | aircraft | Aircraft to translate the status of |
Definition at line 328 of file cp_aircraft.cpp.
References _, AIR_CRASHED, AIR_DROP, AIR_HOME, AIR_IDLE, AIR_INTERCEPT, AIR_IsAircraftInBase(), AIR_MISSION, AIR_NONE, AIR_REFUEL, AIR_RETURNING, AIR_TRANSFER, AIR_TRANSIT, AIR_UFO, B_IsUnderAttack, cgi, ERR_DROP, aircraft_t::homebase, aircraft_t::status, and va().
Referenced by AIR_AircraftFillList_f(), AIR_ShowAircraft_f(), CL_DisplayPopupInterceptMission(), CL_DisplayPopupInterceptUFO(), and GEO_GetAircraftText().
| void AIR_AircraftsUFODisappear | ( | const aircraft_t *const | ufo | ) |
Notify that a UFO disappear from radars.
| [in] | ufo | Pointer to a UFO that has disappeared. |
Definition at line 1651 of file cp_aircraft.cpp.
References AIR_AircraftReturnToBase(), AIR_Foreach, AIR_UFO, and aircraft_t::aircraftTarget.
Referenced by UFO_CampaignCheckEvents().
| void AIR_AssignInitial | ( | aircraft_t * | aircraft | ) |
Assigns initial team of soldiers to aircraft.
| [in,out] | aircraft | soldiers to add to |
Definition at line 2873 of file cp_aircraft.cpp.
References AIR_AddEmployee(), cgi, count, E_Foreach, EMPL_SOLDIER, aircraft_t::homebase, and aircraft_t::maxTeamSize.
Referenced by B_SetUpFirstBase().
| int AIR_BaseCountAircraft | ( | const struct base_s * | base | ) |
| bool AIR_BaseHasAircraft | ( | const struct base_s * | base | ) |
References name.
| bool AIR_CanIntercept | ( | const aircraft_t * | aircraft | ) |
| aircraft | The aircraft to check |
true if the given aircraft can go on interceptions Definition at line 2650 of file cp_aircraft.cpp.
References AIR_CRASHED, AIR_GetPilot(), AIR_NONE, B_GetBuildingStatus(), B_GetBuildingTemplateSilent(), aircraft_t::building, building_t::buildingType, aircraft_t::homebase, and aircraft_t::status.
Referenced by CL_DisplayPopupInterceptMission(), and CL_DisplayPopupInterceptUFO().
| const char * AIR_CheckMoveIntoNewHomebase | ( | const aircraft_t * | aircraft, |
| const struct base_s * | base ) |
| int AIR_CountInBaseByTemplate | ( | const struct base_s * | base, |
| const aircraft_t * | aircraftTemplate ) |
| bool AIR_Delete | ( | struct base_s * | base, |
| aircraft_t * | aircraft ) |
References name.
| void AIR_DeleteAircraft | ( | aircraft_t * | aircraft | ) |
Removes an aircraft from its base and the game.
| [in] | aircraft | Pointer to aircraft that should be removed. |
Definition at line 837 of file cp_aircraft.cpp.
References AII_RemoveItemFromSlot(), AIR_BaseHasAircraft(), AIR_Delete(), AIR_GetFirstFromBase(), AIR_IsAircraftOnGeoscape(), AIR_RemoveEmployees(), base_t::aircraftCurrent, cgi, aircraft_t::electronics, GEO_NotifyAircraftRemoved(), aircraft_t::homebase, i, base_t::idx, MAX_AIRCRAFTSLOT, RADAR_UpdateWholeRadarOverlay(), aircraft_t::shield, TR_NotifyAircraftRemoved(), and aircraft_t::weapons.
Referenced by AIR_DestroyAircraft(), B_Destroy(), BS_SellAircraft(), TEST_F(), and TR_EmptyTransferCargo().
| void AIR_DestroyAircraft | ( | aircraft_t * | aircraft, |
| bool | killPilot ) |
Removes an aircraft from its base and the game.
| [in] | aircraft | Pointer to aircraft that should be removed. |
| [in] | killPilot | Should pilot be removed from game or not? |
Definition at line 889 of file cp_aircraft.cpp.
References aircraft_t::acTeam, AIR_CRASHED, AIR_DeleteAircraft(), AIR_GetPilot(), AIR_SetPilot(), cgi, Employee::chr, E_DeleteEmployee(), E_RemoveInventoryFromStorage(), ERR_DROP, aircraft_t::id, LIST_Foreach, character_t::name, aircraft_t::status, and character_t::ucn.
Referenced by AIRFIGHT_ActionsAfterAirfight(), B_MoveAircraftOnGeoscapeToOtherBases(), CP_EndRescueMission(), and CP_SpawnRescueMission().
| const aircraft_t * AIR_GetAircraft | ( | const char * | name | ) |
Searches the global array of aircraft types for a given aircraft.
| [in] | name | Aircraft id. |
Definition at line 572 of file cp_aircraft.cpp.
References AIR_GetAircraftSilent(), cgi, ERR_DROP, name, and Q_strnull().
Referenced by AIR_LoadAircraftXML(), B_SetUpFirstBase(), BS_InitMarket(), CP_CampaignRunMarket(), PR_LoadXML(), RS_AssignTechLinks(), TEST_F(), TEST_F(), TEST_F(), UP_AircraftDescription(), UR_DialogInitSell_f(), and US_LoadXML().
| aircraft_t * AIR_GetAircraftFromBaseByIDXSafe | ( | const struct base_s * | base, |
| int | index ) |
References index.
| const aircraft_t * AIR_GetAircraftSilent | ( | const char * | name | ) |
Searches the global array of aircraft types for a given aircraft.
| [in] | name | Aircraft id. |
Definition at line 555 of file cp_aircraft.cpp.
References ccs, i, aircraft_t::id, name, and Q_streq.
Referenced by AIR_GetAircraft(), AIR_ParseAircraft(), BS_Buy_f(), BS_SetAutosell_f(), BS_ShowInfo_f(), GAME_CP_GetItemModel(), and UR_DialogStartStore_f().
| int AIR_GetAircraftWeaponRanges | ( | const aircraftSlot_t * | slot, |
| int | maxSlot, | ||
| float * | weaponRanges ) |
Get the all the unique weapon ranges of this aircraft.
| [in] | slot | Pointer to the aircrafts weapon slot list. |
| [in] | maxSlot | maximum number of weapon slots in aircraft. |
| [out] | weaponRanges | An array containing a unique list of weapons ranges. |
Definition at line 2085 of file cp_aircraft.cpp.
References AIR_STATS_WRANGE, aircraftSlot_t::ammo, objDef_t::craftitem, MAX_AIRCRAFTSLOT, Q_FloatSort(), and craftItem::stats.
| void AIR_GetDestinationWhilePursuing | ( | const aircraft_t * | shooter, |
| const aircraft_t * | target, | ||
| vec2_t | dest ) |
Calculates the point where aircraft should go to intecept a moving target.
| [in] | shooter | Pointer to shooting aircraft. |
| [in] | target | Pointer to target aircraft. |
| [out] | dest | Destination that shooting aircraft should aim to intercept target aircraft. |
In the following, we note S the position of the shooter, T the position of the target, D the destination of the target and I the interception point where shooter should reach target O is the center of earth. A, B and C are the angles TSI, STI and SIT a, b, and c are the angles TOI, SOI and SOT
According to geometry on a sphere, the values defined above must be solutions of both equations: sin(A) / sin(a) = sin(B) / sin(b) cos(a) = cos(b) * cos(c) + sin(b) * sin(c) * cos(A) And we have another equation, given by the fact that shooter and target must reach I at the same time: shooterSpeed * a = targetSpeed * b We the want to find and equation linking a, c and B (we know the last 2 values). We therefore eliminate b, then A, to get the equation we need to solve: pow(cos(a) - cos(speedRatio * a) * cos(c), 2.)
Definition at line 1806 of file cp_aircraft.cpp.
References AIR_GetDestinationFindRoot(), AIR_STATS_SPEED, cgi, CrossProduct(), DEBUG_CLIENT, dest, DotProduct, GetDistanceOnGlobe(), mapline_t::numPoints, mapline_t::point, PolarToVec(), aircraft_t::pos, RotatePointAroundVector(), aircraft_t::route, aircraft_t::stats, todeg, torad, VecToPolar(), Vector2Copy, and VectorNormalize().
Referenced by AIR_SendAircraftPursuingUFO(), UFO_SearchAircraftTarget(), and UFO_SendPursuingAircraft().
| aircraft_t * AIR_GetFirstFromBase | ( | const struct base_s * | base | ) |
| baseCapacities_t AIR_GetHangarCapacityType | ( | const aircraft_t * | aircraft | ) |
Returns capacity type needed for an aircraft.
| [in] | aircraft | Aircraft to check |
Definition at line 689 of file cp_aircraft.cpp.
References B_GetBuildingTemplateSilent(), B_GetCapacityFromBuildingType(), aircraft_t::building, building_t::buildingType, and MAX_CAP.
Referenced by AIR_Add(), AIR_CheckMoveIntoNewHomebase(), AIR_Delete(), AIR_MoveAircraftIntoNewHomebase(), B_SetUpFirstBase(), BS_Buy_f(), CP_SpawnRescueMission(), PR_ProductionIncrease_f(), TR_CountAircraftInList(), TR_TransferStart(), and UP_AircraftDescription().
| int AIR_GetOperationRange | ( | const aircraft_t * | aircraft | ) |
Calculates the range an aircraft can fly on the geoscape.
| aircraft | The aircraft to calculate the range for |
Definition at line 448 of file cp_aircraft.cpp.
References AIR_STATS_FUELSIZE, AIR_STATS_SPEED, int(), KILOMETER_PER_DEGREE, DateTime::SECONDS_PER_HOUR, and aircraft_t::stats.
Referenced by AIR_AircraftSelect(), and UP_AircraftDescription().
| Employee * AIR_GetPilot | ( | const aircraft_t * | aircraft | ) |
Get pilot of an aircraft.
| [in] | aircraft | Pointer to the aircraft |
nullptr if there is no pilot assigned to this craft, the employee pointer otherwise Definition at line 2008 of file cp_aircraft.cpp.
References Employee::chr, E_GetEmployeeByTypeFromChrUCN(), Employee::getType(), aircraft_t::pilot, and character_t::ucn.
Referenced by AIM_AircraftStart_f(), AIM_PilotAssignedAircraft(), AIR_CanIntercept(), AIR_CheckMoveIntoNewHomebase(), AIR_DestroyAircraft(), AIR_IsEmployeeInAircraft(), AIR_MoveAircraftIntoNewHomebase(), AIR_RemoveEmployee(), AIR_RemovePilotFromAssignedAircraft(), AIR_SaveAircraftXML(), CP_SpawnRescueMission(), CP_TEAM_FillEmployeeList_f(), and CP_UpdateActorAircraftVar().
| int AIR_GetRemainingRange | ( | const aircraft_t * | aircraft | ) |
Calculates the remaining range the aircraft can fly.
| aircraft | The aircraft to calculate the remaining range for |
Definition at line 460 of file cp_aircraft.cpp.
References AIR_STATS_SPEED, aircraft_t::fuel, and aircraft_t::stats.
Referenced by AIR_AircraftHasEnoughFuel(), and AIR_AircraftHasEnoughFuelOneWay().
| int AIR_GetTeamSize | ( | const aircraft_t * | aircraft | ) |
Counts the number of soldiers in given aircraft.
| [in] | aircraft | Pointer to the aircraft, for which we return the amount of soldiers. |
Definition at line 1979 of file cp_aircraft.cpp.
References aircraft_t::acTeam, and cgi.
Referenced by AIR_AddEmployee(), AIR_AddToAircraftTeam(), AIR_AircraftFillList_f(), AIR_CheckMoveIntoNewHomebase(), AIR_GeoSelectAircraft_f(), AIR_LoadAircraftXML(), AIR_MoveEmployeeInventoryIntoStorage(), AIR_RemoveEmployees(), AIR_SendAircraftToMission(), BS_SellAircraft(), CL_DisplayPopupInterceptMission(), CL_DisplayPopupInterceptUFO(), CP_StartSelectedMission(), CP_TEAM_AssignSoldierByUCN_f(), CP_TEAM_FillBDEFEmployeeList_f(), CP_TEAM_FillEmployeeList_f(), CP_UpdateActorAircraftVar(), GEO_GetAircraftText(), and TEST_F().
Init actions for aircraft-subsystem.
Definition at line 2909 of file cp_aircraft.cpp.
References AIR_InitCallbacks(), aircraftDebugCmds, and cgi.
Referenced by CP_InitStartup().
| bool AIR_IsAircraftInBase | ( | const aircraft_t * | aircraft | ) |
Checks whether given aircraft is in its homebase.
| [in] | aircraft | Pointer to an aircraft. |
Definition at line 372 of file cp_aircraft.cpp.
References AIR_HOME, AIR_REFUEL, and aircraft_t::status.
Referenced by AII_AutoAddAmmo(), AII_ReloadWeapon(), AII_RepairAircraft(), AII_UpdateInstallationDelay(), AIM_AircraftStart_f(), AIR_AircraftFillList_f(), AIR_AircraftSelect(), AIR_AircraftStatusToName(), AIR_SendAircraftPursuingUFO(), AIR_SendAircraftToMission(), AIR_ShowAircraft_f(), AIRFIGHT_ProjectileHits(), BS_FillMarket_f(), BS_SellAircraft(), GEO_Draw(), Employee::isAwayFromBase(), TR_AircraftListSelect(), and TR_FillAircraft().
| bool AIR_IsAircraftOnGeoscape | ( | const aircraft_t * | aircraft | ) |
Checks whether given aircraft is on geoscape.
| [in] | aircraft | Pointer to an aircraft. |
false if given aircraft is not on geoscape, true if given aircraft is on geoscape. Definition at line 386 of file cp_aircraft.cpp.
References AIR_CRASHED, AIR_DROP, AIR_HOME, AIR_IDLE, AIR_INTERCEPT, AIR_MISSION, AIR_NONE, AIR_REFUEL, AIR_RETURNING, AIR_TRANSFER, AIR_TRANSIT, AIR_UFO, cgi, ERR_FATAL, and aircraft_t::status.
Referenced by AB_UpdateStealthForAllBase(), AIR_AircraftReturnToBase(), AIR_CampaignRun(), AIR_DeleteAircraft(), B_MoveAircraftOnGeoscapeToOtherBases(), GEO_Click(), GEO_DrawMarkers(), GEO_GetGeoscapeAngle(), RADAR_AddDetectedUFOToEveryRadar(), RADAR_UpdateWholeRadarOverlay(), TEST_F(), UFO_CampaignCheckEvents(), UFO_CheckShootBack(), and UFO_SearchAircraftTarget().
| const aircraft_t * AIR_IsEmployeeInAircraft | ( | const class Employee * | employee, |
| const aircraft_t * | aircraft ) |
| bool AIR_IsInAircraftTeam | ( | const aircraft_t * | aircraft, |
| const class Employee * | employee ) |
| void AIR_MoveAircraftIntoNewHomebase | ( | aircraft_t * | aircraft, |
| struct base_s * | base ) |
| void AIR_MoveEmployeeInventoryIntoStorage | ( | const aircraft_t & | aircraft, |
| equipDef_t & | ed ) |
Move all the equipment carried by the team on the aircraft into the given equipment.
| [in] | aircraft | The craft with the team (and thus equipment) onboard. |
| [out] | ed | The equipment definition which will receive all the stuff from the aircraft-team. |
Definition at line 2817 of file cp_aircraft.cpp.
References aircraft_t::acTeam, equipDef_t::addClip(), AIR_GetTeamSize(), Item::ammoDef(), cgi, DEBUG_CLIENT, Item::def(), Item::getAmmoLeft(), Item::getNext(), Container::getNextItem(), LIST_Foreach, equipDef_t::numItems, and type.
Referenced by B_InitialEquipment().
| aircraft_t * AIR_NewAircraft | ( | struct base_s * | base, |
| const aircraft_t * | aircraftTemplate ) |
| void AIR_ParseAircraft | ( | const char * | name, |
| const char ** | text, | ||
| bool | assignAircraftItems ) |
Parses all aircraft that are defined in our UFO-scripts.
Definition at line 1276 of file cp_aircraft.cpp.
References AC_ITEM_ELECTRONICS, AC_ITEM_WEAPON, AII_InitialiseAircraftSlots(), AIR_GetAircraftSilent(), AIR_HOME, air_position_strings, AIR_POSITIONS_MAX, air_slot_type_strings, AIR_STATS_FUELSIZE, AIR_STATS_SPEED, aircraft_param_vals, aircraft_radar_vals, aircraft_vals, aircraftSlot_t::ammo, aircraft_t::building, ccs, cgi, Com_Parse(), Com_SkipBlock(), cp_campaignPool, DEBUG_CLIENT, aircraft_t::electronics, ERR_DROP, i, aircraft_t::id, int(), INVSH_GetItemByID(), aircraftSlot_t::item, ITEM_HEAVY, ITEM_LIGHT, ITEM_MEDIUM, MAX_ACITEMS, MAX_AIRCRAFT, aircraft_t::maxElectronics, aircraft_t::maxWeapons, MEMBER_SIZEOF, aircraft_t::name, name, OBJZERO, aircraftSlot_t::pos, aircraft_t::price, aircraft_t::productionCost, technology_t::provides, Q_streq, Q_strncpyz(), aircraft_t::radar, RADAR_InitialiseUFOs(), RS_GetTechByID(), DateTime::SECONDS_PER_HOUR, aircraft_t::setUfoType(), aircraft_t::shield, aircraftSlot_t::size, aircraft_t::stats, aircraft_t::status, Sys_Error(), aircraft_t::tpl, UFO_NONE, V_INT, and aircraft_t::weapons.
Referenced by CP_ParseScriptFirst(), and CP_ParseScriptSecond().
| bool AIR_PilotSurvivedCrash | ( | const aircraft_t * | aircraft | ) |
Determine if an aircraft's pilot survived a crash, based on his piloting skill (and a bit of randomness).
| [in] | aircraft | Pointer to crashed aircraft |
Definition at line 2023 of file cp_aircraft.cpp.
References cgi, Employee::chr, crand(), GEO_GetColor(), MAPTYPE_TERRAIN, aircraft_t::pilot, aircraft_t::pos, character_t::score, SKILL_PILOTING, and chrScoreGlobal_t::skills.
Referenced by AIRFIGHT_ActionsAfterAirfight(), and CP_SpawnRescueMission().
| bool AIR_RemoveEmployee | ( | Employee * | employee, |
| aircraft_t * | aircraft ) |
Removes a soldier from an aircraft.
| [in,out] | employee | The soldier to be removed from the aircraft. |
| [in,out] | aircraft | The aircraft to remove the soldier from. Use nullptr to remove the soldier from any aircraft. |
Definition at line 2724 of file cp_aircraft.cpp.
References aircraft_t::acTeam, AIR_Foreach, AIR_GetPilot(), AIR_IsEmployeeInAircraft(), AIR_SetPilot(), cgi, Employee::chr, DEBUG_CLIENT, EMPL_PILOT, Employee::getType(), aircraft_t::homebase, aircraft_t::idx, and character_t::ucn.
Referenced by AIR_RemoveEmployees(), CP_EndRescueMission(), CP_TEAM_AssignSoldierByUCN_f(), TR_TransferStart(), and Employee::unassign().
| void AIR_RemoveEmployees | ( | aircraft_t & | aircraft | ) |
Removes all soldiers from an aircraft.
| [in,out] | aircraft | The aircraft to remove the soldiers from. |
Definition at line 2797 of file cp_aircraft.cpp.
References aircraft_t::acTeam, AIR_GetTeamSize(), AIR_RemoveEmployee(), AIR_SetPilot(), cgi, ERR_DROP, and LIST_Foreach.
Referenced by AIR_DeleteAircraft(), and BS_Buy_f().
| void AIR_RemovePilotFromAssignedAircraft | ( | const struct base_s * | base, |
| const class Employee * | pilot ) |
| void AIR_ResetAircraftTeam | ( | aircraft_t * | aircraft | ) |
Resets team in given aircraft.
| [in] | aircraft | Pointer to an aircraft, where the team will be reset. |
Definition at line 1934 of file cp_aircraft.cpp.
References aircraft_t::acTeam, and cgi.
Referenced by AIR_NewAircraft(), and AIR_Shutdown().
| bool AIR_ScriptSanityCheck | ( | void | ) |
Checks the parsed aircraft for errors.
Definition at line 2671 of file cp_aircraft.cpp.
References AII_GetItemWeightBySize(), AIR_IsUFO, ccs, cgi, aircraft_t::defaultName, aircraft_t::electronics, i, aircraft_t::id, objDef_t::id, aircraftSlot_t::item, aircraft_t::maxElectronics, aircraft_t::maxWeapons, aircraft_t::name, aircraftSlot_t::pos, aircraftSlot_t::size, and aircraft_t::weapons.
| bool AIR_SendAircraftPursuingUFO | ( | aircraft_t * | aircraft, |
| aircraft_t * | ufo ) |
Make the specified aircraft purchasing a UFO.
| [in] | aircraft | Pointer to an aircraft which will hunt for a UFO. |
| [in] | ufo | Pointer to a UFO. |
Definition at line 1891 of file cp_aircraft.cpp.
References _, AII_ReloadAircraftWeapons(), AIR_AircraftHasEnoughFuel(), AIR_AircraftReturnToBase(), AIR_GetDestinationWhilePursuing(), AIR_IsAircraftInBase(), AIR_UFO, aircraft_t::aircraftTarget, cgi, DEBUG_CLIENT, dest, GEO_CalcLine(), aircraft_t::homebase, MS_AddNewMessage(), aircraft_t::name, aircraft_t::point, aircraft_t::pos, aircraft_t::route, aircraft_t::status, aircraft_t::time, va(), and Vector2Copy.
Referenced by AIRFIGHT_ExecuteActions(), and CL_PopupInterceptClick_f().
| bool AIR_SendAircraftToMission | ( | aircraft_t * | aircraft, |
| struct mission_s * | mission ) |
| bool AIR_SetPilot | ( | aircraft_t * | aircraft, |
| Employee * | pilot ) |
Assign a pilot to an aircraft.
| [out] | aircraft | Pointer to the aircraft to add pilot to |
| [in] | pilot | Pointer to the pilot to add |
true if the assignment was successful (there wasn't a pilot assigned), false if there was already a pilot assigned and we tried to assign a new one (pilot isn't nullptr). Definition at line 1993 of file cp_aircraft.cpp.
References aircraft_t::pilot.
Referenced by AIR_AutoAddPilotToAircraft(), AIR_DestroyAircraft(), AIR_LoadAircraftXML(), AIR_RemoveEmployee(), AIR_RemoveEmployees(), AIR_RemovePilotFromAssignedAircraft(), and CP_TEAM_AssignSoldierByUCN_f().
Closing actions for aircraft-subsystem.
Definition at line 2918 of file cp_aircraft.cpp.
References AIR_Foreach, AIR_ResetAircraftTeam(), AIR_ShutdownCallbacks(), aircraftDebugCmds, ccs, and cgi.
Referenced by CP_Shutdown().