44 cgi->Cvar_Set(
"mn_installation_title",
"%s #%i", (insTemp) ?
_(insTemp->
name) :
_(
"Installation"),
ccs.campaignStats.installationsBuilt + 1);
62 cgi->Com_DPrintf(
DEBUG_CLIENT,
"INS_SelectInstallation: select installation with id %i\n", installation->
idx);
65 cgi->Cvar_Set(
"mn_installation_timetobuild",
"-");
67 cgi->Cvar_Set(
"mn_installation_timetobuild",
ngettext(
"%d day",
"%d days", timetobuild), timetobuild);
73 cgi->UI_PushWindow(
"popup_ufoyards");
76 cgi->UI_PushWindow(
"basedefence");
79 cgi->UI_PushWindow(
"popup_installationstatus");
91 if (
cgi->Cmd_Argc() < 1) {
92 cgi->Com_Printf(
"Usage: %s <installationType>\n",
cgi->Cmd_Argv(0));
101 if (!installationTemplate) {
102 cgi->Com_Printf(
"The installation type %s passed for %s is not valid.\n",
cgi->Cmd_Argv(1),
cgi->Cmd_Argv(0));
106 assert(installationTemplate->
cost >= 0);
108 if (
ccs.credits - installationTemplate->
cost > 0) {
130 CP_Popup(
_(
"Notice"),
_(
"Not enough credits to set up a new installation."));
144 if (
cgi->Cmd_Argc() < 2) {
145 cgi->Com_Printf(
"Usage: %s <installationID>\n",
cgi->Cmd_Argv(0));
148 installationID = atoi(
cgi->Cmd_Argv(1));
151 if (installation !=
nullptr)
168 Q_strncpyz(installation->
name,
cgi->Cvar_GetString(
"mn_installation_title"),
sizeof(installation->
name));
179 if (
cgi->Cmd_Argc() < 2 || atoi(
cgi->Cmd_Argv(1)) < 0) {
184 cgi->Com_DPrintf(
DEBUG_CLIENT,
"Installation not founded (idx %i)\n", atoi(
cgi->Cmd_Argv(1)));
190 if (
cgi->Cmd_Argc() < 3 || !atoi(
cgi->Cmd_Argv(2))) {
193 Com_sprintf(command,
sizeof(command),
"mn_installation_destroy %d 1; ui_pop;", installation->
idx);
194 cgi->UI_PopupButton(
_(
"Destroy Installation"),
_(
"Do you really want to destroy this installation?"),
195 command,
_(
"Destroy"),
_(
"Destroy installation"),
196 "ui_pop;",
_(
"Cancel"),
_(
"Forget it"),
197 nullptr,
nullptr,
nullptr);
218 cgi->UI_ExecuteConfunc(
"ufolist_clear");
219 if (
cgi->Cmd_Argc() < 2 || atoi(
cgi->Cmd_Argv(1)) < 0) {
226 cgi->Com_DPrintf(
DEBUG_CLIENT,
"Installation not founded (idx %i)\n", atoi(
cgi->Cmd_Argv(1)));
234 const char* nationName = nat ?
_(nat->
name) :
"";
236 cgi->UI_ExecuteConfunc(
"ufolist_addufoyard %d \"%s\" \"%s\" %d %d \"%s\"", ins->
idx, ins->
name, nationName, ins->
ufoCapacity.
max, freeCap, buildTime);
239 if (ufo->installation != ins)
242 const char* ufoName =
UFO_GetName(ufo->ufoTemplate);
243 const char* condition =
va(
_(
"Condition: %3.0f%%"), ufo->condition * 100);
245 cgi->UI_ExecuteConfunc(
"ufolist_addufo %d \"%s\" \"%s\" \"%s\" \"%s\"", ufo->idx, ufoName, condition, ufo->ufoTemplate->model, status);
255 cgi->UI_ExecuteConfunc(
"installationtype_clear");
257 for (
int i = 0;
i <
ccs.numInstallationTemplates;
i++) {
262 cgi->UI_ExecuteConfunc(
"installationtype_add \"%s\" \"%s\" \"%s\" \"%d c\"", tpl->
id,
_(tpl->
name),
270 cgi->UI_ExecuteConfunc(
"installationtype_add base \"%s\" - \"%d c\"",
_(
"Base"),
ccs.curCampaign->basecost);
278 if (
cgi->Cmd_Argc() < 2)
281 const char*
id =
cgi->Cmd_Argv(1);
290 cgi->Com_Printf(
"Invalid installation template\n");
295 cgi->Com_Printf(
"Maximum number of installations reached\n");
300 cgi->Com_Printf(
"This type of installation is not yet researched\n");
305 cgi->Com_Printf(
"Cannot build more of this installation\n");
316 cgi->Cvar_Set(
"mn_installation_type",
"%s", tpl->
id);
317 cgi->Cvar_Set(
"mn_installation_cost",
"%d", tpl->
cost);
318 cgi->Cvar_Set(
"mn_installation_timetobuild",
"%d", tpl->
buildTime);
322 {
"mn_installation_select",
INS_SelectInstallation_f,
"Parameter is the installation index. -1 will build a new one."},
327 {
"ui_fill_installationtypes",
INS_FillTypes_f,
"Fills create installation / installation type selection popup"},
328 {
"ui_build_installationtype",
INS_SelectType_f,
"Selects installation type to build"},
330 {
nullptr,
nullptr,
nullptr}
337 cgi->Cvar_Set(
"mn_installation_title",
"");
338 cgi->Cvar_Set(
"mn_installation_type",
"");
339 cgi->Cvar_Set(
"mn_installation_max",
"");
346 cgi->Cvar_Delete(
"mn_installation_count");
347 cgi->Cvar_Delete(
"mn_installation_title");
348 cgi->Cvar_Delete(
"mn_installation_max");
349 cgi->Cvar_Delete(
"mn_installation_type");
DateTime class definition.
Share stuff between the different cgame implementations.
void B_SetCurrentSelectedBase(const base_t *base)
Sets the selected base.
int B_GetCount(void)
Returns the count of founded bases.
int B_GetInstallationLimit(void)
Counts the actual installation count limit.
void CP_UpdateCredits(int credits)
Sets credits and update mn_credits cvar.
Header file for single player campaign control.
const cgame_import_t * cgi
nation_t * GEO_GetNation(const vec2_t pos)
Translate nation map color to nation.
void GEO_SetOverlay(const char *overlayID, int status)
Turn overlay on/off.
bool GEO_IsRadarOverlayActivated(void)
void GEO_ResetAction(void)
No more special action on the geoscape.
Header for Geoscape management.
void INS_DestroyInstallation(installation_t *installation)
Destroys an installation.
installation_t * INS_Build(const installationTemplate_t *installationTemplate, const vec2_t pos, const char *name)
Build a new installation.
const installationTemplate_t * INS_GetInstallationTemplateByType(installationType_t type)
Returns the installation Template for a given installation type.
const installationTemplate_t * INS_GetInstallationTemplateByID(const char *id)
Returns the installation Template for a given installation ID.
installation_t * INS_GetCurrentSelectedInstallation(void)
Returns the current selected installation.
void INS_SetCurrentSelectedInstallation(const installation_t *installation)
Sets the currently selected installation.
installation_t * INS_GetFirstUFOYard(bool free)
returns the first installation with (free) ufostoring capacity
int INS_GetCount(void)
Get number of installations.
installation_t * INS_GetByIDX(int idx)
Get installation by it's index.
bool INS_HasType(installationType_t type, installationStatus_t status)
Checks whether the given installation type is available.
Header for installation management related stuff.
@ INSTALLATION_UNDER_CONSTRUCTION
static void INS_UpdateInstallationLimit_f(void)
updates the installation limit cvar for menus
static void INS_ChangeInstallationName_f(void)
Creates console command to change the name of a installation. Copies the value of the cvar mn_install...
static void INS_FillUFOYardData_f(void)
Fills the UI with ufo yard data.
static void INS_SelectInstallation_f(void)
Called when an installation is opened or a new installation is created on geoscape....
static const cmdList_t installationCallbacks[]
void INS_InitCallbacks(void)
static void INS_SetInstallationTitle(installationType_t type)
Sets the title of the installation to a cvar to prepare the rename menu.
void INS_SelectInstallation(installation_t *installation)
Select an installation when clicking on it on geoscape.
static void INS_FillTypes_f(void)
Fills create installation / installation type selection popup.
static void INS_DestroyInstallation_f(void)
console function for destroying an installation
static void INS_SelectType_f(void)
Selects installation type to build.
void INS_ShutdownCallbacks(void)
static void INS_BuildInstallation_f(void)
Constructs a new installation.
Header file for menu related console command callbacks.
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...
@ NT_INSTALLATION_BUILDSTART
char cp_messageBuffer[MAX_MESSAGE_TEXT]
bool RS_IsResearched_ptr(const technology_t *tech)
Checks whether an item is already researched.
const char * UFO_GetName(const aircraft_t *ufocraft)
Returns name of the UFO if UFO has been researched.
const char * US_StoredUFOStatus(const storedUFO_t *ufo)
Returns string representation of the stored UFO's status.
UFO recovery and storing callback header file.
#define ngettext(x, y, cnt)
QGL_EXTERN GLint GLenum type
#define Q_strvalid(string)
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
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...
A installation with all it's data.
const installationTemplate_t * installationTemplate
installationStatus_t installationStatus
struct technology_s * tech