UFO: Alien Invasion
|
Technology research. More...
#include "../../cl_shared.h"
#include "../../../shared/parse.h"
#include "cp_campaign.h"
#include "cp_capacity.h"
#include "cp_research.h"
#include "cp_popup.h"
#include "cp_time.h"
#include "save/save_research.h"
#include "aliencontainment.h"
Go to the source code of this file.
Macros | |
#define | TECH_HASH_SIZE 64 |
Functions | |
void | RS_ResearchFinish (technology_t *tech) |
Sets a technology status to researched and updates the date. More... | |
void | RS_StopResearch (technology_t *tech) |
Stops a research (Removes scientists from it) More... | |
void | RS_MarkOneResearchable (technology_t *tech) |
Marks one tech as researchable. More... | |
bool | RS_RequirementsMet (const technology_t *tech, const base_t *base) |
Checks if all requirements of a tech have been met so that it becomes researchable. More... | |
const char * | RS_GetDescription (technologyDescriptions_t *desc) |
returns the currently used description for a technology. More... | |
void | RS_MarkCollected (technology_t *tech) |
Marks a give technology as collected. More... | |
void | RS_MarkResearchable (const base_t *base, bool init) |
Marks all the techs that can be researched. Automatically researches 'free' techs such as ammo for a weapon. Not "researchable"-related. Should be called when a new item is researched (RS_MarkResearched) and after the tree-initialisation (RS_InitTree) More... | |
static void | RS_AssignTechLinks (requirements_t *reqs) |
Assign required tech/item/etc... pointers for a single requirements list. More... | |
void | RS_RequiredLinksAssign (void) |
Assign Link pointers to all required techs/items/etc... More... | |
technology_t * | RS_GetTechForItem (const objDef_t *item) |
Returns technology entry for an item. More... | |
technology_t * | RS_GetTechForTeam (const teamDef_t *team) |
Returns technology entry for a team. More... | |
void | RS_InitTree (const campaign_t *campaign, bool load) |
Gets all needed names/file-paths/etc... for each technology entry. Should be executed after the parsing of all the ufo files and e.g. the research tree/inventory/etc... are initialised. More... | |
void | RS_AssignScientist (technology_t *tech, base_t *base, Employee *employee) |
Assigns scientist to the selected research-project. More... | |
void | RS_RemoveScientist (technology_t *tech, Employee *employee) |
Remove a scientist from a technology. More... | |
void | RS_RemoveFiredScientist (base_t *base, Employee *employee) |
Remove one scientist from research project if needed. More... | |
static void | RS_MarkResearched (technology_t *tech, const base_t *base) |
Mark technologies as researched. This includes techs that depends on "tech" and have time=0. More... | |
bool | RS_MarkStoryLineEventResearched (const char *techID) |
void | RS_CheckRequirements (void) |
Checks if running researches still meet their requirements. More... | |
int | RS_ResearchRun (void) |
Checks the research status. More... | |
void | RS_InitStartup (void) |
This is more or less the initial Bind some of the functions in this file to console-commands that you can call ingame. Called from UI_InitStartup resp. CL_InitLocal. More... | |
void | RS_ResetTechs (void) |
This is called everytime RS_ParseTechnologies is called - to prevent cyclic hash tables. More... | |
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 technologies (technology_t). More... | |
static bool | RS_IsValidTechIndex (int techIdx) |
bool | RS_IsResearched_idx (int techIdx) |
Checks if the technology (tech-index) has been researched. More... | |
bool | RS_IsResearched_ptr (const technology_t *tech) |
Checks whether an item is already researched. More... | |
technology_t * | RS_GetTechByIDX (int techIdx) |
Returns the technology pointer for a tech index. You can use this instead of "&ccs.technologies[techIdx]" to avoid having to check valid indices. More... | |
technology_t * | RS_GetTechByID (const char *id) |
return a pointer to the technology identified by given id string More... | |
technology_t * | RS_GetTechByProvided (const char *idProvided) |
returns a pointer to the item tech (as listed in "provides") More... | |
technology_t * | RS_GetTechWithMostScientists (const struct base_s *base) |
Searches for the technology that has the most scientists assigned in a given base. More... | |
int | RS_GetTechIdxByName (const char *name) |
Returns the index (idx) of a "tech" entry given it's name. More... | |
int | RS_CountScientistsInBase (const base_t *base) |
Returns the number of employees searching in labs in given base. More... | |
void | RS_RemoveScientistsExceedingCapacity (base_t *base) |
Remove all exceeding scientist. More... | |
bool | RS_SaveXML (xmlNode_t *parent) |
Save callback for research and technologies. More... | |
bool | RS_LoadXML (xmlNode_t *parent) |
Load callback for research and technologies. More... | |
bool | RS_ResearchAllowed (const base_t *base) |
Returns true if the current base is able to handle research. More... | |
bool | RS_ScriptSanityCheck (void) |
Checks the parsed tech data for errors. More... | |
Variables | |
static technology_t * | techHash [TECH_HASH_SIZE] |
static technology_t * | techHashProvided [TECH_HASH_SIZE] |
static linkedList_t * | redirectedTechs |
static const value_t | valid_tech_vars [] |
The valid definition names in the research.ufo file. More... | |
static const value_t | valid_techmail_vars [] |
The valid definition names in the research.ufo file for tech mails. More... | |
Technology research.
Handles everything related to the research-tree. Provides information if items/buildings/etc.. can be researched/used/displayed etc... Implements the research-system (research new items/etc...) See base/ufos/research.ufo and base/ufos/ui/research.ufo for the underlying content.
Definition in file cp_research.cpp.
#define TECH_HASH_SIZE 64 |
Definition at line 41 of file cp_research.cpp.
Referenced by RS_GetTechByID(), RS_GetTechByProvided(), RS_GetTechIdxByName(), and RS_ParseTechnologies().
void RS_AssignScientist | ( | technology_t * | tech, |
base_t * | base, | ||
Employee * | employee | ||
) |
Assigns scientist to the selected research-project.
[in] | tech | What technology you want to assign the scientist to. |
[in] | base | Pointer to base where the research is ongoing. |
[in] | employee | Pointer to the scientist to assign. It can be nullptr! That means "any". |
Definition at line 653 of file cp_research.cpp.
References _, technology_s::base, CAP_AddCurrent(), CAP_GetFreeCapacity(), CAP_LABSPACE, cgi, CP_Popup(), DEBUG_CLIENT, E_GetUnassignedEmployee(), EMPL_SCIENTIST, technology_s::id, technology_s::idx, base_s::name, technology_s::name, RS_RUNNING, technology_s::scientists, Employee::setAssigned(), technology_s::statusResearch, and technology_s::statusResearchable.
Referenced by RS_Change_f(), RS_Max_f(), RS_RemoveFiredScientist(), and TEST_F().
|
static |
Assign required tech/item/etc... pointers for a single requirements list.
Definition at line 382 of file cp_research.cpp.
References AIR_GetAircraft(), requirement_s::typelink_t::aircraft, cgi, cgame_import_s::Com_GetTeamDefinitionByID(), ERR_DROP, i, requirement_s::id, INVSH_GetItemByID(), requirement_s::link, requirements_s::links, requirements_s::numLinks, requirement_s::typelink_t::od, RS_GetTechByID(), RS_LINK_ALIEN, RS_LINK_ALIEN_DEAD, RS_LINK_ITEM, RS_LINK_TECH, RS_LINK_TECH_NOT, RS_LINK_UFO, requirement_s::typelink_t::td, requirement_s::typelink_t::tech, and requirement_s::type.
Referenced by RS_InitTree(), and RS_RequiredLinksAssign().
Checks if running researches still meet their requirements.
Definition at line 789 of file cp_research.cpp.
References _, technology_s::base, ccs, Com_sprintf(), cp_messageBuffer, i, MSG_RESEARCH_HALTED, MSO_CheckAddNewMessage(), base_s::name, technology_s::name, NT_RESEARCH_HALTED, ccs_s::numTechnologies, RS_GetTechByIDX(), RS_RequirementsMet(), RS_RUNNING, RS_StopResearch(), and technology_s::statusResearch.
Referenced by US_RemoveStoredUFO().
Returns the number of employees searching in labs in given base.
[in] | base | Pointer to the base |
Definition at line 1687 of file cp_research.cpp.
References technology_s::base, ccs, i, ccs_s::numTechnologies, technology_s::scientists, and ccs_s::technologies.
Referenced by B_ResetAllStatusAndCapacities(), and RS_RemoveScientistsExceedingCapacity().
const char* RS_GetDescription | ( | technologyDescriptions_t * | desc | ) |
returns the currently used description for a technology.
[in,out] | desc | A list of possible descriptions (with tech-links that decide which one is the correct one) |
< Stored used description
Definition at line 270 of file cp_research.cpp.
References i, technologyDescriptions_s::numDescriptions, RS_GetTechByID(), RS_IsResearched_ptr(), technologyDescriptions_s::tech, technologyDescriptions_s::text, and technologyDescriptions_s::usedDescription.
Referenced by RS_MarkOneResearchable(), RS_ResearchFinish(), and UP_Article().
technology_t* RS_GetTechByID | ( | const char * | id | ) |
return a pointer to the technology identified by given id string
[in] | id | Unique identifier of the tech as defined in the research.ufo file (e.g. "tech xxxx"). |
Definition at line 1602 of file cp_research.cpp.
References cgi, Com_HashKey(), hash, technology_s::hashNext, technology_s::id, Q_strcasecmp, Q_strnull(), and TECH_HASH_SIZE.
Referenced by AIM_AutoEquipAircraft(), AIR_ParseAircraft(), B_BuildingScriptSanityCheck(), BDEF_BaseDefenceMenuUpdate_f(), CP_AddTechAsResearchable_f(), CP_CheckTriggerEvent(), CP_GetEventsByID(), CP_ParseCampaignData(), CP_XVIInit(), AlienContainment::isLifeSupported(), MS_LoadXML(), RS_AssignTechLinks(), RS_Change_f(), RS_GetDescription(), RS_GetDetails_f(), RS_LoadXML(), RS_MarkStoryLineEventResearched(), RS_Max_f(), RS_RequiredLinksAssign(), RS_Stop_f(), TEST_F(), and UP_FindEntry_f().
technology_t* RS_GetTechByIDX | ( | int | techIdx | ) |
Returns the technology pointer for a tech index. You can use this instead of "&ccs.technologies[techIdx]" to avoid having to check valid indices.
[in] | techIdx | Index in the global ccs.technologies[] array. |
Definition at line 1589 of file cp_research.cpp.
References ccs, RS_IsValidTechIndex(), and ccs_s::technologies.
Referenced by AIM_AircraftEquipMenuClick_f(), CP_ParseResearchableCampaignStates(), CP_ParseResearchedCampaignItems(), RS_CheckRequirements(), RS_FillTechnologyList_f(), RS_GetTechWithMostScientists(), RS_MarkResearchable(), RS_RequiredLinksAssign(), RS_ResearchRun(), RS_SaveXML(), and RS_ShowActiveResearch_f().
technology_t* RS_GetTechByProvided | ( | const char * | idProvided | ) |
returns a pointer to the item tech (as listed in "provides")
[in] | idProvided | Unique identifier of the object the tech is providing |
Definition at line 1621 of file cp_research.cpp.
References cgi, Com_HashKey(), DEBUG_CLIENT, hash, technology_s::hashProvidedNext, technology_s::provides, Q_strcasecmp, and TECH_HASH_SIZE.
Referenced by AII_LoadOneSlotXML(), AIRFIGHT_LoadXML(), B_ParseBuildings(), BS_FillMarket_f(), BS_MarketInfoClick_f(), GAME_CP_GetItemModel(), INS_LinkTechnologies(), RS_InitTree(), UFO_GetTechnologyFromType(), and UP_UGVDescription().
technology_t* RS_GetTechForItem | ( | const objDef_t * | item | ) |
Returns technology entry for an item.
[in] | item | Pointer to the item (object) definition |
Definition at line 455 of file cp_research.cpp.
References ccs, cgi, ERR_DROP, objDef_s::id, objDef_s::idx, lengthof, and ccs_s::objDefTechs.
Referenced by AII_AutoAddAmmo(), AII_CarriedItems(), AII_GetCraftitemTechsByType(), AIM_AircraftEquipMenuUpdate(), AIM_DrawAircraftSlots(), B_AddToStorage(), B_SellOrAddItems(), BDEF_AddSlotToSlotList(), BS_FillMarket_f(), BS_InitMarket(), BS_SetAutosell_f(), CP_AddItemAsCollected_f(), CP_CampaignRunMarket(), GAME_CP_ItemIsUseable(), PR_FinishDisassembly(), PR_GetTech(), PR_ItemIsProduceable(), PR_ItemProductionInfo(), PR_ProductionListClick_f(), PR_ProductionListRightClick_f(), PR_RequirementsInfo(), PR_UpdateProductionList(), TEST_F(), UP_AircraftItemDescription(), UP_DrawAssociatedAmmo(), and UP_ResearchedLinkClick_f().
technology_t* RS_GetTechForTeam | ( | const teamDef_t * | team | ) |
Returns technology entry for a team.
[in] | team | Pointer to the team definition |
Definition at line 470 of file cp_research.cpp.
References ccs, cgi, ERR_DROP, teamDef_s::id, teamDef_s::idx, lengthof, and ccs_s::teamDefTechs.
Referenced by AC_Init_f(), AC_KillOne_f(), and AlienContainment::add().
int RS_GetTechIdxByName | ( | const char * | name | ) |
Returns the index (idx) of a "tech" entry given it's name.
[in] | name | the name of the tech |
Definition at line 1669 of file cp_research.cpp.
References cgi, Com_HashKey(), hash, technology_s::hashNext, technology_s::id, technology_s::idx, Q_strcasecmp, TECH_HASH_SIZE, and TECH_INVALID.
technology_t* RS_GetTechWithMostScientists | ( | const struct base_s * | base | ) |
Searches for the technology that has the most scientists assigned in a given base.
[in] | base | In what base the tech should be researched. |
Definition at line 1644 of file cp_research.cpp.
References technology_s::base, ccs, i, ccs_s::numTechnologies, RS_GetTechByIDX(), RS_RUNNING, technology_s::scientists, and technology_s::statusResearch.
Referenced by RS_RemoveFiredScientist(), and RS_RemoveScientistsExceedingCapacity().
This is more or less the initial Bind some of the functions in this file to console-commands that you can call ingame. Called from UI_InitStartup resp. CL_InitLocal.
Definition at line 1068 of file cp_research.cpp.
References cgi.
Referenced by CP_InitStartup().
void RS_InitTree | ( | const campaign_t * | campaign, |
bool | load | ||
) |
Gets all needed names/file-paths/etc... for each technology entry. Should be executed after the parsing of all the ufo files and e.g. the research tree/inventory/etc... are initialised.
[in] | campaign | The campaign data structure |
[in] | load | true if we are loading a game, false otherwise |
Definition at line 490 of file cp_research.cpp.
References AIR_Foreach, ccs_s::aircraftTemplates, ccs_s::buildingTemplates, markResearched_s::campaign, ccs, cgi, cp_campaignPool, csi, cgame_import_s::csi, DEBUG_CLIENT, ERR_DROP, ERR_FATAL, i, building_s::id, aircraft_s::id, technology_s::id, objDef_s::id, objDef_s::idx, building_s::image, technology_s::image, objDef_s::image, INVSH_GetItemByIDX(), technology_s::mail, markResearched_s::markOnly, technology_s::markResearched, technology_s::mdl, aircraft_s::model, objDef_s::model, building_s::name, aircraft_s::name, technology_s::name, objDef_s::name, ccs_s::numAircraftTemplates, ccs_s::numBuildingTemplates, markResearched_s::numDefinitions, csi_s::numODs, ccs_s::numTechnologies, ccs_s::objDefTechs, csi_s::ods, cgame_import_s::PoolStrDup(), technology_s::provides, Q_streq, technology_s::requireAND, technology_s::requireOR, campaign_s::researched, RS_ALIEN, RS_ARMOUR, RS_AssignTechLinks(), RS_BUILDING, RS_CRAFT, RS_CRAFTITEM, RS_GetTechByProvided(), RS_LOGIC, RS_NEWS, RS_ResearchFinish(), RS_TECH, RS_UGV, RS_WEAPON, techMail_s::subject, aircraft_s::tech, TECHMAIL_MAX, ccs_s::technologies, techMail_s::to, and technology_s::type.
Referenced by CP_CampaignInit(), CreateBase(), and TEST_F().
bool RS_IsResearched_idx | ( | int | techIdx | ) |
Checks if the technology (tech-index) has been researched.
[in] | techIdx | index of the technology. |
true
if the technology has been researched, otherwise (or on error) false; Definition at line 1560 of file cp_research.cpp.
References ccs, RS_FINISH, RS_IsValidTechIndex(), technology_s::statusResearch, and ccs_s::technologies.
bool RS_IsResearched_ptr | ( | const technology_t * | tech | ) |
Checks whether an item is already researched.
Definition at line 1576 of file cp_research.cpp.
References RS_FINISH, and technology_s::statusResearch.
Referenced by AC_Init_f(), AIM_CheckTechnologyIntoSlot(), AIM_CrafttypeFilter(), AIM_SelectableCraftItem(), B_ListBuildings_f(), B_SellOrAddItems(), BDEF_BaseDefenceMenuUpdate_f(), BS_FillMarket_f(), BS_InitMarket(), BS_SetAutosell_f(), CP_CampaignRunMarket(), CP_CheckTriggerEvent(), CP_IsXVIVisible(), GAME_CP_ItemIsUseable(), GAME_CP_TeamIsKnown(), GEO_DrawMarkers(), INS_FillTypes_f(), INS_SelectType_f(), AlienContainment::isLifeSupported(), PR_ProductionListClick_f(), PR_ProductionListRightClick_f(), PR_RequirementsMet(), PR_UpdateProductionList(), RS_GetDescription(), RS_MarkStoryLineEventResearched(), RS_RequirementsMet(), TR_DestinationCapacityList_f(), UFO_GetName(), UP_AircraftDescription(), UP_AircraftItemDescription(), UP_Article(), UP_GetUnreadMails(), UP_TechGetsDisplayed(), and UP_UGVDescription().
|
inlinestatic |
Definition at line 1542 of file cp_research.cpp.
References ccs, MAX_TECHNOLOGIES, ccs_s::numTechnologies, and TECH_INVALID.
Referenced by RS_GetTechByIDX(), and RS_IsResearched_idx().
bool RS_LoadXML | ( | xmlNode_t * | parent | ) |
Load callback for research and technologies.
[in] | parent | XML Node structure, where we get the information from |
Definition at line 1763 of file cp_research.cpp.
References B_GetBaseByIDX(), technology_s::base, cgi, date_s::day, technology_s::mail, technology_s::mailSent, technology_s::preResearchedDate, techMail_s::read, technology_s::researchedDate, RS_GetTechByID(), RS_RUNNING, SAVE_RESEARCH_BASE, SAVE_RESEARCH_DATE, SAVE_RESEARCH_ID, SAVE_RESEARCH_MAIL, SAVE_RESEARCH_MAIL_ID, SAVE_RESEARCH_MAILSENT, SAVE_RESEARCH_PREDATE, SAVE_RESEARCH_RESEARCH, SAVE_RESEARCH_SCIENTISTS, SAVE_RESEARCH_STATUSCOLLECTED, SAVE_RESEARCH_STATUSRESEARCH, SAVE_RESEARCH_STATUSRESEARCHABLE, SAVE_RESEARCH_TECH, SAVE_RESEARCH_TIME, SAVE_RESEARCHSTATUS_NAMESPACE, saveResearchConstants, technology_s::scientists, date_s::sec, technology_s::statusCollected, technology_s::statusResearch, technology_s::statusResearchable, TECHMAIL_MAX, technology_s::time, cgame_import_s::XML_GetDate(), cgame_import_s::XML_GetNextNode(), cgame_import_s::XML_GetNode(), cgame_import_s::XML_GetString(), and xmlNode_t.
Referenced by SAV_Init().
void RS_MarkCollected | ( | technology_t * | tech | ) |
Marks a give technology as collected.
[in] | tech | The technology pointer to mark collected |
Definition at line 304 of file cp_research.cpp.
References _, ccs, Com_sprintf(), cp_messageBuffer, ccs_s::date, date_s::day, technology_s::mailSent, MAILSENT_FINISHED, MAILSENT_PROPOSAL, MSG_RESEARCH_PROPOSAL, MSO_CheckAddNewMessage(), technology_s::name, NT_RESEARCH_PROPOSED, technology_s::preResearchedDate, RS_FINISH, technology_s::statusCollected, technology_s::statusResearch, and technology_s::time.
Referenced by AlienContainment::add(), AII_CarriedItems(), B_SellOrAddItems(), CP_AddItemAsCollected_f(), PR_FinishDisassembly(), UR_ProcessActive(), and US_StoreUFO().
void RS_MarkOneResearchable | ( | technology_t * | tech | ) |
Marks one tech as researchable.
tech | The technology to be marked. |
At this point we define what research proposal description is used when displayed. (i.e. "usedDescription" is set here). That's because this is the first the player will see anything from the tech and any later changes may make the content (proposal) of the tech inconsistent for the player.
Definition at line 106 of file cp_research.cpp.
References _, ccs, cgi, Com_sprintf(), cp_messageBuffer, ccs_s::date, date_s::day, DEBUG_CLIENT, technology_s::id, technology_s::mailSent, MAILSENT_FINISHED, MAILSENT_PROPOSAL, MSG_RESEARCH_PROPOSAL, MSO_CheckAddNewMessage(), technology_s::name, NT_RESEARCH_PROPOSED, technology_s::preDescription, technology_s::preResearchedDate, RS_GetDescription(), technology_s::statusResearchable, and technology_s::time.
Referenced by CP_AddTechAsResearchable_f(), CP_ParseResearchableCampaignStates(), RS_MarkResearchable(), and TEST_F().
Marks all the techs that can be researched. Automatically researches 'free' techs such as ammo for a weapon. Not "researchable"-related. Should be called when a new item is researched (RS_MarkResearched) and after the tree-initialisation (RS_InitTree)
Definition at line 334 of file cp_research.cpp.
References technology_s::base, ccs, cgi, DEBUG_CLIENT, i, technology_s::id, technology_s::mailSent, MAILSENT_FINISHED, MAILSENT_PROPOSAL, ccs_s::numTechnologies, RS_FINISH, RS_GetTechByIDX(), RS_MarkOneResearchable(), RS_RequirementsMet(), RS_ResearchFinish(), technology_s::statusResearch, technology_s::statusResearchable, and technology_s::time.
Referenced by B_SellOrAddItems(), CP_CampaignInit(), RS_FillTechnologyList_f(), RS_MarkResearched(), and TEST_F().
|
static |
Mark technologies as researched. This includes techs that depends on "tech" and have time=0.
[in] | tech | Pointer to a technology_t struct. |
[in] | base | Pointer to base where we did research. |
Definition at line 761 of file cp_research.cpp.
References cgi, DEBUG_CLIENT, technology_s::id, RS_MarkResearchable(), and RS_ResearchFinish().
Referenced by RS_MarkStoryLineEventResearched(), and RS_ResearchRun().
bool RS_MarkStoryLineEventResearched | ( | const char * | techID | ) |
Pick a random base to research a story line event tech
techID | The event technology script id to research |
Definition at line 773 of file cp_research.cpp.
References B_GetNext(), RS_GetTechByID(), RS_IsResearched_ptr(), and RS_MarkResearched().
Referenced by CP_CheckCampaignEvents().
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 technologies (technology_t).
[in] | name | Unique id of a technology_t. This is parsed from "tech xxx" -> id=xxx |
[in] | text | the whole following text that is part of the "tech" item definition in research.ufo. |
Definition at line 1133 of file cp_research.cpp.
References _, requirement_s::amount, ccs, cgi, cgame_import_s::Com_EParse(), Com_HashKey(), Com_Parse(), cp_campaignPool, linkedList_t::data, DEBUG_CLIENT, technology_s::description, ERR_DROP, pediaChapter_s::first, hash, technology_s::hashNext, technology_s::hashProvidedNext, i, pediaChapter_s::id, requirement_s::id, technology_s::id, technology_s::idx, pediaChapter_s::last, requirements_s::links, technology_s::mail, MAX_DESCRIPTIONS, MAX_TECHLINKS, MAX_TECHNOLOGIES, techMail_s::model, linkedList_t::next, ccs_s::numChapters, technologyDescriptions_s::numDescriptions, requirements_s::numLinks, technology_s::numTechMails, ccs_s::numTechnologies, OBJZERO, technology_s::overallTime, cgame_import_s::PoolStrDup(), technology_s::preDescription, technology_s::provides, Q_streq, technology_s::requireAND, technology_s::requireForProduction, technology_s::requireOR, RS_ALIEN, RS_ARMOUR, RS_BUILDING, RS_CRAFT, RS_CRAFTITEM, RS_LINK_ALIEN, RS_LINK_ALIEN_DEAD, RS_LINK_ALIEN_GLOBAL, RS_LINK_ANTIMATTER, RS_LINK_ITEM, RS_LINK_TECH, RS_LINK_TECH_NOT, RS_LINK_UFO, RS_LOGIC, RS_NEWS, RS_NONE, RS_TECH, RS_UGV, RS_WEAPON, technology_s::statusResearch, technology_s::statusResearchable, Sys_Error(), technologyDescriptions_s::tech, TECH_HASH_SIZE, TECHMAIL_MAX, TECHMAIL_PRE, TECHMAIL_RESEARCHED, ccs_s::technologies, technologyDescriptions_s::text, technology_s::time, requirement_s::type, technology_s::type, technology_s::upChapter, ccs_s::upChapters, technology_s::upNext, technology_s::upPrev, and technologyDescriptions_s::usedDescription.
Referenced by CP_ParseScriptFirst().
Remove one scientist from research project if needed.
[in] | base | Pointer to base where a scientist should be removed. |
[in] | employee | Pointer to the employee that is fired. |
Definition at line 730 of file cp_research.cpp.
References cgi, Employee::chr, E_GetUnassignedEmployee(), EMPL_SCIENTIST, base_s::idx, RS_AssignScientist(), RS_GetTechWithMostScientists(), RS_RemoveScientist(), Employee::setAssigned(), and character_s::ucn.
Referenced by Employee::unassign().
void RS_RemoveScientist | ( | technology_t * | tech, |
Employee * | employee | ||
) |
Remove a scientist from a technology.
[in] | tech | The technology you want to remove the scientist from. |
[in] | employee | Employee you want to remove (nullptr if you don't care which one should be removed). |
Definition at line 694 of file cp_research.cpp.
References technology_s::base, CAP_AddCurrent(), CAP_LABSPACE, cgi, E_GetAssignedEmployee(), EMPL_SCIENTIST, RS_PAUSED, technology_s::scientists, Employee::setAssigned(), and technology_s::statusResearch.
Referenced by RS_Change_f(), RS_RemoveFiredScientist(), RS_RemoveScientistsExceedingCapacity(), and RS_StopResearch().
Remove all exceeding scientist.
[in,out] | base | Pointer to base where a scientist should be removed. |
Definition at line 1706 of file cp_research.cpp.
References CAP_GetFreeCapacity(), CAP_LABSPACE, CAP_SetCurrent(), RS_CountScientistsInBase(), RS_GetTechWithMostScientists(), and RS_RemoveScientist().
Referenced by CAP_CheckOverflow().
Assign Link pointers to all required techs/items/etc...
< Use this so we do not change the original redirectedTechs pointer.
Definition at line 419 of file cp_research.cpp.
References ccs, cgi, linkedList_t::data, i, linkedList_t::next, requirements_s::numLinks, ccs_s::numTechnologies, technology_s::redirect, redirectedTechs, technology_s::requireAND, technology_s::requireForProduction, technology_s::requireOR, RS_AssignTechLinks(), RS_GetTechByID(), and RS_GetTechByIDX().
Referenced by CP_ParseCampaignData().
bool RS_RequirementsMet | ( | const technology_t * | tech, |
const base_t * | base | ||
) |
Checks if all requirements of a tech have been met so that it becomes researchable.
[in] | tech | The technology we want to research |
[in] | base | In what base to check the "collected" items etc.. |
true
if all requirements are satisfied otherwise false
. Definition at line 150 of file cp_research.cpp.
References requirement_s::typelink_t::aircraft, AL_CountAll(), base_s::alienContainment, requirement_s::amount, B_AntimatterInBase(), B_ItemInBase(), cgi, DEBUG_CLIENT, AlienCargo::getAlive(), AlienCargo::getDead(), i, requirement_s::id, technology_s::id, requirement_s::link, requirements_s::links, requirements_s::numLinks, requirement_s::typelink_t::od, Q_streq, technology_s::requireAND, technology_s::requireOR, RS_IsResearched_ptr(), RS_LINK_ALIEN, RS_LINK_ALIEN_DEAD, RS_LINK_ALIEN_GLOBAL, RS_LINK_ANTIMATTER, RS_LINK_ITEM, RS_LINK_TECH, RS_LINK_TECH_NOT, RS_LINK_UFO, technology_s::statusResearchable, requirement_s::typelink_t::td, requirement_s::typelink_t::tech, requirement_s::type, and US_UFOsInStorage().
Referenced by RS_CheckRequirements(), RS_FillTechnologyList_f(), RS_MarkResearchable(), and RS_ResearchRun().
bool RS_ResearchAllowed | ( | const base_t * | base | ) |
Returns true if the current base is able to handle research.
Definition at line 1835 of file cp_research.cpp.
References B_GetBuildingStatus(), B_IsUnderAttack, B_LAB, E_CountHired(), and EMPL_SCIENTIST.
Referenced by B_BaseInit_f(), B_BuildingOpenAfterClick_f(), RS_ResearchRun(), RS_ShowActiveResearch_f(), and TR_TransferStart().
void RS_ResearchFinish | ( | technology_t * | tech | ) |
Sets a technology status to researched and updates the date.
[in] | tech | The technology that was researched. |
At this point we define what research-report description is used when displayed. (i.e. "usedDescription" is set here). That's because this is the first the player will see the research result and any later changes may make the content inconsistent for the player.
Definition at line 51 of file cp_research.cpp.
References _, technology_s::announce, ccs, cgi, Com_sprintf(), cp_messageBuffer, ccs_s::date, technology_s::description, technology_s::finishedResearchEvent, technology_s::id, technology_s::mailSent, MAILSENT_FINISHED, MSG_RESEARCH_FINISHED, MSO_CheckAddNewMessage(), technology_s::name, NT_RESEARCH_COMPLETED, technology_s::preDescription, technology_s::preResearchedDate, technology_s::researchedDate, RS_FINISH, RS_GetDescription(), RS_LOGIC, RS_StopResearch(), technology_s::statusResearch, technology_s::statusResearchable, technology_s::type, UP_OpenWith(), and technologyDescriptions_s::usedDescription.
Referenced by RS_InitTree(), RS_MarkResearchable(), and RS_MarkResearched().
Checks the research status.
Definition at line 813 of file cp_research.cpp.
References _, technology_s::base, ccs, Com_sprintf(), cp_messageBuffer, ccs_s::curCampaign, i, MSG_RESEARCH_HALTED, MSO_CheckAddNewMessage(), base_s::name, technology_s::name, NT_RESEARCH_HALTED, ccs_s::numTechnologies, campaign_s::researchRate, RS_GetTechByIDX(), RS_MarkResearched(), RS_RequirementsMet(), RS_ResearchAllowed(), RS_RUNNING, RS_StopResearch(), technology_s::scientists, technology_s::statusResearch, and technology_s::time.
Referenced by CP_CampaignRun(), and TEST_F().
This is called everytime RS_ParseTechnologies is called - to prevent cyclic hash tables.
Definition at line 1082 of file cp_research.cpp.
Referenced by CP_ResetCampaignData().
bool RS_SaveXML | ( | xmlNode_t * | parent | ) |
Save callback for research and technologies.
[out] | parent | XML Node structure, where we write the information to |
Definition at line 1724 of file cp_research.cpp.
References technology_s::base, ccs, cgi, cgame_import_s::Com_GetConstVariable(), date_s::day, i, technology_s::id, base_s::idx, technology_s::mail, technology_s::mailSent, ccs_s::numTechnologies, technology_s::preResearchedDate, techMail_s::read, technology_s::researchedDate, RS_GetTechByIDX(), SAVE_RESEARCH_BASE, SAVE_RESEARCH_DATE, SAVE_RESEARCH_ID, SAVE_RESEARCH_MAIL, SAVE_RESEARCH_MAIL_ID, SAVE_RESEARCH_MAILSENT, SAVE_RESEARCH_PREDATE, SAVE_RESEARCH_RESEARCH, SAVE_RESEARCH_SCIENTISTS, SAVE_RESEARCH_STATUSCOLLECTED, SAVE_RESEARCH_STATUSRESEARCH, SAVE_RESEARCH_STATUSRESEARCHABLE, SAVE_RESEARCH_TECH, SAVE_RESEARCH_TIME, SAVE_RESEARCHSTATUS_NAMESPACE, saveResearchConstants, technology_s::scientists, date_s::sec, technology_s::statusCollected, technology_s::statusResearch, technology_s::statusResearchable, TECHMAIL_MAX, technology_s::time, cgame_import_s::XML_AddNode(), and xmlNode_t.
Referenced by SAV_Init().
bool RS_ScriptSanityCheck | ( | void | ) |
Checks the parsed tech data for errors.
Definition at line 1845 of file cp_research.cpp.
References ccs, cgi, technology_s::description, i, technology_s::id, technology_s::name, ccs_s::numTechnologies, technology_s::produceTime, technology_s::provides, RS_ALIEN, RS_BUILDING, RS_LOGIC, RS_NEWS, RS_TECH, ccs_s::technologies, technologyDescriptions_s::text, and technology_s::type.
void RS_StopResearch | ( | technology_t * | tech | ) |
Stops a research (Removes scientists from it)
[in] | tech | The technology that is being researched. |
Definition at line 93 of file cp_research.cpp.
References RS_RemoveScientist(), and technology_s::scientists.
Referenced by B_AddToStorage(), RS_CheckRequirements(), RS_ResearchFinish(), RS_ResearchRun(), and RS_Stop_f().
|
static |
Definition at line 45 of file cp_research.cpp.
Referenced by RS_RequiredLinksAssign().
|
static |
Definition at line 42 of file cp_research.cpp.
|
static |
Definition at line 43 of file cp_research.cpp.
|
static |
The valid definition names in the research.ufo file.
Definition at line 1097 of file cp_research.cpp.
|
static |
The valid definition names in the research.ufo file for tech mails.
Definition at line 1114 of file cp_research.cpp.