27 #include "../../cl_shared.h"
28 #include "../../../shared/parse.h"
48 else if (
Q_streq(type,
"ufoyard"))
50 else if (
Q_streq(type,
"radartower"))
52 else if (
Q_streq(type,
"orbit"))
55 cgi->Com_Printf(
"unknown type given '%s'\n", type);
96 if (installation->idx == idx)
148 const int newInstallationAlienInterest = 1.0f;
202 if (installation->selected)
217 ins->selected = (ins == installation);
237 cgi->Com_Error(
ERR_DROP,
"INS_FinishInstallation: No Installation.\n");
239 cgi->Com_Error(
ERR_DROP,
"INS_FinishInstallation: No Installation template.\n");
241 cgi->Com_DPrintf(
DEBUG_CLIENT,
"INS_FinishInstallation: Installation is not being built.\n");
262 static void INS_InstallationList_f (
void)
265 cgi->Com_Printf(
"Installation idx %i\n", installation->idx);
266 cgi->Com_Printf(
"Installation name %s\n", installation->name);
267 cgi->Com_Printf(
"Installation pos %.02f:%.02f\n", installation->pos[0], installation->pos[1]);
268 cgi->Com_Printf(
"Installation Alien interest %f\n", installation->alienInterest);
270 cgi->Com_Printf(
"\nInstallation sensorWidth %i\n", installation->radar.range);
271 cgi->Com_Printf(
"\nInstallation trackingWidth %i\n", installation->radar.trackingRange);
272 cgi->Com_Printf(
"Installation numSensoredAircraft %i\n\n", installation->radar.numUFOs);
274 cgi->Com_Printf(
"\nInstallation numBatteries %i\n", installation->numBatteries);
277 cgi->Com_Printf(
"\nInstallation stored UFOs %i/%i\n", installation->ufoCapacity.cur, installation->ufoCapacity.max);
280 cgi->Com_Printf(
"\n\n");
287 static void INS_ConstructionFinished_f (
void)
291 if (
cgi->Cmd_Argc() == 2) {
294 cgi->Com_Printf(
"Usage: %s [installationIDX]\nWithout parameter it builds up all.\n",
cgi->
Cmd_Argv(0));
300 if (idx >= 0 && ins->idx != idx)
316 if (free && installation->ufoCapacity.cur >= installation->ufoCapacity.max)
327 {
"debug_listinstallation", INS_InstallationList_f,
"Print installation information to the game console"},
328 {
"debug_finishinstallation", INS_ConstructionFinished_f,
"Finish construction of a specified or every installation"},
330 {
nullptr,
nullptr,
nullptr}
337 cgi->Cmd_TableAddList(debugInstallationCmds);
346 cgi->Cmd_TableRemoveList(debugInstallationCmds);
357 && installation->buildStart
358 && installation->buildStart + installation->installationTemplate->buildTime <=
ccs.
date.
day) {
395 if (!*text || *token !=
'{') {
396 cgi->Com_Printf(
"INS_ParseInstallations: installation \"%s\" without body ignored\n", name);
401 cgi->Com_Printf(
"INS_ParseInstallations: installation name not specified.\n");
406 cgi->Com_Printf(
"INS_ParseInstallations: too many installation templates\n");
413 cgi->Com_Printf(
"INS_ParseInstallations: Second installation with same name found (%s) - second ignored\n", name);
427 const char* errhead =
"INS_ParseInstallations: unexpected end of file (names ";
437 if (!
cgi->Com_ParseBlockToken(name, text, installation, installation_vals,
cp_campaignPool, token)) {
456 ins->
tech = techLink;
517 cgi->Com_Printf(
"Invalid installation index %i\n", inst.
idx);
524 cgi->Com_Printf(
"Could not find installation template '%s'\n", instID);
530 cgi->Com_Printf(
"Invalid installation status '%s'\n", instStat);
557 cgi->Com_Printf(
"INS_LoadXML: Batteries not defined!\n");
563 cgi->Com_Printf(
"Installation has more batteries than possible, using upper bound\n");
#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.
installationStatus_t installationStatus
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.
A installation with all it's data.
QGL_EXTERN GLint GLenum type
installationStatus_t
Possible installation states.
bool INS_HasType(installationType_t type, installationStatus_t status)
Checks whether the given installation type is available.
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
int numInstallationTemplates
Header for installation management related stuff.
installationTemplate_t installationTemplates[MAX_INSTALLATION_TEMPLATES]
#define SAVE_INSTALLATION_INSTALLATIONS
xmlNode_t *IMPORT * XML_GetPos3(xmlNode_t *parent, const char *name, vec3_t pos)
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)
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.
int INS_GetCount(void)
Get number of installations.
memPool_t * cp_campaignPool
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.
cvar_t *IMPORT * Cvar_Set(const char *varName, const char *value,...) __attribute__((format(__printf__
void INS_Shutdown(void)
Closing operations for installations subsystem.
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.
const cgame_import_t * cgi
const char *IMPORT * Com_GetConstVariable(const char *space, int value)
This is the technology parsed from research.ufo.
static const constListEntry_t saveInstallationConstants[]
struct technology_s * tech
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
bool INS_LoadXML(xmlNode_t *p)
Load callback for savegames.
const installationTemplate_t * installationTemplate
#define SAVE_INSTALLATION_STATUS
#define MAX_INSTALLATION_TEMPLATES
installation_t * INS_Build(const installationTemplate_t *installationTemplate, const vec2_t pos, const char *name)
Build a new installation.
#define SAVE_INSTALLATION_IDX
linkedList_t * installations
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
xmlNode_t *IMPORT * XML_GetNextNode(xmlNode_t *current, xmlNode_t *parent, const char *name)
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
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
static void INS_FinishInstallation(installation_t *installation)
Finishes an installation.
#define MEMBER_SIZEOF(TYPE, MEMBER)
installation_t * INS_GetCurrentSelectedInstallation(void)
Returns the current selected installation.
#define Vector2Copy(src, dest)
Header file for single player campaign control.
xmlNode_t *IMPORT * XML_AddNode(xmlNode_t *parent, const char *name)
#define SAVE_INSTALLATION_ALIENINTEREST
const char *IMPORT * Com_EParse(const char **text, const char *errhead, const char *errinfo)
technology_t * RS_GetTechByProvided(const char *idProvided)
returns a pointer to the item tech (as listed in "provides")
char *IMPORT * PoolStrDup(const char *in, memPool_t *pool, const int tagNum)
#define SAVE_INSTALLATION_POS
const installationTemplate_t * INS_GetInstallationTemplateByID(const char *id)
Returns the installation Template for a given installation ID.
const char *IMPORT * Cmd_Argv(int n)
const char *IMPORT * XML_GetString(xmlNode_t *parent, const char *name)
void INS_DestroyInstallation(installation_t *installation)
Destroys an installation.
#define SAVE_INSTALLATION_BUILDSTART
xmlNode_t *IMPORT * XML_GetNode(xmlNode_t *parent, const char *name)
baseWeapon_t batteries[MAX_INSTALLATION_BATTERIES]
installation_t * INS_GetByIDX(int idx)
Get installation by it's index.