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

Manage popups. More...

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

Go to the source code of this file.

Data Structures

struct  popup_intercept_s
 

Macros

#define POPUP_INTERCEPT_MAX_AIRCRAFT   64
 
#define AIR_ForeachSorted(var, sorter, userdata, sortedlist)   LIST_ForeachSorted(ccs.aircraft, aircraft_t, var, sorter, userdata, sortedlist)
 

Typedefs

typedef struct popup_intercept_s popup_intercept_t
 

Functions

bool CL_DisplayHomebasePopup (aircraft_t *aircraft, bool alwaysDisplay)
 Display the popup_homebase. More...
 
static void CL_PopupChangeHomebase_f (void)
 User select a base in the popup_homebase change homebase to selected base. More...
 
static int AIR_SortByDistance (linkedList_t *aircraftEntry1, linkedList_t *aircraftEntry2, const void *userData)
 
void CL_DisplayPopupInterceptMission (mission_t *mission)
 Display the popup_mission. More...
 
void CL_DisplayPopupInterceptUFO (aircraft_t *ufo)
 Display the popup_intercept. More...
 
static aircraft_tCL_PopupInterceptGetAircraft (void)
 return the selected aircraft in popup_intercept Close the popup if required More...
 
static void CL_PopupInterceptClick_f (void)
 User select an item in the popup_aircraft Make the aircraft attack the corresponding mission or UFO. More...
 
static void CL_PopupInterceptRClick_f (void)
 User select an item in the popup_aircraft with right click Opens up the aircraft menu. More...
 
static void CL_PopupInterceptBaseClick_f (void)
 User select a base in the popup_aircraft Make the base attack the corresponding UFO. More...
 
void CL_PopupInit (void)
 Initialise popups. More...
 
void CP_Popup (const char *title, const char *text,...)
 Wrapper around UI_Popup. More...
 

Variables

static popup_intercept_t popupIntercept
 
static int popupNum
 
static linkedList_tpopupListData = nullptr
 
static uiNode_tpopupListNode = nullptr
 
static int INVALID_BASE = -1
 

Detailed Description

Manage popups.

Definition in file cp_popup.cpp.

Macro Definition Documentation

#define AIR_ForeachSorted (   var,
  sorter,
  userdata,
  sortedlist 
)    LIST_ForeachSorted(ccs.aircraft, aircraft_t, var, sorter, userdata, sortedlist)
Todo:
Sorting need to be moved to the UI (Lua) side

Definition at line 178 of file cp_popup.cpp.

Referenced by CL_DisplayPopupInterceptMission(), and CL_DisplayPopupInterceptUFO().

#define POPUP_INTERCEPT_MAX_AIRCRAFT   64

Max aircraft in popup list

Definition at line 38 of file cp_popup.cpp.

Referenced by CL_DisplayPopupInterceptMission(), and CL_DisplayPopupInterceptUFO().

Typedef Documentation

Function Documentation

static int AIR_SortByDistance ( linkedList_t aircraftEntry1,
linkedList_t aircraftEntry2,
const void userData 
)
static
bool CL_DisplayHomebasePopup ( aircraft_t aircraft,
bool  alwaysDisplay 
)

Display the popup_homebase.

Parameters
[in]aircraftPointer to aircraft we want to change homebase.
[in]alwaysDisplayFalse if popup should be displayed only if at least one base is available.
Returns
true if popup is displayed.

< Set color for selected entry.

Definition at line 66 of file cp_popup.cpp.

References _, AIR_CheckMoveIntoNewHomebase(), B_GetNext(), cgi, Com_sprintf(), CP_GameTimeStop(), GEO_SelectAircraft(), aircraft_s::homebase, base_s::idx, INVALID_BASE, LIST_Add(), MAX_VAR, base_s::name, popupNum, uiNode_t::selectedColor, cgame_import_s::UI_PopupList(), and VectorSet.

Referenced by AIR_ShowChangeHomebaseAircraft_f(), and CL_PopupChangeHomebase_f().

static void CL_PopupChangeHomebase_f ( void  )
static

User select a base in the popup_homebase change homebase to selected base.

< Use this so we do not change the original popupListData pointer.

Definition at line 122 of file cp_popup.cpp.

References AIR_CheckMoveIntoNewHomebase(), AIR_MoveAircraftIntoNewHomebase(), B_GetFoundedBaseByIDX(), cgi, CL_DisplayHomebasePopup(), cgame_import_s::Cmd_Argv(), linkedList_t::data, DEBUG_CLIENT, GEO_GetSelectedAircraft, i, INVALID_BASE, linkedList_t::next, popupListData, and popupNum.

Referenced by CL_PopupInit().

void CL_PopupInit ( void  )
static void CL_PopupInterceptBaseClick_f ( void  )
static
static void CL_PopupInterceptClick_f ( void  )
static

User select an item in the popup_aircraft Make the aircraft attack the corresponding mission or UFO.

Todo:
are these newlines really needed? at least the first should be handled by the menu code

Definition at line 340 of file cp_popup.cpp.

References _, AIR_SendAircraftPursuingUFO(), AIR_SendAircraftToMission(), B_COMMAND, B_GetBuildingStatus(), CL_PopupInterceptGetAircraft(), CP_Popup(), aircraft_s::homebase, popup_intercept_s::mission, and popup_intercept_s::ufo.

Referenced by CL_PopupInit().

static aircraft_t* CL_PopupInterceptGetAircraft ( void  )
static

return the selected aircraft in popup_intercept Close the popup if required

Definition at line 318 of file cp_popup.cpp.

References popup_intercept_s::aircraft, cgi, cgame_import_s::Cmd_Argv(), and popup_intercept_s::numAircraft.

Referenced by CL_PopupInterceptClick_f(), and CL_PopupInterceptRClick_f().

static void CL_PopupInterceptRClick_f ( void  )
static

User select an item in the popup_aircraft with right click Opens up the aircraft menu.

Definition at line 369 of file cp_popup.cpp.

References AIR_AircraftSelect(), B_SelectBase(), cgi, CL_PopupInterceptGetAircraft(), GEO_ResetAction(), and aircraft_s::homebase.

Referenced by CL_PopupInit().

Variable Documentation

int INVALID_BASE = -1
static

Definition at line 54 of file cp_popup.cpp.

Referenced by CL_DisplayHomebasePopup(), and CL_PopupChangeHomebase_f().

popup_intercept_t popupIntercept
static

Data about popup_intercept

Definition at line 47 of file cp_popup.cpp.

linkedList_t* popupListData = nullptr
static

Further datas needed when popup is clicked

Definition at line 51 of file cp_popup.cpp.

Referenced by CL_PopupChangeHomebase_f().

uiNode_t* popupListNode = nullptr
static

Node used for popup

Definition at line 52 of file cp_popup.cpp.

int popupNum
static

Reservation-popup info Number of entries in the popup list

Definition at line 50 of file cp_popup.cpp.

Referenced by CL_DisplayHomebasePopup(), and CL_PopupChangeHomebase_f().