UFO: Alien Invasion
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)   LIST_ForeachSorted(ccs.aircraft, aircraft_t, var, sorter, userdata, sortedlist)
 

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

◆ AIR_ForeachSorted

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

◆ POPUP_INTERCEPT_MAX_AIRCRAFT

#define POPUP_INTERCEPT_MAX_AIRCRAFT   64

Max aircraft in popup list

Definition at line 39 of file cp_popup.cpp.

Function Documentation

◆ AIR_SortByDistance()

static 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, uiNode_t::selectedColor, cgame_import_t::UI_PopupList(), and VectorSet.

Referenced by AIR_ShowChangeHomebaseAircraft_f(), and CL_PopupChangeHomebase_f().

◆ CL_DisplayPopupInterceptMission()

◆ CL_DisplayPopupInterceptUFO()

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

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

Referenced by CL_PopupInit().

◆ CL_PopupInit()

void CL_PopupInit ( void  )

◆ CL_PopupInterceptBaseClick_f()

static void CL_PopupInterceptBaseClick_f ( void  )
static

◆ CL_PopupInterceptClick_f()

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

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

Referenced by CL_PopupInit().

◆ CL_PopupInterceptGetAircraft()

static 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 popup_intercept_t::aircraft, cgi, cgame_import_t::Cmd_Argv(), popup_intercept_t::numAircraft, and popupIntercept.

Referenced by CL_PopupInterceptClick_f(), and CL_PopupInterceptRClick_f().

◆ 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 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.

Referenced by CL_DisplayHomebasePopup(), and CL_PopupChangeHomebase_f().

◆ popupListNode

uiNode_t* popupListNode = nullptr
static

Node used for popup

Definition at line 53 of file cp_popup.cpp.

Referenced by CL_DisplayHomebasePopup().

◆ 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().