cp_research.h
Go to the documentation of this file.00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef CLIENT_CL_RESEARCH
00027 #define CLIENT_CL_RESEARCH
00028
00029 #define MAX_RESEARCHDISPLAY 22
00030 #define MAX_RESEARCHLIST 32
00031 #define MAX_TECHNOLOGIES 256
00032 #define MAX_TECHLINKS 16
00033 #define MAX_DESCRIPTIONS 8
00035 #define TECH_INVALID -1
00037 #define ANTIMATTER_TECH_ID "antimatter"
00038
00040 typedef enum researchStatus_s {
00041 RS_NONE,
00042 RS_RUNNING,
00043 RS_PAUSED,
00044 RS_FINISH
00045 } researchStatus_t;
00046
00048 typedef enum researchType_s {
00049 RS_TECH,
00050 RS_WEAPON,
00051 RS_ARMOUR,
00052 RS_CRAFT,
00053 RS_CRAFTITEM,
00054 RS_BUILDING,
00055 RS_ALIEN,
00056 RS_UGV,
00057 RS_NEWS,
00058 RS_LOGIC
00059 } researchType_t;
00060
00061 typedef enum requirementType_s {
00062 RS_LINK_TECH,
00063 RS_LINK_TECH_NOT,
00064 RS_LINK_ITEM,
00065 RS_LINK_ALIEN,
00066 RS_LINK_ALIEN_DEAD,
00067 RS_LINK_ALIEN_GLOBAL,
00068 RS_LINK_UFO,
00069 RS_LINK_ANTIMATTER,
00070 MAX_RS_LINKTYPES
00071 } requirementType_t;
00072
00073 typedef struct requirement_s {
00074 requirementType_t type;
00075 char *id;
00076 void *link;
00085 int amount;
00086 int collected;
00087 } requirement_t;
00088
00089 typedef struct requirements_s {
00090 int numLinks;
00091 requirement_t links[MAX_TECHLINKS];
00092 } requirements_t;
00093
00094 typedef struct markResearched_s {
00095 qboolean markOnly[MAX_CAMPAIGNS];
00096 char *campaign[MAX_CAMPAIGNS];
00097 int numDefinitions;
00098 } markResearched_t;
00099
00101 typedef enum {
00102 TECHMAIL_PRE,
00103 TECHMAIL_RESEARCHED,
00105 TECHMAIL_MAX
00106 } techMailType_t;
00107
00112 typedef struct techMail_s {
00113 char *from;
00114 char *to;
00115 char *subject;
00118 char *date;
00119 char *icon;
00120 char *model;
00121 qboolean read;
00122 } techMail_t;
00123
00124 typedef enum {
00125 MAILSENT_NONE,
00126 MAILSENT_PROPOSAL,
00127 MAILSENT_FINISHED,
00129 MAILSENT_MAX
00130 } mailSentType_t;
00131
00132 typedef struct descriptions_s {
00133 int numDescriptions;
00134 int usedDescription;
00136 char *text[MAX_DESCRIPTIONS];
00137 char *tech[MAX_DESCRIPTIONS];
00138 } descriptions_t;
00139
00141 typedef struct technology_s {
00142 char *id;
00143 int idx;
00144 char *name;
00145 descriptions_t description;
00146 descriptions_t preDescription;
00147 researchType_t type;
00149 struct technology_s *redirect;
00152 requirements_t requireAND;
00153 requirements_t requireOR;
00154 qboolean statusCollected;
00158 char *provides;
00160 float overallTime, time;
00163 int delay;
00167 researchStatus_t statusResearch;
00168 char *finishedResearchEvent;
00170 struct base_s *base;
00171 int scientists;
00173 char *image;
00176 char *mdl;
00178 int statusResearchable;
00180 int produceTime;
00181 mailSentType_t mailSent;
00182 requirements_t requireForProduction;
00187 date_t preResearchedDate;
00188 date_t researchedDate;
00190 markResearched_t markResearched;
00192
00193 struct pediaChapter_s *upChapter;
00194 struct technology_s *upPrev;
00195 struct technology_s *upNext;
00197 techMail_t mail[TECHMAIL_MAX];
00198 int numTechMails;
00200 struct technology_s *hashNext;
00201 struct technology_s *hashProvidedNext;
00202 } technology_t;
00203
00204 void RS_InitStartup(void);
00205 void RS_ResetTechs(void);
00206 void RS_ResearchRun(void);
00207 void RS_ParseTechnologies(const char *name, const char **text);
00208 qboolean RS_IsResearched_idx(int techIdx);
00209 qboolean RS_IsResearched_ptr(const technology_t *tech);
00210 int RS_Collected_(const technology_t * tech);
00211
00212 technology_t* RS_GetTechForItem(const objDef_t *item);
00213 void RS_AddObjectTechs(void);
00214 void RS_RequiredLinksAssign(void);
00215 void RS_InitTree(qboolean load);
00216 const char *RS_GetDescription(descriptions_t *desc);
00217 void RS_MarkCollected(technology_t *tech) __attribute__((nonnull));
00218 void RS_MarkResearchable(qboolean init, const struct base_s *base);
00219 qboolean RS_MarkStoryLineEventResearched(const char *techID);
00220 void RS_ResearchFinish(technology_t* tech);
00221 void RS_StopResearch(technology_t* tech);
00222 void RS_MarkOneResearchable(technology_t *tech);
00223
00224 void RS_AssignScientist(technology_t* tech, struct base_s *base, struct employee_s *employee);
00225 void RS_RemoveScientist(technology_t* tech, struct employee_s *employee);
00226 void RS_RemoveFiredScientist(struct base_s *base, struct employee_s *employee);
00227 void RS_RemoveScientistsExceedingCapacity(struct base_s *base);
00228
00229 technology_t *RS_GetTechByID(const char *id);
00230 technology_t *RS_GetTechByProvided(const char *idProvided);
00231 technology_t* RS_GetTechByIDX(int tech_idx);
00232 technology_t *RS_GetTechWithMostScientists(const struct base_s *base);
00233 int RS_GetTechIdxByName(const char *name);
00234 int RS_CountScientistsInBase(const struct base_s *base);
00235 qboolean RS_ScriptSanityCheck(void);
00236
00237
00238 void UP_AircraftDescription(const technology_t* t);
00239 void UP_UGVDescription(const struct ugv_s *ugvType);
00240
00241 qboolean RS_RequirementsMet(const requirements_t *requiredAND, const requirements_t *requiredOR, const struct base_s *base);
00242
00243 #endif