UFO: Alien Invasion
Loading...
Searching...
No Matches
cp_popup.cpp File Reference

Manage popups. More...

#include "../../DateTime.h"
#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"
Include dependency graph for cp_popup.cpp:

Go to the source code of this file.

Data Structures

struct  popup_intercept_t

Macros

#define POPUP_INTERCEPT_MAX_AIRCRAFT   64
#define AIR_ForeachSorted(var, sorter, userdata, sortedlist)

Functions

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

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

◆ AIR_ForeachSorted

#define AIR_ForeachSorted ( var,
sorter,
userdata,
sortedlist )
Value:
LIST_ForeachSorted(ccs.aircraft, aircraft_t, var, sorter, userdata, sortedlist)
ccs_t ccs
#define LIST_ForeachSorted(list, type, var, sorter, userdata, sortedlist)
Will sort the list before loop over the sorted list. Make sure to free the sortedList after you are d...
Definition list.h:50
An aircraft with all it's data.
Todo
Sorting need to be moved to the UI (Lua) side

Definition at line 179 of file cp_popup.cpp.

Referenced by CL_DisplayPopupInterceptMission(), and CL_DisplayPopupInterceptUFO().

◆ POPUP_INTERCEPT_MAX_AIRCRAFT

#define POPUP_INTERCEPT_MAX_AIRCRAFT   64

Max aircraft in popup list

Definition at line 39 of file cp_popup.cpp.

Referenced by CL_DisplayPopupInterceptMission(), and CL_DisplayPopupInterceptUFO().

Function Documentation

◆ AIR_SortByDistance()

int AIR_SortByDistance ( linkedList_t * aircraftEntry1,
linkedList_t * aircraftEntry2,
const void * userData )
static

◆ CL_DisplayHomebasePopup()

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 67 of file cp_popup.cpp.

References _, AIR_CheckMoveIntoNewHomebase(), B_GetNext(), cgi, Com_sprintf(), CP_GameTimeStop(), GEO_SelectAircraft(), aircraft_t::homebase, base_t::idx, INVALID_BASE, LIST_Add(), MAX_VAR, base_t::name, popupListData, popupListNode, popupNum, and VectorSet.

Referenced by AIR_ShowChangeHomebaseAircraft_f(), and CL_PopupChangeHomebase_f().

◆ CL_DisplayPopupInterceptMission()

◆ CL_DisplayPopupInterceptUFO()

◆ CL_PopupChangeHomebase_f()

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 123 of file cp_popup.cpp.

References AIR_CheckMoveIntoNewHomebase(), AIR_MoveAircraftIntoNewHomebase(), B_GetFoundedBaseByIDX(), cgi, CL_DisplayHomebasePopup(), data, DEBUG_CLIENT, GEO_GetSelectedAircraft, i, INVALID_BASE, popupListData, and popupNum.

Referenced by CL_PopupInit().

◆ CL_PopupInit()

◆ CL_PopupInterceptBaseClick_f()

void CL_PopupInterceptBaseClick_f ( void )
static

◆ CL_PopupInterceptClick_f()

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 341 of file cp_popup.cpp.

References _, AIR_SendAircraftPursuingUFO(), AIR_SendAircraftToMission(), B_COMMAND, B_GetBuildingStatus(), CL_PopupInterceptGetAircraft(), CP_Popup(), aircraft_t::homebase, and popupIntercept.

Referenced by CL_PopupInit().

◆ CL_PopupInterceptGetAircraft()

aircraft_t * CL_PopupInterceptGetAircraft ( void )
static

return the selected aircraft in popup_intercept Close the popup if required

Definition at line 319 of file cp_popup.cpp.

References cgi, and popupIntercept.

Referenced by CL_PopupInterceptClick_f(), and CL_PopupInterceptRClick_f().

◆ CL_PopupInterceptRClick_f()

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 370 of file cp_popup.cpp.

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

Referenced by CL_PopupInit().

◆ CP_Popup()

Variable Documentation

◆ INVALID_BASE

int INVALID_BASE = -1
static

Definition at line 55 of file cp_popup.cpp.

Referenced by CL_DisplayHomebasePopup(), and CL_PopupChangeHomebase_f().

◆ popupIntercept

popup_intercept_t popupIntercept
static

◆ popupListData

linkedList_t* popupListData = nullptr
static

Further datas needed when popup is clicked

Definition at line 52 of file cp_popup.cpp.

◆ popupListNode

uiNode_t* popupListNode = nullptr
static

Node used for popup

Definition at line 53 of file cp_popup.cpp.

◆ popupNum

int popupNum
static

Reservation-popup info Number of entries in the popup list

Definition at line 51 of file cp_popup.cpp.

Referenced by CL_DisplayHomebasePopup(), and CL_PopupChangeHomebase_f().