42 return cgi->LIST_Count(
ccs.installations);
56 cgi->Com_Printf(
"unknown type given '%s'\n",
type);
97 if (installation->idx == idx)
113 for (idx = 0; idx <
ccs.numInstallationTemplates; idx++) {
131 for (idx = 0; idx <
ccs.numInstallationTemplates; idx++) {
149 const int newInstallationAlienInterest = 1.0f;
155 installation.
idx =
ccs.campaignStats.installationsBuilt;
169 ccs.campaignStats.installationsBuilt++;
170 return &
LIST_Add(&
ccs.installations, installation);
193 cgi->LIST_Remove(&
ccs.installations, installation);
203 if (installation->selected)
218 ins->
selected = (ins == installation);
221 cgi->Cvar_Set(
"mn_installation_title",
"%s", installation->
name);
224 cgi->Cvar_Set(
"mn_installation_title",
"");
225 cgi->Cvar_Set(
"mn_installation_type",
"");
238 cgi->Com_Error(
ERR_DROP,
"INS_FinishInstallation: No Installation.\n");
240 cgi->Com_Error(
ERR_DROP,
"INS_FinishInstallation: No Installation template.\n");
242 cgi->Com_DPrintf(
DEBUG_CLIENT,
"INS_FinishInstallation: Installation is not being built.\n");
263static void INS_InstallationList_f (
void)
266 cgi->Com_Printf(
"Installation idx %i\n", installation->idx);
267 cgi->Com_Printf(
"Installation name %s\n", installation->name);
268 cgi->Com_Printf(
"Installation pos %.02f:%.02f\n", installation->pos[0], installation->pos[1]);
269 cgi->Com_Printf(
"Installation Alien interest %f\n", installation->alienInterest);
271 cgi->Com_Printf(
"\nInstallation sensorWidth %i\n", installation->radar.range);
272 cgi->Com_Printf(
"\nInstallation trackingWidth %i\n", installation->radar.trackingRange);
273 cgi->Com_Printf(
"Installation numSensoredAircraft %i\n\n", installation->radar.numUFOs);
275 cgi->Com_Printf(
"\nInstallation numBatteries %i\n", installation->numBatteries);
278 cgi->Com_Printf(
"\nInstallation stored UFOs %i/%i\n", installation->ufoCapacity.cur, installation->ufoCapacity.max);
281 cgi->Com_Printf(
"\n\n");
288static void INS_ConstructionFinished_f (
void)
292 if (
cgi->Cmd_Argc() == 2) {
293 idx = atoi(
cgi->Cmd_Argv(1));
295 cgi->Com_Printf(
"Usage: %s [installationIDX]\nWithout parameter it builds up all.\n",
cgi->Cmd_Argv(0));
301 if (idx >= 0 && ins->idx != idx)
317 if (free && installation->ufoCapacity.cur >= installation->ufoCapacity.max)
328 {
"debug_listinstallation", INS_InstallationList_f,
"Print installation information to the game console"},
329 {
"debug_finishinstallation", INS_ConstructionFinished_f,
"Finish construction of a specified or every installation"},
331 {
nullptr,
nullptr,
nullptr}
346 cgi->LIST_Delete(&
ccs.installations);
358 && installation->buildStart
359 && installation->buildStart + installation->installationTemplate->buildTime <=
ccs.date.getDateAsDays()) {
396 if (!*text || *token !=
'{') {
397 cgi->Com_Printf(
"INS_ParseInstallations: installation \"%s\" without body ignored\n",
name);
402 cgi->Com_Printf(
"INS_ParseInstallations: installation name not specified.\n");
407 cgi->Com_Printf(
"INS_ParseInstallations: too many installation templates\n");
412 for (
int i = 0;
i <
ccs.numInstallationTemplates;
i++) {
414 cgi->Com_Printf(
"INS_ParseInstallations: Second installation with same name found (%s) - second ignored\n",
name);
427 ccs.numInstallationTemplates++;
428 const char* errhead =
"INS_ParseInstallations: unexpected end of file (names ";
431 token =
cgi->Com_EParse(text, errhead,
name);
441 token =
cgi->Com_EParse(text, errhead,
name);
453 for (
int i = 0;
i <
ccs.numInstallationTemplates;
i++) {
457 ins->
tech = techLink;
518 cgi->Com_Printf(
"Invalid installation index %i\n", inst.
idx);
525 cgi->Com_Printf(
"Could not find installation template '%s'\n", instID);
531 cgi->Com_Printf(
"Invalid installation status '%s'\n", instStat);
558 cgi->Com_Printf(
"INS_LoadXML: Batteries not defined!\n");
564 cgi->Com_Printf(
"Installation has more batteries than possible, using upper bound\n");
DateTime class definition.
CGAME_HARD_LINKED_FUNCTIONS linkedList_t * LIST_Add(linkedList_t **listDest, void const *data, size_t length)
Share stuff between the different cgame implementations.
Header file for aircraft stuff.
int B_LoadBaseSlotsXML(baseWeapon_t *weapons, int max, xmlNode_t *p)
Loads the missile and laser slots of a base or sam site.
void B_SaveBaseSlotsXML(const baseWeapon_t *weapons, const int numWeapons, xmlNode_t *node)
Saves the missile and laser slots of a base or sam site.
memPool_t * cp_campaignPool
Header file for single player campaign control.
const cgame_import_t * cgi
void INS_DestroyInstallation(installation_t *installation)
Destroys an installation.
static void INS_FinishInstallation(installation_t *installation)
Finishes an installation.
installation_t * INS_Build(const installationTemplate_t *installationTemplate, const vec2_t pos, const char *name)
Build a new installation.
void INS_LinkTechnologies(void)
const installationTemplate_t * INS_GetInstallationTemplateByType(installationType_t type)
Returns the installation Template for a given installation type.
static const cmdList_t debugInstallationCmds[]
const installationTemplate_t * INS_GetInstallationTemplateByID(const char *id)
Returns the installation Template for a given installation ID.
bool INS_SaveXML(xmlNode_t *p)
Save callback for savegames in xml.
void INS_ParseInstallations(const char *name, const char **text)
Copies an entry from the installation description file into the list of installation templates.
installation_t * INS_GetCurrentSelectedInstallation(void)
Returns the current selected installation.
void INS_SetCurrentSelectedInstallation(const installation_t *installation)
Sets the currently selected installation.
bool INS_HasAny(installationStatus_t status)
Checks whether any installation is available.
installation_t * INS_GetFirstUFOYard(bool free)
returns the first installation with (free) ufostoring capacity
void INS_UpdateInstallationData(void)
Check if some installation are build.
bool INS_LoadXML(xmlNode_t *p)
Load callback for savegames.
int INS_GetCount(void)
Get number of installations.
installation_t * INS_GetByIDX(int idx)
Get installation by it's index.
void INS_InitStartup(void)
Resets console commands.
bool INS_HasType(installationType_t type, installationStatus_t status)
Checks whether the given installation type is available.
void INS_Shutdown(void)
Closing operations for installations subsystem.
installationType_t INS_GetType(const char *type)
static const value_t installation_vals[]
Header for installation management related stuff.
#define MAX_INSTALLATION_TEMPLATES
#define INS_ForeachOfType(var, installationType)
installationStatus_t
Possible installation states.
@ INSTALLATION_UNDER_CONSTRUCTION
void BDEF_InitialiseInstallationSlots(installation_t *installation)
Initialise all values of installation slot defence.
Header for slot management related stuff.
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_DESTROY
@ NT_INSTALLATION_BUILDFINISH
char cp_messageBuffer[MAX_MESSAGE_TEXT]
void CP_MissionNotifyInstallationDestroyed(const installation_t *installation)
Notify missions that an installation has been destroyed.
Campaign missions headers.
void RADAR_Initialise(radar_t *radar, float range, float trackingRange, float level, bool updateSourceRadarMap)
Set radar range to new value.
void RADAR_InitialiseUFOs(radar_t *radar)
Reset UFO sensored on radar.
void RADAR_UpdateInstallationRadarCoverage(installation_t *installation, const float radarRange, const float trackingRadarRange)
Update radar coverage when building/destroying new radar.
technology_t * RS_GetTechByProvided(const char *idProvided)
returns a pointer to the item tech (as listed in "provides")
void US_RemoveUFOsExceedingCapacity(installation_t *installation)
Removes ufos which are over the storing capacity.
const char * Com_Parse(const char *data_p[], char *target, size_t size, bool replaceWhitespaces)
Parse a token out of a string.
Shared parsing functions.
QGL_EXTERN GLint GLenum type
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
XML tag constants for savegame.
#define SAVE_INSTALLATION_BATTERIES
static const constListEntry_t saveInstallationConstants[]
#define SAVE_INSTALLATION_NAME
#define SAVE_INSTALLATION_ALIENINTEREST
#define SAVE_INSTALLATIONSTATUS_NAMESPACE
#define SAVE_INSTALLATION_INSTALLATIONS
#define SAVE_INSTALLATION_STATUS
#define SAVE_INSTALLATION_NUM
#define SAVE_INSTALLATION_IDX
#define SAVE_INSTALLATION_POS
#define SAVE_INSTALLATION_BUILDSTART
#define SAVE_INSTALLATION_DAMAGE
#define SAVE_INSTALLATION_INSTALLATION
#define SAVE_INSTALLATION_TEMPLATEID
#define MEMBER_SIZEOF(TYPE, MEMBER)
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
A installation with all it's data.
const installationTemplate_t * installationTemplate
baseWeapon_t batteries[MAX_INSTALLATION_BATTERIES]
installationStatus_t installationStatus
struct technology_s * tech
This is the technology parsed from research.ufo.
#define Vector2Copy(src, dest)