25 #include "../../cl_shared.h"
26 #include "../../ui/ui_dataids.h"
47 if (
cgi->Cmd_Argc() >= 2) {
55 if (aircraft ==
nullptr)
75 if (
cgi->Cmd_Argc() < 2) {
81 if (aircraft !=
nullptr)
97 cgi->Com_DPrintf(
DEBUG_CLIENT,
"Error - there is no current aircraft in this base\n");
103 CP_Popup(
_(
"Notice"),
_(
"No operational Command Centre in this base.\n\nAircraft can not start.\n"));
111 CP_Popup(
_(
"Notice"),
_(
"There is no pilot assigned to this aircraft.\n\nAircraft can not start.\n"));
124 cgi->UI_PopWindow(
false);
125 cgi->UI_PopWindow(
false);
155 cgi->Com_Printf(
"AIR_GetSlotItems: Unknown type of slot : %i", type);
160 for (
int i = 0;
i < max;
i++)
173 static char aircraftInfo[256];
176 if (aircraft !=
nullptr)
193 cgi->Com_Error(
ERR_DROP,
"No technology assigned to aircraft '%s'", aircraft->
id);
198 Com_sprintf(aircraftInfo,
sizeof(aircraftInfo),
_(
"Speed:\t%i km/h\n"),
213 if (aircraft == aircraftInBase)
219 cgi->Cvar_SetValue(
"mn_aircraft_id",
id);
222 cgi->UI_ExecuteConfunc(
"ui_aircraft_selected %i",
id);
223 cgi->UI_ExecuteConfunc(
"aircraft_change %i",
id);
233 cgi->UI_ExecuteConfunc(
"ui_aircraft_clear");
240 cgi->UI_ExecuteConfunc(
"ui_aircraft_add %i \"%s\" %3.0f %s \"%s\" \"%s\"", idx,
_(aircraft->name), health, inBase,
AIR_AircraftStatusToName(aircraft), teamStr);
272 for (i = 0; newName[
i] !=
'\0'; i++) {
273 if (newName[i] > 0x20)
276 if (newName[i] ==
'\0')
291 if (
cgi->Cmd_Argc() < 2) {
297 if (aircraft ==
nullptr)
305 cgi->UI_ExecuteConfunc(
"ui_clear_aircraft_action");
306 cgi->UI_ExecuteConfunc(
"ui_add_aircraft_action %i \"%s\" \"%s\"",
307 action_id++,
_(
"Change homebase"),
va(
"ui_aircraft_changehomebase %u;", aircraft->idx));
308 cgi->UI_ExecuteConfunc(
"ui_add_aircraft_action %i \"%s\" \"%s\"",
309 action_id++,
va(
"%s: %s",
_(
"Back to base"), aircraft->homebase->name),
va(
"aircraft_return %u;", aircraft->idx));
310 cgi->UI_ExecuteConfunc(
"ui_add_aircraft_action %i \"%s\" \"%s\"",
311 action_id++,
_(
"Stop"),
va(
"ui_aircraft_stop %u;", aircraft->idx));
319 if (!tempMission->pos)
323 cgi->UI_ExecuteConfunc(
"ui_add_aircraft_action %i \"%s\" \"%s\"",
324 action_id++,
va(
"%s: %s",
_(
"Mission"),
MIS_GetName(tempMission)),
325 va(
"ui_aircraft_to_mission %u %u;", aircraft->idx, tempMission->idx));
329 cgi->UI_PushWindow(
"popup_aircraft_actions");
337 if (
cgi->Cmd_Argc() < 2) {
343 if (aircraft ==
nullptr)
356 if (
cgi->Cmd_Argc() < 2) {
362 if (aircraft ==
nullptr)
373 if (
cgi->Cmd_Argc() < 3) {
379 if (aircraft ==
nullptr)
384 if (mission ==
nullptr)
395 if (
cgi->Cmd_Argc() < 2) {
400 if (base ==
nullptr) {
401 cgi->Com_Printf(
"AIR_ShowAircraft_f: Invalid base_idx!\n");
419 {
"ui_aircraft_stop",
AIR_StopAircraft_f,
"Clears an aircraft order when on the geoscape"},
423 {
nullptr,
nullptr,
nullptr}
428 cgi->Cmd_TableAddList(aircraftCallbacks);
433 cgi->Cmd_TableRemoveList(aircraftCallbacks);
bool Q_strnull(const char *string)
static void AIR_ShowChangeHomebaseAircraft_f(void)
Show change homebase popup.
bool AIR_IsAircraftInBase(const aircraft_t *aircraft)
Checks whether given aircraft is in its homebase.
QGL_EXTERN GLint GLenum type
bool B_GetBuildingStatus(const base_t *const base, const buildingType_t buildingType)
Get the status associated to a building.
const char * va(const char *format,...)
does a varargs printf into a temp buffer, so I don't need to have varargs versions of all text functi...
static void AIR_GeoSelectAircraft_f(void)
Select aircraft on Geoscape.
int AIR_AircraftMenuStatsValues(const int value, const int stat)
Some of the aircraft values needs special calculations when they are shown in the menus...
static void AIR_ChangeAircraftName_f(void)
Creates console command to change the name of an aircraft. Copies the value of the cvar mn_aircraftna...
#define MIS_Foreach(var)
iterates through missions
const char * AIR_AircraftStatusToName(const aircraft_t *aircraft)
Translates the aircraft status id to a translatable string.
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
base_t * B_GetCurrentSelectedBase(void)
returns the currently selected base
aircraft_t * AIR_AircraftGetFromIDX(int aircraftIdx)
Returns aircraft for a given global index.
static const cmdList_t aircraftCallbacks[]
uiMessageListNodeMessage_t * MS_AddNewMessage(const char *title, const char *text, messageType_t type, technology_t *pedia, bool popup, bool playSound)
Adds a new message to message stack.
void CP_UpdateActorAircraftVar(aircraft_t *aircraft, employeeType_t employeeType)
Updates data about teams in aircraft.
A base with all it's data.
base_t * B_GetFoundedBaseByIDX(int baseIdx)
Array bound check for the base index.
const char *IMPORT * Cvar_GetString(const char *varName)
Header file for menu related console command callbacks.
struct technology_s * tech
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
void AII_ReloadAircraftWeapons(aircraft_t *aircraft)
Reload the weapons of an aircraft.
cvar_t *IMPORT * Cvar_Set(const char *varName, const char *value,...) __attribute__((format(__printf__
aircraft_t * aircraftCurrent
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
int AIR_GetOperationRange(const aircraft_t *aircraft)
Calculates the range an aircraft can fly on the geoscape.
bool AIR_BaseHasAircraft(const base_t *base)
Checks whether there is any aircraft assigned to the given base.
void AIR_AircraftReturnToBase(aircraft_t *aircraft)
Calculates the way back to homebase for given aircraft and returns it.
Campaign missions headers.
const cgame_import_t * cgi
void AIR_ShutdownCallbacks(void)
static void AIM_SelectAircraft_f(void)
Select an aircraft from a base, by ID.
Employee * AIR_GetPilot(const aircraft_t *aircraft)
Get pilot of an aircraft.
aircraftSlot_t weapons[MAX_AIRCRAFTSLOT]
Header for Geoscape management.
static void AIR_StopAircraft_f(void)
Stop aircraft on Geoscape.
bool AIR_AircraftAllowed(const base_t *base)
Returns true if the current base is able to handle aircraft.
#define AIR_ForeachFromBase(var, base)
iterates trough all aircraft from a specific homebase
Header file for aircraft stuff.
int AIR_GetTeamSize(const aircraft_t *aircraft)
Counts the number of soldiers in given aircraft.
Header for slot management related stuff.
aircraftItemType_t
All different types of craft items.
bool Com_IsValidName(const char *input)
Checks whether the given input string is allowed to be used as a user-given name string for aircraft...
void Q_strcat(char *dest, size_t destsize, const char *format,...)
Safely (without overflowing the destination buffer) concatenates two strings.
static void AIM_AircraftReturnToBase_f(void)
Script function for AIR_AircraftReturnToBase.
bool AIR_SendAircraftToMission(aircraft_t *aircraft, mission_t *mission)
Sends the specified aircraft to specified mission.
Header file for single player campaign control.
void AIR_InitCallbacks(void)
aircraft_t * AIR_GetAircraftFromBaseByIDXSafe(const base_t *base, int index)
static void AIR_ShowAircraft_f(void)
Show aircraft in Base sections.
static void AIR_SendAircraftToMission_f(void)
Send aircraft to land on a mission.
const char * MIS_GetName(const mission_t *mission)
Returns a short translated name for a mission.
static void AIM_AircraftStart_f(void)
Starts an aircraft or stops the current mission and lets the aircraft idle around.
An aircraft with all it's data.
Team management for the campaign gametype headers.
static int AIR_GetSlotItems(aircraftItemType_t type, const aircraft_t *aircraft)
Returns the amount of assigned items for a given slot of a given aircraft.
mission_t * MIS_GetByIdx(int id)
Find mission corresponding to idx.
void AIR_AircraftSelect(aircraft_t *aircraft)
Sets aircraftCurrent and updates related cvars and menutexts.
static void AIR_AircraftFillList_f(void)
Update aircraft selection list with the current base aircraft names.
const char *IMPORT * Cmd_Argv(int n)
aircraftSlot_t electronics[MAX_AIRCRAFTSLOT]
void GEO_SelectAircraft(aircraft_t *aircraft)
Select the specified aircraft on the geoscape.
#define GEO_IsAircraftSelected(aircraft)