UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cp_aircraft_callbacks.cpp File Reference

Menu related console command callbacks. More...

#include "../../cl_shared.h"
#include "../../ui/ui_dataids.h"
#include "cp_campaign.h"
#include "cp_geoscape.h"
#include "cp_aircraft_callbacks.h"
#include "cp_aircraft.h"
#include "cp_team.h"
#include "cp_mapfightequip.h"
#include "cp_popup.h"
#include "cp_missions.h"

Go to the source code of this file.

Functions

static void AIM_AircraftReturnToBase_f (void)
 Script function for AIR_AircraftReturnToBase. More...
 
static void AIM_SelectAircraft_f (void)
 Select an aircraft from a base, by ID. More...
 
static void AIM_AircraftStart_f (void)
 Starts an aircraft or stops the current mission and lets the aircraft idle around. More...
 
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. More...
 
void AIR_AircraftSelect (aircraft_t *aircraft)
 Sets aircraftCurrent and updates related cvars and menutexts. More...
 
static void AIR_AircraftFillList_f (void)
 Update aircraft selection list with the current base aircraft names. More...
 
static void AIR_ChangeAircraftName_f (void)
 Creates console command to change the name of an aircraft. Copies the value of the cvar mn_aircraftname over as the name of the current selected aircraft. More...
 
static void AIR_GeoSelectAircraft_f (void)
 Select aircraft on Geoscape. More...
 
static void AIR_StopAircraft_f (void)
 Stop aircraft on Geoscape. More...
 
static void AIR_ShowChangeHomebaseAircraft_f (void)
 Show change homebase popup. More...
 
static void AIR_SendAircraftToMission_f (void)
 Send aircraft to land on a mission. More...
 
static void AIR_ShowAircraft_f (void)
 Show aircraft in Base sections. More...
 
void AIR_InitCallbacks (void)
 
void AIR_ShutdownCallbacks (void)
 

Variables

static const cmdList_t aircraftCallbacks []
 

Detailed Description

Menu related console command callbacks.

Definition in file cp_aircraft_callbacks.cpp.

Function Documentation

static void AIM_AircraftReturnToBase_f ( void  )
static

Script function for AIR_AircraftReturnToBase.

Note
Sends the current aircraft back to homebase (called from aircraft menu).
This function updates some cvars for current aircraft.
See also
GAME_CP_MissionAutoGo_f
GAME_CP_Results_f

Definition at line 43 of file cp_aircraft_callbacks.cpp.

References AIR_AircraftGetFromIDX(), AIR_AircraftReturnToBase(), AIR_AircraftSelect(), base_s::aircraftCurrent, B_GetCurrentSelectedBase(), cgi, cgame_import_s::Cmd_Argv(), and index.

static void AIM_AircraftStart_f ( void  )
static
static void AIM_SelectAircraft_f ( void  )
static

Select an aircraft from a base, by ID.

See also
AIR_AircraftSelect
AIM_PrevAircraft_f
AIM_NextAircraft_f

Definition at line 68 of file cp_aircraft_callbacks.cpp.

References AIR_AircraftSelect(), AIR_GetAircraftFromBaseByIDXSafe(), base_s::aircraftCurrent, B_GetCurrentSelectedBase(), cgi, cgame_import_s::Cmd_Argv(), and i.

static void AIR_AircraftFillList_f ( void  )
static

Update aircraft selection list with the current base aircraft names.

Definition at line 229 of file cp_aircraft_callbacks.cpp.

References _, AIR_AircraftStatusToName(), AIR_ForeachFromBase, AIR_GetTeamSize(), AIR_IsAircraftInBase(), AIR_STATS_DAMAGE, B_GetCurrentSelectedBase(), cgi, Com_sprintf(), and MAX_VAR.

static void AIR_ChangeAircraftName_f ( void  )
static

Creates console command to change the name of an aircraft. Copies the value of the cvar mn_aircraftname over as the name of the current selected aircraft.

Note
empty name will reset aircraft's name to the default
renaming to name with only non printable characters (eg. space) is denied
Todo:
make it not using cvar and default aircraft but get them from parameterlist

Definition at line 253 of file cp_aircraft_callbacks.cpp.

References _, base_s::aircraftCurrent, B_GetCurrentSelectedBase(), cgi, Com_IsValidName(), cgame_import_s::Cvar_GetString(), aircraft_s::defaultName, i, aircraft_s::name, Q_strncpyz(), and Q_strnull().

static void AIR_GeoSelectAircraft_f ( void  )
static
static int AIR_GetSlotItems ( aircraftItemType_t  type,
const aircraft_t aircraft 
)
static

Returns the amount of assigned items for a given slot of a given aircraft.

Parameters
[in]typeThis is the slot type to get the amount of assigned items for
[in]aircraftThe aircraft to count the items for (may not be nullptr)
Returns
The amount of assigned items for the given slot

Definition at line 134 of file cp_aircraft_callbacks.cpp.

References AC_ITEM_ELECTRONICS, AC_ITEM_SHIELD, AC_ITEM_WEAPON, cgi, aircraft_s::electronics, i, aircraftSlot_s::item, MAX_AIRCRAFTSLOT, aircraft_s::shield, and aircraft_s::weapons.

Referenced by AIR_AircraftSelect().

void AIR_InitCallbacks ( void  )

Definition at line 426 of file cp_aircraft_callbacks.cpp.

References cgi.

Referenced by AIR_InitStartup().

static void AIR_SendAircraftToMission_f ( void  )
static

Send aircraft to land on a mission.

Definition at line 371 of file cp_aircraft_callbacks.cpp.

References AIR_AircraftGetFromIDX(), AIR_SendAircraftToMission(), cgi, cgame_import_s::Cmd_Argv(), and MIS_GetByIdx().

static void AIR_ShowAircraft_f ( void  )
static
static void AIR_ShowChangeHomebaseAircraft_f ( void  )
static

Show change homebase popup.

Todo:
Temporary callback. Need to rewrite change homebase popup also

Definition at line 354 of file cp_aircraft_callbacks.cpp.

References AIR_AircraftGetFromIDX(), cgi, CL_DisplayHomebasePopup(), cgame_import_s::Cmd_Argv(), and index.

void AIR_ShutdownCallbacks ( void  )

Definition at line 431 of file cp_aircraft_callbacks.cpp.

References cgi.

Referenced by AIR_Shutdown().

static void AIR_StopAircraft_f ( void  )
static

Stop aircraft on Geoscape.

Definition at line 335 of file cp_aircraft_callbacks.cpp.

References AIR_AircraftGetFromIDX(), AIR_IDLE, cgi, cgame_import_s::Cmd_Argv(), and index.

Variable Documentation

const cmdList_t aircraftCallbacks[]
static
Initial value:
= {
{"aircraft_start", AIM_AircraftStart_f, nullptr},
{"ui_aircraft_select", AIM_SelectAircraft_f, nullptr},
{"geo_aircraft_select", AIR_GeoSelectAircraft_f, nullptr},
{"aircraft_return", AIM_AircraftReturnToBase_f, "Sends the current aircraft back to homebase."},
{"ui_aircraft_changename", AIR_ChangeAircraftName_f, "Callback to change the name of the aircraft."},
{"ui_aircraft_fill", AIR_AircraftFillList_f, "Send the data for all the aircraft."},
{"ui_aircraft_stop", AIR_StopAircraft_f, "Clears an aircraft order when on the geoscape"},
{"ui_aircraft_to_mission", AIR_SendAircraftToMission_f, "Send aircraft to a misison"},
{"ui_aircraft_changehomebase", AIR_ShowChangeHomebaseAircraft_f, ""},
{"ui_show_aircraft", AIR_ShowAircraft_f, "Show aircraft in base sections"},
{nullptr, nullptr, nullptr}
}
static void AIR_ShowChangeHomebaseAircraft_f(void)
Show change homebase popup.
static void AIR_GeoSelectAircraft_f(void)
Select aircraft on Geoscape.
static void AIR_ChangeAircraftName_f(void)
Creates console command to change the name of an aircraft. Copies the value of the cvar mn_aircraftna...
static void AIM_SelectAircraft_f(void)
Select an aircraft from a base, by ID.
static void AIR_StopAircraft_f(void)
Stop aircraft on Geoscape.
static void AIM_AircraftReturnToBase_f(void)
Script function for AIR_AircraftReturnToBase.
static void AIR_ShowAircraft_f(void)
Show aircraft in Base sections.
static void AIR_SendAircraftToMission_f(void)
Send aircraft to land on a mission.
static void AIM_AircraftStart_f(void)
Starts an aircraft or stops the current mission and lets the aircraft idle around.
static void AIR_AircraftFillList_f(void)
Update aircraft selection list with the current base aircraft names.

Definition at line 412 of file cp_aircraft_callbacks.cpp.