63 cgi->Com_Printf(
"CP_GetAlienMissionTypeByID: unknown alien mission category '%s'\n",
type);
81 const char* errhead =
"CP_ParseAlienTeam: unexpected end of file (alienteam ";
89 if (!*text || *token !=
'{') {
90 cgi->Com_Printf(
"CP_ParseAlienTeam: alien team category \"%s\" without body ignored\n",
name);
95 cgi->Com_Printf(
"CP_ParseAlienTeam: maximum number of alien team category reached (%i)\n",
ALIENCATEGORY_MAX);
100 for (
i = 0;
i <
ccs.numAlienCategories;
i++)
103 if (
i <
ccs.numAlienCategories) {
104 cgi->Com_Printf(
"CP_ParseAlienTeam: alien category def \"%s\" with same name found, second ignored\n",
name);
108 alienCategory = &
ccs.alienCategories[
ccs.numAlienCategories++];
112 token =
cgi->Com_EParse(text, errhead,
name);
118 if (
Q_streq(token,
"equipment")) {
120 if (!
cgi->Com_ParseList(text, list)) {
121 cgi->Com_Error(
ERR_DROP,
"CL_ParseAlienTeam: \"%s\" Error while parsing equipment list",
name);
123 }
else if (
Q_streq(token,
"category")) {
125 if (!
cgi->Com_ParseList(text, &list)) {
126 cgi->Com_Error(
ERR_DROP,
"CL_ParseAlienTeam: \"%s\" Error while parsing category list",
name);
128 for (
linkedList_t* element = list; element !=
nullptr; element = element->
next) {
131 cgi->Com_Printf(
"CP_ParseAlienTeam: alien team category \"%s\" is used with no mission category. It won't be used in game.\n",
name);
134 cgi->LIST_Delete(&list);
135 }
else if (
Q_streq(token,
"teaminterest")) {
138 token =
cgi->Com_EParse(text, errhead,
name);
139 if (!*text || *token !=
'{') {
140 cgi->Com_Printf(
"CP_ParseAlienTeam: alien team \"%s\" has team with no opening brace\n",
name);
155 token =
cgi->Com_EParse(text, errhead,
name);
158 if (!*text || *token ==
'}')
163 if (!
cgi->Com_ParseList(text, &list)) {
164 cgi->Com_Error(
ERR_DROP,
"CL_ParseAlienTeam: \"%s\" Error while parsing team list",
name);
166 for (
linkedList_t* element = list; element !=
nullptr; element = element->
next) {
168 cgi->Com_Error(
ERR_DROP,
"CL_ParseAlienTeam: MAX_TEAMS_PER_MISSION hit");
169 const teamDef_t* teamDef =
cgi->Com_GetTeamDefinitionByID(strtok((
char*)element->data,
"/"));
177 cgi->LIST_Delete(&list);
179 cgi->Com_Error(
ERR_DROP,
"CL_ParseAlienTeam: Unknown token \"%s\"\n", token);
185 cgi->Com_Printf(
"CP_ParseAlienTeam: Minimum number of aliens is greater than maximum value! Swapped.\n");
191 cgi->Com_Printf(
"CP_ParseAlienTeam: unknown token \"%s\" ignored (category %s)\n", token,
name);
197 Sys_Error(
"alien category equipment list is empty");
205 const char* errhead =
"CP_ParseResearchedCampaignItems: unexpected end of file (equipment ";
216 if (!*text || *token !=
'{') {
217 cgi->Com_Printf(
"CP_ParseResearchedCampaignItems: equipment def \"%s\" without body ignored (%s)\n",
224 token =
cgi->Com_EParse(text, errhead,
name);
225 if (!*text || *token ==
'}')
228 for (
i = 0;
i <
ccs.numTechnologies;
i++) {
241 if (
i ==
ccs.numTechnologies)
242 cgi->Com_Printf(
"CP_ParseResearchedCampaignItems: unknown token \"%s\" ignored (tech %s)\n", token,
name);
257 const char* errhead =
"CP_ParseResearchableCampaignStates: unexpected end of file (equipment ";
264 if (!*text || *token !=
'{') {
265 cgi->Com_Printf(
"CP_ParseResearchableCampaignStates: equipment def \"%s\" without body ignored\n",
name);
276 token =
cgi->Com_EParse(text, errhead,
name);
277 if (!*text || *token ==
'}')
280 for (
i = 0;
i <
ccs.numTechnologies;
i++) {
294 if (
i ==
ccs.numTechnologies)
295 cgi->Com_Printf(
"CP_ParseResearchableCampaignStates: unknown token \"%s\" ignored (tech %s)\n", token,
name);
380 const char* errhead =
"CP_ParseCampaign: unexpected end of file (campaign ";
389 cgi->Com_Printf(
"CP_ParseCampaign: campaign def \"%s\" with same name found, second ignored\n",
name);
394 cgi->Com_Printf(
"CP_ParseCampaign: Max campaigns reached (%i)\n",
MAX_CAMPAIGNS);
399 cp = &
ccs.campaigns[
ccs.numCampaigns++];
401 cp->
idx =
ccs.numCampaigns - 1;
420 if (!*text || *token !=
'{') {
421 cgi->Com_Printf(
"CP_ParseCampaign: campaign def \"%s\" without body ignored\n",
name);
438 token =
cgi->Com_EParse(text, errhead,
name);
447 }
else if (
Q_streq(token,
"salary")) {
449 }
else if (
Q_streq(token,
"events")) {
450 token =
cgi->Com_EParse(text, errhead,
name);
454 }
else if (
Q_streq(token,
"aircraft")) {
456 }
else if (
Q_streq(token,
"date")) {
457 token =
cgi->Com_EParse(text, errhead,
name);
463 if (sscanf(token,
"%i %i %i", &year, &day, &hour) != 3) {
468 cgi->Com_Printf(
"CP_ParseCampaign: unknown token \"%s\" ignored (campaign %s)\n", token,
name);
469 cgi->Com_EParse(text, errhead,
name);
487 cgi->Com_Printf(
"CP_ParseCampaign: check salary definition. Campaign def \"%s\" ignored\n",
name);
578 for (
int i = 0;
i <
cgi->csi->numODs;
i++) {
584 cgi->Com_Printf(
"CP_ItemsSanityCheck: Item %s has zero size set.\n", item->
id);
590 cgi->Com_Printf(
"CP_ItemsSanityCheck: Item %s has zero price set.\n", item->
id);
595 cgi->Com_Printf(
"CP_ItemsSanityCheck: Item %s has a price set though it is neither available on the market and production.\n", item->
id);
627 cgi->Com_Printf(
"Sanity check for script data\n");
630 bool status = s->
check();
631 cgi->Com_Printf(
"...%s %s\n", s->
name, (status ?
"ok" :
"failed"));
648 cgi->FS_BuildFileList(
"ufos/*.ufo");
649 cgi->FS_NextScriptHeader(
nullptr,
nullptr,
nullptr);
652 while ((
type =
cgi->FS_NextScriptHeader(
"ufos/*.ufo", &
name, &text)) !=
nullptr)
659 cgi->FS_NextScriptHeader(
nullptr,
nullptr,
nullptr);
663 while ((
type =
cgi->FS_NextScriptHeader(
"ufos/*.ufo", &
name, &text)) !=
nullptr)
667 for (
i = 0;
i <
cgi->csi->numTeamDefs;
i++) {
673 if (
ccs.teamDefTechs[teamDef->
idx] ==
nullptr)
674 cgi->Com_Error(
ERR_DROP,
"Could not find a tech for teamdef %s", teamDef->
id);
677 for (
i = 0, campaign =
ccs.campaigns;
i <
ccs.numCampaigns;
i++, campaign++) {
683 cgi->Com_Printf(
"Campaign data loaded - size " UFO_SIZE_T " bytes\n",
sizeof(
ccs));
684 cgi->Com_Printf(
"...techs: %i\n",
ccs.numTechnologies);
685 cgi->Com_Printf(
"...buildings: %i\n",
ccs.numBuildingTemplates);
686 cgi->Com_Printf(
"...ranks: %i\n",
ccs.numRanks);
687 cgi->Com_Printf(
"...nations: %i\n",
ccs.numNations);
688 cgi->Com_Printf(
"...cities: %i\n",
ccs.numCities);
689 cgi->Com_Printf(
"\n");
697 cgi->FS_NextScriptHeader(
nullptr,
nullptr,
nullptr);
701 while ((
type =
cgi->FS_NextScriptHeader(
"ufos/*.ufo", &
name, &text)) !=
nullptr)
DateTime class definition.
bool CHRSH_IsTeamDefAlien(const teamDef_t *const td)
Check if a team definition is alien.
const chrTemplate_t * CHRSH_GetTemplateByID(const teamDef_t *teamDef, const char *templateId)
Header file for inventory handling and Equipment menu.
Share stuff between the different cgame implementations.
Class describing a point of time.
static const short SECONDS_PER_HOUR
static const int DAYS_PER_YEAR
void Com_Error(int code, const char *fmt,...)
void AIR_ParseAircraft(const char *name, const char **text, bool assignAircraftItems)
Parses all aircraft that are defined in our UFO-scripts.
bool AIR_ScriptSanityCheck(void)
Checks the parsed aircraft for errors.
@ INTERESTCATEGORY_BASE_ATTACK
@ INTERESTCATEGORY_ALIENBASE
@ INTERESTCATEGORY_BUILDING
@ INTERESTCATEGORY_SUPPLY
@ INTERESTCATEGORY_UFOCARRIER
@ INTERESTCATEGORY_TERROR_ATTACK
@ INTERESTCATEGORY_INTERCEPT
@ INTERESTCATEGORY_RESCUE
@ INTERESTCATEGORY_HARVEST
void B_ParseBaseTemplate(const char *name, const char **text)
Reads a base layout template.
bool B_ItemIsStoredInBaseStorage(const objDef_t *obj)
Check if an item is stored in storage.
bool B_BuildingScriptSanityCheck(void)
Checks the parsed buildings for errors.
void B_ParseBuildings(const char *name, const char **text, bool link)
Copies an entry from the building description file into the list of building types.
memPool_t * cp_campaignPool
campaign_t * CP_GetCampaign(const char *name)
Returns the campaign pointer from global campaign array.
Header file for single player campaign control.
#define NON_OCCURRENCE_PROBABILITY
The probability that any new alien mission will be a non-occurrence mission.
const cgame_import_t * cgi
#define INITIAL_OVERALL_INTEREST
Determines the interest interval for a single campaign.
#define MAX_ALIEN_GROUP_PER_CATEGORY
#define ALIENCATEGORY_MAX
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...
Header file for Aircraft and item components.
const campaignEvents_t * CP_GetEventsByID(const char *name)
void CL_ParseEventMails(const char *name, const char **text)
void CL_ParseCampaignEvents(const char *name, const char **text)
void CP_ParseEventTrigger(const char *name, const char **text)
void INS_LinkTechnologies(void)
void INS_ParseInstallations(const char *name, const char **text)
Copies an entry from the installation description file into the list of installation templates.
bool BS_IsOnMarket(const objDef_t *item)
Check if an item is on market.
void MSO_ParseMessageSettings(const char *name, const char **text)
parses message options settings from file.
void CITY_Parse(const char *name, const char **text)
Parse the city data from script file.
void CL_ParseNations(const char *name, const char **text)
Parse the nation data from script file.
bool NAT_ScriptSanityCheck(void)
Checks the parsed nations and cities for errors.
static const value_t salary_vals[]
static void CP_ParseScriptCampaignRelated(const campaign_t *campaign, const char *type, const char *name, const char **text)
Parses the campaign specific data - this data can only be parsed once the campaign started.
static const value_t campaign_vals[]
static void CP_ParseResearchableCampaignStates(const campaign_t *campaign, const char *name, const char **text, bool researchable)
This function parses a list of items that should be set to researchable = true after campaign start.
void CP_ScriptSanityCheck(void)
Check the parsed script values for errors after parsing every script file.
void CP_ParseCampaignData(void)
Read the data for campaigns.
static void CP_ParseSalary(const char *name, const char **text, salary_t *s)
Parse the salaries from campaign definition.
static void CP_ParseScriptSecond(const char *type, const char *name, const char **text)
Parsing only for singleplayer.
static void CP_ParseResearchedCampaignItems(const campaign_t *campaign, const char *name, const char **text)
This function parses a list of items that should be set to researched = true after campaign start.
static void CP_ParseCampaign(const char *name, const char **text)
void CP_ReadCampaignData(const campaign_t *campaign)
static const value_t alien_group_vals[]
static interestCategory_t CP_GetAlienMissionTypeByID(const char *type)
static const sanity_functions_t sanity_functions[]
Data for sanity check of parsed script data.
static void CP_ParseAlienTeam(const char *name, const char **text)
static bool CP_ItemsSanityCheck(void)
Make sure values of items after parsing are proper.
static void CP_ParseScriptFirst(const char *type, const char *name, const char **text)
Parsing campaign data.
bool PR_ItemIsProduceable(const objDef_t *item)
check if an item is producable.
void CL_ParseRanks(const char *name, const char **text)
Parse medals and ranks defined in the medals.ufo file.
void RS_MarkOneResearchable(technology_t *tech)
Marks one tech as researchable.
technology_t * RS_GetTechByID(const char *id)
return a pointer to the technology identified by given id string
technology_t * RS_GetTechByIDX(int techIdx)
Returns the technology pointer for a tech index. You can use this instead of "&ccs....
void RS_ParseTechnologies(const char *name, const char **text)
Parses one "tech" entry in the research.ufo file and writes it into the next free entry in technologi...
void RS_RequiredLinksAssign(void)
Assign Link pointers to all required techs/items/etc...
bool RS_ScriptSanityCheck(void)
Checks the parsed tech data for errors.
void UP_ParseChapter(const char *name, const char **text)
Parse the UFOpaedia chapters from scripts.
void Sys_Error(const char *error,...)
const objDef_t * INVSH_GetItemByIDX(int index)
Returns the item that belongs to the given index or nullptr if the index is invalid.
#define MAX_TEAMS_PER_MISSION
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 void(APIENTRY *qglActiveTexture)(GLenum texture)
QGL_EXTERN GLint GLenum type
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
#define MEMBER_SIZEOF(TYPE, MEMBER)
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
alien team category definition
interestCategory_t missionCategories[INTERESTCATEGORY_MAX]
alienTeamGroup_t alienTeamGroups[MAX_ALIEN_GROUP_PER_CATEGORY]
alien team group definition.
const chrTemplate_t * alienChrTemplates[MAX_TEAMS_PER_MISSION]
const teamDef_t * alienTeams[MAX_TEAMS_PER_MISSION]
char asymptoticMarket[MAX_VAR]
const equipDef_t * asymptoticMarketDef
const campaignEvents_t * events
const equipDef_t * marketDef
linkedList_t * initialCraft
char * campaign[MAX_CAMPAIGNS]
bool markOnly[MAX_CAMPAIGNS]
Defines all attributes of objects used in the inventory.
struct that holds the sanity check data
This is the technology parsed from research.ufo.
markResearched_t markResearched