27 #include "../../DateTime.h" 28 #include "../../cl_shared.h" 29 #include "../../../shared/parse.h" 56 cgi->Com_Printf(
"unknown type given '%s'\n",
type);
97 if (installation->idx == idx)
149 const int newInstallationAlienInterest = 1.0f;
203 if (installation->selected)
218 ins->selected = (ins == installation);
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");
263 static 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");
288 static void INS_ConstructionFinished_f (
void)
292 if (
cgi->Cmd_Argc() == 2) {
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}
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");
414 cgi->Com_Printf(
"INS_ParseInstallations: Second installation with same name found (%s) - second ignored\n",
name);
428 const char* errhead =
"INS_ParseInstallations: unexpected end of file (names ";
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");
xmlNode_t *IMPORT * XML_GetNode(xmlNode_t *parent, const char *name)
#define SAVE_INSTALLATION_NAME
installationType_t INS_GetType(const char *type)
void INS_LinkTechnologies(void)
void RADAR_Initialise(radar_t *radar, float range, float trackingRange, float level, bool updateSourceRadarMap)
Set radar range to new value.
void INS_InitStartup(void)
Resets console commands.
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.
void BDEF_InitialiseInstallationSlots(installation_t *installation)
Initialise all values of installation slot defence.
QGL_EXTERN GLint GLenum type
cvar_t *IMPORT * Cvar_Set(const char *varName, const char *value,...) __attribute__((format(__printf__
installationStatus_t
Possible installation states.
bool INS_HasType(installationType_t type, installationStatus_t status)
Checks whether the given installation type is available.
installationStatus_t installationStatus
void INS_UpdateInstallationData(void)
Check if some installation are build.
#define SAVE_INSTALLATION_BATTERIES
#define SAVE_INSTALLATION_DAMAGE
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
Header for installation management related stuff.
#define SAVE_INSTALLATION_INSTALLATIONS
void INS_SetCurrentSelectedInstallation(const installation_t *installation)
Sets the currently selected installation.
#define SAVE_INSTALLATION_NUM
bool INS_SaveXML(xmlNode_t *p)
Save callback for savegames in xml.
#define INS_ForeachOfType(var, installationType)
const char *IMPORT * Cmd_Argv(int n)
bool INS_HasAny(installationStatus_t status)
Checks whether any installation is available.
void RADAR_UpdateInstallationRadarCoverage(installation_t *installation, const float radarRange, const float trackingRadarRange)
Update radar coverage when building/destroying new radar.
void US_RemoveUFOsExceedingCapacity(installation_t *installation)
Removes ufos which are over the storing capacity.
A installation with all it's data.
int INS_GetCount(void)
Get number of installations.
memPool_t * cp_campaignPool
char *IMPORT * PoolStrDup(const char *in, memPool_t *pool, const int tagNum)
void RADAR_InitialiseUFOs(radar_t *radar)
Reset UFO sensored on radar.
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
void INS_Shutdown(void)
Closing operations for installations subsystem.
xmlNode_t *IMPORT * XML_GetPos3(xmlNode_t *parent, const char *name, vec3_t pos)
void INS_ParseInstallations(const char *name, const char **text)
Copies an entry from the installation description file into the list of installation templates...
Campaign missions headers.
int getDateAsDays() const
Return the date part of the DateTime as days.
const char *IMPORT * XML_GetString(xmlNode_t *parent, const char *name)
const cgame_import_t * cgi
static const constListEntry_t saveInstallationConstants[]
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.
#define SAVE_INSTALLATION_INSTALLATION
xmlNode_t *IMPORT * XML_GetNextNode(xmlNode_t *current, xmlNode_t *parent, const char *name)
bool INS_LoadXML(xmlNode_t *p)
Load callback for savegames.
#define SAVE_INSTALLATION_STATUS
#define MAX_INSTALLATION_TEMPLATES
baseWeapon_t batteries[MAX_INSTALLATION_BATTERIES]
installation_t * INS_Build(const installationTemplate_t *installationTemplate, const vec2_t pos, const char *name)
Build a new installation.
#define SAVE_INSTALLATION_IDX
char cp_messageBuffer[MAX_MESSAGE_TEXT]
XML tag constants for savegame.
CGAME_HARD_LINKED_FUNCTIONS linkedList_t * LIST_Add(linkedList_t **listDest, void const *data, size_t length)
#define SAVE_INSTALLATION_TEMPLATEID
const char * Com_Parse(const char *data_p[], char *target, size_t size, bool replaceWhitespaces)
Parse a token out of a string.
static const cmdList_t debugInstallationCmds[]
static const value_t installation_vals[]
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.
installation_t * INS_GetFirstUFOYard(bool free)
returns the first installation with (free) ufostoring capacity
Header for slot management related stuff.
void CP_MissionNotifyInstallationDestroyed(const installation_t *installation)
Notify missions that an installation has been destroyed.
#define SAVE_INSTALLATIONSTATUS_NAMESPACE
This is the technology parsed from research.ufo.
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
static void INS_FinishInstallation(installation_t *installation)
Finishes an installation.
linkedList_t * installations
struct technology_s * tech
#define MEMBER_SIZEOF(TYPE, MEMBER)
installation_t * INS_GetCurrentSelectedInstallation(void)
Returns the current selected installation.
int numInstallationTemplates
#define Vector2Copy(src, dest)
Header file for single player campaign control.
#define SAVE_INSTALLATION_ALIENINTEREST
technology_t * RS_GetTechByProvided(const char *idProvided)
returns a pointer to the item tech (as listed in "provides")
xmlNode_t *IMPORT * XML_AddNode(xmlNode_t *parent, const char *name)
installationTemplate_t installationTemplates[MAX_INSTALLATION_TEMPLATES]
#define SAVE_INSTALLATION_POS
const char *IMPORT * Com_GetConstVariable(const char *space, int value)
const char *IMPORT * Com_EParse(const char **text, const char *errhead, const char *errinfo)
const installationTemplate_t * installationTemplate
const installationTemplate_t * INS_GetInstallationTemplateByID(const char *id)
Returns the installation Template for a given installation ID.
void INS_DestroyInstallation(installation_t *installation)
Destroys an installation.
#define SAVE_INSTALLATION_BUILDSTART
installation_t * INS_GetByIDX(int idx)
Get installation by it's index.