UFO: Alien Invasion
Loading...
Searching...
No Matches
cp_research.h
Go to the documentation of this file.
1
5
6/*
7Copyright (C) 2002-2025 UFO: Alien Invasion.
8
9This program is free software; you can redistribute it and/or
10modify it under the terms of the GNU General Public License
11as published by the Free Software Foundation; either version 2
12of the License, or (at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18See the GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24*/
25
26#pragma once
27
28#include "../../DateTime.h"
29
30#define MAX_RESEARCHLIST 32
31#define MAX_TECHNOLOGIES 256
32#define MAX_TECHLINKS 16
33#define MAX_DESCRIPTIONS 8
34
35#define TECH_INVALID -1
36
37#define ANTIMATTER_ITEM_ID "antimatter"
38
40typedef enum researchStatus_s {
46
60
72
73typedef struct requirement_s {
75 char* id;
76 union typelink_t {
77 const struct technology_s* tech;
78 const struct objDef_s* od;
79 const struct teamDef_s* td;
80 const struct aircraft_s* aircraft;
81 } link;
82 int amount;
85
86typedef struct requirements_s {
90
92typedef struct markResearched_s {
97
105
110typedef struct techMail_s {
111 char* from;
112 const char* to;
113 const char* subject;
116 const char* date;
117 const char* icon;
118 const char* model;
119 bool read;
120} techMail_t;
121
129
130typedef struct technologyDescriptions_s {
137
202
203#define RS_Collected_(tech) ((tech)->statusCollected)
204
205void RS_InitStartup(void);
206void RS_ResetTechs(void);
207int RS_ResearchRun(void);
208void RS_ParseTechnologies(const char* name, const char** text);
209bool RS_IsResearched_idx(int techIdx);
210bool RS_IsResearched_ptr(const technology_t* tech);
211
215void RS_RequiredLinksAssign(void);
216void RS_InitTree(const struct campaign_s* campaign, bool load);
218void RS_MarkCollected(technology_t* tech) __attribute__((nonnull));
219void RS_MarkResearchable(const struct base_s* base, bool init = false);
220bool RS_MarkStoryLineEventResearched(const char* techID);
222void RS_StopResearch(technology_t* tech);
224
225void RS_AssignScientist(technology_t* tech, struct base_s* base, Employee* employee = nullptr);
226void RS_RemoveScientist(technology_t* tech, Employee* employee);
227void RS_RemoveFiredScientist(struct base_s* base, Employee* employee);
228void RS_RemoveScientistsExceedingCapacity(struct base_s* base);
229
230technology_t* RS_GetTechByID(const char* id);
231technology_t* RS_GetTechByProvided(const char* idProvided);
232technology_t* RS_GetTechByIDX(int tech_idx);
233technology_t* RS_GetTechWithMostScientists(const struct base_s* base);
234int RS_GetTechIdxByName(const char* name);
235int RS_CountScientistsInBase(const struct base_s* base);
236bool RS_ScriptSanityCheck(void);
237
238/* UFOpaedia function - but needs technology_t */
240void UP_UGVDescription(const struct ugv_s* ugvType);
241
242void RS_CheckRequirements(void);
243bool RS_RequirementsMet(const technology_t* tech, const struct base_s* base);
DateTime class definition.
Class describing a point of time.
Definition DateTime.h:31
#define MAX_CAMPAIGNS
Definition cp_campaign.h:31
void RS_InitTree(const struct campaign_s *campaign, bool load)
void RS_MarkOneResearchable(technology_t *tech)
Marks one tech as researchable.
void UP_UGVDescription(const struct ugv_s *ugvType)
const char * RS_GetDescription(technologyDescriptions_t *desc)
returns the currently used description for a technology.
void RS_RemoveScientist(technology_t *tech, Employee *employee)
Remove a scientist from a technology.
void RS_MarkResearchable(const struct base_s *base, bool init=false)
bool RS_RequirementsMet(const technology_t *tech, const struct base_s *base)
int RS_CountScientistsInBase(const struct base_s *base)
researchStatus_t
The status of a research (per tech).
Definition cp_research.h:40
@ RS_FINISH
Definition cp_research.h:44
@ RS_NONE
Definition cp_research.h:41
@ RS_RUNNING
Definition cp_research.h:42
@ RS_PAUSED
Definition cp_research.h:43
technology_t * RS_GetTechForTeam(const teamDef_t *team)
Returns technology entry for a team.
technology_t * RS_GetTechForItem(const objDef_t *item)
Returns technology entry for an item.
requirementType_t
Definition cp_research.h:61
@ RS_LINK_TECH
Definition cp_research.h:62
@ RS_LINK_UFO
Definition cp_research.h:68
@ RS_LINK_ALIEN_GLOBAL
Definition cp_research.h:67
@ RS_LINK_ITEM
Definition cp_research.h:64
@ RS_LINK_ALIEN
Definition cp_research.h:65
@ MAX_RS_LINKTYPES
Definition cp_research.h:70
@ RS_LINK_ALIEN_DEAD
Definition cp_research.h:66
@ RS_LINK_TECH_NOT
Definition cp_research.h:63
@ RS_LINK_ANTIMATTER
Definition cp_research.h:69
researchType_t
Types of research topics.
Definition cp_research.h:48
@ RS_BUILDING
Definition cp_research.h:54
@ RS_NEWS
Definition cp_research.h:57
@ RS_CRAFTITEM
Definition cp_research.h:53
@ RS_TECH
Definition cp_research.h:49
@ RS_ALIEN
Definition cp_research.h:55
@ RS_UGV
Definition cp_research.h:56
@ RS_LOGIC
Definition cp_research.h:58
@ RS_WEAPON
Definition cp_research.h:50
@ RS_CRAFT
Definition cp_research.h:52
@ RS_ARMOUR
Definition cp_research.h:51
int RS_GetTechIdxByName(const char *name)
Returns the index (idx) of a "tech" entry given it's name.
void RS_ResetTechs(void)
This is called everytime RS_ParseTechnologies is called - to prevent cyclic hash tables.
bool RS_IsResearched_ptr(const technology_t *tech)
Checks whether an item is already researched.
technology_t * RS_GetTechByID(const char *id)
return a pointer to the technology identified by given id string
void RS_StopResearch(technology_t *tech)
Stops a research (Removes scientists from it).
void RS_InitStartup(void)
This is more or less the initial Bind some of the functions in this file to console-commands that you...
bool RS_MarkStoryLineEventResearched(const char *techID)
technology_t * RS_GetTechWithMostScientists(const struct base_s *base)
Searches for the technology that has the most scientists assigned in a given base.
void RS_RemoveFiredScientist(struct base_s *base, Employee *employee)
mailSentType_t
@ MAILSENT_FINISHED
@ MAILSENT_MAX
@ MAILSENT_PROPOSAL
@ MAILSENT_NONE
#define MAX_DESCRIPTIONS
Definition cp_research.h:33
void RS_ResearchFinish(technology_t *tech)
Sets a technology status to researched and updates the date.
int RS_ResearchRun(void)
Checks the research status.
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...
technology_t * RS_GetTechByProvided(const char *idProvided)
returns a pointer to the item tech (as listed in "provides")
#define MAX_TECHLINKS
Definition cp_research.h:32
void RS_CheckRequirements(void)
Checks if running researches still meet their requirements.
techMailType_t
Types for tech mail definitions - see tech->mail[].
Definition cp_research.h:99
@ TECHMAIL_PRE
@ TECHMAIL_MAX
@ TECHMAIL_RESEARCHED
void UP_AircraftDescription(const technology_t *t)
Prints the UFOpaedia description for aircraft.
technology_t * RS_GetTechByIDX(int tech_idx)
Returns the technology pointer for a tech index. You can use this instead of "&ccs....
void RS_RequiredLinksAssign(void)
Assign Link pointers to all required techs/items/etc...
bool RS_IsResearched_idx(int techIdx)
Checks if the technology (tech-index) has been researched.
bool RS_ScriptSanityCheck(void)
Checks the parsed tech data for errors.
void RS_AssignScientist(technology_t *tech, struct base_s *base, Employee *employee=nullptr)
void RS_AddObjectTechs(void)
void RS_RemoveScientistsExceedingCapacity(struct base_s *base)
void RS_MarkCollected(technology_t *tech) __attribute__((nonnull))
Marks a give technology as collected.
#define __attribute__(x)
Definition cxx.h:37
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition r_gl.h:110
char * campaign[MAX_CAMPAIGNS]
Definition cp_research.h:94
bool markOnly[MAX_CAMPAIGNS]
Definition cp_research.h:93
Defines all attributes of objects used in the inventory.
Definition inv_shared.h:264
requirementType_t type
Definition cp_research.h:74
requirement_t links[MAX_TECHLINKS]
Definition cp_research.h:88
available mails for a tech - mail and mail_pre in script files
const char * date
const char * icon
const char * model
char * from
const char * subject
const char * to
This is the technology parsed from research.ufo.
struct technology_s * upPrev
mailSentType_t mailSent
char * provides
requirements_t requireForProduction
requirements_t requireOR
researchStatus_t statusResearch
float overallTime
struct technology_s * hashProvidedNext
technologyDescriptions_t description
struct technology_s * hashNext
markResearched_t markResearched
struct base_s * base
char * finishedResearchEvent
technologyDescriptions_t preDescription
bool statusResearchable
requirements_t requireAND
struct technology_s * redirect
class DateTime preResearchedDate
bool statusCollected
struct technology_s * upNext
struct pediaChapter_s * upChapter
techMail_t mail[TECHMAIL_MAX]
class DateTime researchedDate
researchType_t type
char * text[MAX_DESCRIPTIONS]
char * tech[MAX_DESCRIPTIONS]