UFO: Alien Invasion
Loading...
Searching...
No Matches
cp_ufo_callbacks.cpp
Go to the documentation of this file.
1
5
6/*
7Copyright (C) 2002-2025 UFO: Alien Invasion.
8
9This program is free software; you can redistribute it and/or
10modify it under the terms of the GNU General Public License
11as published by the Free Software Foundation; either version 2
12of the License, or (at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18See the GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23*/
24
25#include "../../cl_shared.h"
26#include "cp_ufo_callbacks.h"
27#include "cp_campaign.h"
28#include "cp_geoscape.h"
29#include "cp_ufo.h"
30#include "cp_popup.h"
31
35static void UFO_GeoSelectUFO_f (void)
36{
37 if (cgi->Cmd_Argc() < 2) {
38 return;
39 }
40
41 const int index = atoi(cgi->Cmd_Argv(1));
42 if (index < 0 || index >= ccs.numUFOs)
43 return;
44 aircraft_t* aircraft = UFO_GetByIDX(index);
45 if (aircraft == nullptr)
46 return;
47
48 if (!GEO_IsUFOSelected(aircraft))
49 GEO_SelectUFO(aircraft);
52}
53
54static const cmdList_t ufoCallbacks[] = {
55 {"geo_ufo_select", UFO_GeoSelectUFO_f, nullptr},
56 {nullptr, nullptr, nullptr}
57};
58
60{
61 cgi->Cmd_TableAddList(ufoCallbacks);
62}
63
65{
66 cgi->Cmd_TableRemoveList(ufoCallbacks);
67}
Share stuff between the different cgame implementations.
ccs_t ccs
Header file for single player campaign control.
const cgame_import_t * cgi
void GEO_SelectUFO(aircraft_t *ufo)
Select the specified ufo on the geoscape.
Header for Geoscape management.
#define GEO_IsUFOSelected(ufo)
Definition cp_geoscape.h:53
void CL_DisplayPopupInterceptUFO(aircraft_t *ufo)
Display the popup_intercept.
Definition cp_popup.cpp:238
aircraft_t * UFO_GetByIDX(const int idx)
returns the UFO on the geoscape with a certain index
Definition cp_ufo.cpp:85
void UFO_InitCallbacks(void)
static void UFO_GeoSelectUFO_f(void)
Select ufo on Geoscape.
void UFO_ShutdownCallbacks(void)
static const cmdList_t ufoCallbacks[]
Header file for menu related console command callbacks.
QGL_EXTERN GLuint index
Definition r_gl.h:110
An aircraft with all it's data.