26 #include "../../cl_shared.h"
27 #include "../../ui/ui_dataids.h"
61 cgi->Com_DPrintf(
DEBUG_CLIENT,
"INS_SelectInstallation: select installation with id %i\n", installation->
idx);
66 cgi->
Cvar_Set(
"mn_installation_timetobuild",
ngettext(
"%d day",
"%d days", timetobuild), timetobuild);
72 cgi->UI_PushWindow(
"popup_ufoyards");
75 cgi->UI_PushWindow(
"basedefence");
78 cgi->UI_PushWindow(
"popup_installationstatus");
90 if (
cgi->Cmd_Argc() < 1) {
91 cgi->Com_Printf(
"Usage: %s <installationType>\n",
cgi->
Cmd_Argv(0));
100 if (!installationTemplate) {
105 assert(installationTemplate->
cost >= 0);
129 CP_Popup(
_(
"Notice"),
_(
"Not enough credits to set up a new installation."));
143 if (
cgi->Cmd_Argc() < 2) {
144 cgi->Com_Printf(
"Usage: %s <installationID>\n",
cgi->
Cmd_Argv(0));
150 if (installation !=
nullptr)
192 Com_sprintf(command,
sizeof(command),
"mn_installation_destroy %d 1; ui_pop;", installation->
idx);
193 cgi->UI_PopupButton(
_(
"Destroy Installation"),
_(
"Do you really want to destroy this installation?"),
194 command,
_(
"Destroy"),
_(
"Destroy installation"),
195 "ui_pop;",
_(
"Cancel"),
_(
"Forget it"),
196 nullptr,
nullptr,
nullptr);
217 cgi->UI_ExecuteConfunc(
"ufolist_clear");
233 const char* nationName = nat ?
_(nat->
name) :
"";
235 cgi->UI_ExecuteConfunc(
"ufolist_addufoyard %d \"%s\" \"%s\" %d %d \"%s\"", ins->
idx, ins->
name, nationName, ins->
ufoCapacity.
max, freeCap, buildTime);
238 if (ufo->installation != ins)
241 const char* ufoName =
UFO_GetName(ufo->ufoTemplate);
242 const char* condition =
va(
_(
"Condition: %3.0f%%"), ufo->condition * 100);
244 cgi->UI_ExecuteConfunc(
"ufolist_addufo %d \"%s\" \"%s\" \"%s\" \"%s\"", ufo->idx, ufoName, condition, ufo->ufoTemplate->model, status);
254 cgi->UI_ExecuteConfunc(
"installationtype_clear");
261 cgi->UI_ExecuteConfunc(
"installationtype_add \"%s\" \"%s\" \"%s\" \"%d c\"", tpl->
id,
_(tpl->
name),
277 if (
cgi->Cmd_Argc() < 2)
289 cgi->Com_Printf(
"Invalid installation template\n");
294 cgi->Com_Printf(
"Maximum number of installations reached\n");
299 cgi->Com_Printf(
"This type of installation is not yet researched\n");
304 cgi->Com_Printf(
"Cannot build more of this installation\n");
321 {
"mn_installation_select",
INS_SelectInstallation_f,
"Parameter is the installation index. -1 will build a new one."},
326 {
"ui_fill_installationtypes",
INS_FillTypes_f,
"Fills create installation / installation type selection popup"},
327 {
"ui_build_installationtype",
INS_SelectType_f,
"Selects installation type to build"},
329 {
nullptr,
nullptr,
nullptr}
333 cgi->Cmd_TableAddList(installationCallbacks);
343 cgi->Cmd_TableRemoveList(installationCallbacks);
345 cgi->Cvar_Delete(
"mn_installation_count");
346 cgi->Cvar_Delete(
"mn_installation_title");
347 cgi->Cvar_Delete(
"mn_installation_max");
348 cgi->Cvar_Delete(
"mn_installation_type");
Header file for menu related console command callbacks.
installationStatus_t installationStatus
uiMessageListNodeMessage_t * MSO_CheckAddNewMessage(const notify_t messagecategory, const char *title, const char *text, messageType_t type, technology_t *pedia, bool popup)
Adds a new message to message stack. It uses message settings to verify whether sound should be playe...
const installationTemplate_t * INS_GetInstallationTemplateByType(installationType_t type)
Returns the installation Template for a given installation type.
static void INS_DestroyInstallation_f(void)
console function for destroying an installation
bool RS_IsResearched_ptr(const technology_t *tech)
Checks whether an item is already researched.
A installation with all it's data.
QGL_EXTERN GLint GLenum type
static void INS_FillUFOYardData_f(void)
Fills the UI with ufo yard data.
const char * va(const char *format,...)
does a varargs printf into a temp buffer, so I don't need to have varargs versions of all text functi...
static void INS_UpdateInstallationLimit_f(void)
updates the installation limit cvar for menus
bool INS_HasType(installationType_t type, installationStatus_t status)
Checks whether the given installation type is available.
static void INS_FillTypes_f(void)
Fills create installation / installation type selection popup.
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
int numInstallationTemplates
Header for installation management related stuff.
installationTemplate_t installationTemplates[MAX_INSTALLATION_TEMPLATES]
void INS_SetCurrentSelectedInstallation(const installation_t *installation)
Sets the currently selected installation.
bool GEO_IsRadarOverlayActivated(void)
const char * UFO_GetName(const aircraft_t *ufocraft)
Returns name of the UFO if UFO has been researched.
int INS_GetCount(void)
Get number of installations.
UFO recovery and storing callback header file.
void GEO_ResetAction(void)
No more special action on the geoscape.
const char *IMPORT * Cvar_GetString(const char *varName)
#define Q_strvalid(string)
int B_GetCount(void)
Returns the count of founded bases.
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
static void INS_SelectInstallation_f(void)
Called when an installation is opened or a new installation is created on geoscape. For a new installation the installationID is -1.
cvar_t *IMPORT * Cvar_Set(const char *varName, const char *value,...) __attribute__((format(__printf__
#define ngettext(x, y, cnt)
void INS_InitCallbacks(void)
const cgame_import_t * cgi
static void INS_SetInstallationTitle(installationType_t type)
Sets the title of the installation to a cvar to prepare the rename menu.
void CP_UpdateCredits(int credits)
Sets credits and update mn_credits cvar.
struct technology_s * tech
static const cmdList_t installationCallbacks[]
Header for Geoscape management.
const installationTemplate_t * installationTemplate
void B_SetCurrentSelectedBase(const base_t *base)
Sets the selected base.
installation_t * INS_Build(const installationTemplate_t *installationTemplate, const vec2_t pos, const char *name)
Build a new installation.
char cp_messageBuffer[MAX_MESSAGE_TEXT]
static void INS_BuildInstallation_f(void)
Constructs a new installation.
int B_GetInstallationLimit(void)
Counts the actual installation count limit.
installation_t * INS_GetFirstUFOYard(bool free)
returns the first installation with (free) ufostoring capacity
installation_t * INS_GetCurrentSelectedInstallation(void)
Returns the current selected installation.
Header file for single player campaign control.
static void INS_SelectType_f(void)
Selects installation type to build.
void INS_SelectInstallation(installation_t *installation)
Select an installation when clicking on it on geoscape.
void INS_ShutdownCallbacks(void)
void GEO_SetOverlay(const char *overlayID, int status)
Turn overlay on/off.
const installationTemplate_t * INS_GetInstallationTemplateByID(const char *id)
Returns the installation Template for a given installation ID.
nation_t * GEO_GetNation(const vec2_t pos)
Translate nation map color to nation.
const char *IMPORT * Cmd_Argv(int n)
static void INS_ChangeInstallationName_f(void)
Creates console command to change the name of a installation. Copies the value of the cvar mn_install...
void INS_DestroyInstallation(installation_t *installation)
Destroys an installation.
const char * US_StoredUFOStatus(const storedUFO_t *ufo)
Returns string representation of the stored UFO's status.
installation_t * INS_GetByIDX(int idx)
Get installation by it's index.