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);
68 comp = &
ccs.components[
ccs.numComponents];
77 token =
cgi->Com_EParse(text, errhead,
name);
84 if (
Q_streq(token,
"aircraft")) {
85 token =
cgi->Com_EParse(text, errhead,
name);
94 }
else if (
Q_streq(token,
"item")) {
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);
147 for (
int i = 0;
i <
ccs.numComponents;
i++) {
153 cgi->Com_Error(
ERR_DROP,
"COMP_GetComponentsByID: could not find components id for: %s",
id);
Share stuff between the different cgame implementations.
Header file for single player campaign control.
const cgame_import_t * cgi
static const value_t components_type_vals[]
components_t * COMP_GetComponentsByID(const char *id)
Returns components definition by ID.
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
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 * INVSH_GetItemByIDSilent(const char *id)
Returns the item that belongs to the given id or nullptr if it wasn't found.
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 GLuint GLsizei GLsizei GLint GLenum GLchar * name
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
char numbercrash[MAX_VAR]
The definition of a "components" entry (i.e. an assembly of several items) parsed from a ufo-file.
const objDef_t * items[MAX_COMP]
int itemAmount2[MAX_COMP]
const objDef_t * assemblyItem