25 #include "../../cl_shared.h"
26 #include "../../../shared/parse.h"
53 const char* errhead =
"COMP_ParseComponents: unexpected end of file.";
58 if (!*text || *token !=
'{') {
59 cgi->Com_Printf(
"COMP_ParseComponents: \"%s\" components def without body ignored.\n", name);
63 cgi->Com_Printf(
"COMP_ParseComponents: too many technology entries. limit is %i.\n",
MAX_ASSEMBLIES);
84 if (
Q_streq(token,
"aircraft")) {
94 }
else if (
Q_streq(token,
"item")) {
100 if (
cgi->Com_ParseBlock (
"item", text, &itemTokens, components_type_vals,
nullptr)) {
101 if (itemTokens.
id[0] ==
'\0')
102 cgi->Com_Error(
ERR_DROP,
"COMP_ParseComponents: \"item\" token id is missing.\n");
103 if (itemTokens.
amount[0] ==
'\0')
104 cgi->Com_Error(
ERR_DROP,
"COMP_ParseComponents: \"amount\" token id is missing.\n");
106 cgi->Com_Error(
ERR_DROP,
"COMP_ParseComponents: \"numbercrash\" token id is missing.\n");
124 cgi->Com_Printf(
"COMP_ParseComponents: \"%s\" Too many 'items' defined. Limit is %i - ignored.\n", name,
MAX_COMP);
126 }
else if (
Q_streq(token,
"time")) {
129 comp->
time = atoi(token);
131 cgi->Com_Printf(
"COMP_ParseComponents: Error in \"%s\" - unknown token: \"%s\".\n", name, token);
136 cgi->Com_Error(
ERR_DROP,
"COMP_ParseComponents: component \"%s\" is not applied to any aircraft.\n", name);
153 cgi->Com_Error(
ERR_DROP,
"COMP_GetComponentsByID: could not find components id for: %s",
id);
const objDef_t * INVSH_GetItemByIDSilent(const char *id)
Returns the item that belongs to the given id or nullptr if it wasn't found.
const objDef_t * INVSH_GetItemByID(const char *id)
Returns the item that belongs to the given id or nullptr if it wasn't found.
const objDef_t * items[MAX_COMP]
components_t * COMP_GetComponentsByID(const char *id)
Returns components definition by ID.
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
components_t components[MAX_ASSEMBLIES]
const cgame_import_t * cgi
int itemAmount2[MAX_COMP]
const objDef_t * assemblyItem
static const value_t components_type_vals[]
The definition of a "components" entry (i.e. an assembly of several items) parsed from a ufo-file...
const char * Com_Parse(const char *data_p[], char *target, size_t size, bool replaceWhitespaces)
Parse a token out of a string.
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
char numbercrash[MAX_VAR]
Header file for single player campaign control.
const char *IMPORT * Com_EParse(const char **text, const char *errhead, const char *errinfo)
void COMP_ParseComponents(const char *name, const char **text)
Parses one "components" entry in a .ufo file and writes it into the next free entry in xxxxxxxx (comp...
#define COMP_ITEMCOUNT_SCALED