Technology research. More...
#include "../cl_shared.h"
#include "../ui/ui_main.h"
#include "../ui/ui_popup.h"
#include "../../shared/parse.h"
#include "cp_campaign.h"
#include "cp_research.h"
#include "save/save_research.h"
Go to the source code of this file.
Defines | |
#define | TECH_HASH_SIZE 64 |
Functions | |
static void | RS_PushNewsWhenResearchedFinished (const technology_t *tech) |
Push a news about this tech when researched. | |
void | RS_ResearchFinish (technology_t *tech) |
Sets a technology status to researched and updates the date. | |
void | RS_StopResearch (technology_t *tech) |
Stops a research (Removes scientists from it). | |
void | RS_MarkOneResearchable (technology_t *tech) |
Marks one tech as researchable. | |
qboolean | RS_RequirementsMet (const requirements_t *requiredAND, const requirements_t *requiredOR, const base_t *base) |
Checks if all requirements of a tech have been met so that it becomes researchable. | |
const char * | RS_GetDescription (descriptions_t *desc) |
returns the currently used description for a technology. | |
void | RS_MarkCollected (technology_t *tech) |
Marks a give technology as collected. | |
void | RS_MarkResearchable (qboolean init, const base_t *base) |
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). | |
static void | RS_AssignTechLinks (requirements_t *reqs) |
Assign required tech/item/etc... pointers for a single requirements list. | |
void | RS_RequiredLinksAssign (void) |
Assign Link pointers to all required techs/items/etc... | |
technology_t * | RS_GetTechForItem (const objDef_t *item) |
void | RS_InitTree (qboolean 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. | |
void | RS_AssignScientist (technology_t *tech, base_t *base, employee_t *employee) |
Assigns scientist to the selected research-project. | |
void | RS_RemoveScientist (technology_t *tech, employee_t *employee) |
Remove a scientist from a technology. | |
void | RS_RemoveFiredScientist (base_t *base, employee_t *employee) |
Remove one scientist from research project if needed. | |
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. | |
qboolean | RS_MarkStoryLineEventResearched (const char *techID) |
void | RS_ResearchRun (void) |
Checks the research status. | |
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. | |
void | RS_ResetTechs (void) |
This is called everytime RS_ParseTechnologies is called - to prevent cyclic hash tables. | |
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). | |
static qboolean | RS_IsValidTechIndex (int techIdx) |
qboolean | RS_IsResearched_idx (int techIdx) |
Checks if the technology (tech-index) has been researched. | |
qboolean | RS_IsResearched_ptr (const technology_t *tech) |
Checks whether an item is already researched. | |
int | RS_Collected_ (const technology_t *tech) |
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. | |
technology_t * | RS_GetTechByID (const char *id) |
return a pointer to the technology identified by given id string | |
technology_t * | RS_GetTechByProvided (const char *idProvided) |
returns a pointer to the item tech (as listed in "provides") | |
technology_t * | RS_GetTechWithMostScientists (const struct base_s *base) |
Searches for the technology that has the most scientists assigned in a given base. | |
int | RS_GetTechIdxByName (const char *name) |
Returns the index (idx) of a "tech" entry given it's name. | |
int | RS_CountScientistsInBase (const base_t *base) |
Returns the number of employees searching in labs in given base. | |
void | RS_RemoveScientistsExceedingCapacity (base_t *base) |
Remove all exceeding scientist. | |
qboolean | RS_SaveXML (mxml_node_t *parent) |
Save callback for research and technologies. | |
qboolean | RS_LoadXML (mxml_node_t *parent) |
Load callback for research and technologies. | |
qboolean | RS_ResearchAllowed (const base_t *base) |
Returns true if the current base is able to handle research. | |
qboolean | RS_ScriptSanityCheck (void) |
Checks the parsed tech data for errors. | |
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. | |
static const value_t | valid_techmail_vars [] |
The valid definition names in the research.ufo file for tech mails. |
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.c.
#define TECH_HASH_SIZE 64 |
Definition at line 40 of file cp_research.c.
Referenced by RS_GetTechByID(), RS_GetTechByProvided(), RS_GetTechIdxByName(), and RS_ParseTechnologies().
void RS_AssignScientist | ( | technology_t * | tech, | |
base_t * | base, | |||
employee_t * | 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 NULL! That means "any". |
Definition at line 680 of file cp_research.c.
References _, B_GetBuildingInBaseByType(), B_LAB, technology_s::base, employee_s::building, CAP_LABSPACE, base_s::capacities, Com_DPrintf(), Com_Error(), Com_Printf(), cap_maxcur_s::cur, DEBUG_CLIENT, E_GetUnassignedEmployee(), EMPL_SCIENTIST, ERR_DROP, technology_s::id, employee_s::idx, technology_s::idx, cap_maxcur_s::max, base_s::name, technology_s::name, qtrue, RS_RUNNING, technology_s::scientists, technology_s::statusResearch, technology_s::statusResearchable, employee_s::type, and UI_Popup().
Referenced by RS_AssignScientist_f(), RS_ChangeScientist_f(), RS_MaxOutResearch(), and RS_RemoveFiredScientist().
static void RS_AssignTechLinks | ( | requirements_t * | reqs | ) | [static] |
Assign required tech/item/etc... pointers for a single requirements list.
Definition at line 413 of file cp_research.c.
References AIR_GetAircraft(), Com_Error(), Com_GetTeamDefinitionByID(), ERR_DROP, i, requirement_s::id, INVSH_GetItemByID(), requirement_s::link, requirements_s::links, requirements_s::numLinks, RS_GetTechByID(), RS_LINK_ALIEN, RS_LINK_ALIEN_DEAD, RS_LINK_ITEM, RS_LINK_TECH, RS_LINK_TECH_NOT, RS_LINK_UFO, and requirement_s::type.
Referenced by RS_InitTree(), and RS_RequiredLinksAssign().
int RS_Collected_ | ( | const technology_t * | tech | ) |
Definition at line 1638 of file cp_research.c.
References Com_DPrintf(), DEBUG_CLIENT, and technology_s::statusCollected.
Referenced by UP_AircraftDescription(), UP_Article(), UP_TechGetsDisplayed(), and UP_UGVDescription().
int RS_CountScientistsInBase | ( | const base_t * | base | ) |
Returns the number of employees searching in labs in given base.
[in] | base | Pointer to the base |
Definition at line 1763 of file cp_research.c.
References technology_s::base, ccs, ccs_s::numTechnologies, technology_s::scientists, and ccs_s::technologies.
Referenced by B_ResetAllStatusAndCapacities(), and RS_RemoveScientistsExceedingCapacity().
const char* RS_GetDescription | ( | descriptions_t * | desc | ) |
returns the currently used description for a technology.
[in] | desc | A list of possible descriptions (with tech-links that decide which one is the correct one) |
< Stored used description
Definition at line 292 of file cp_research.c.
References i, descriptions_s::numDescriptions, RS_GetTechByID(), RS_IsResearched_ptr(), descriptions_s::tech, descriptions_s::text, and descriptions_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 1667 of file cp_research.c.
References Com_HashKey(), Com_Printf(), hash(), technology_s::hashNext, technology_s::id, Q_strcasecmp, and TECH_HASH_SIZE.
Referenced by AIM_AutoEquipAircraft(), AIR_ParseAircraft(), AL_AddAliens(), B_ScriptSanityCheck(), BDEF_BaseDefenceMenuUpdate_f(), CL_ReadSinglePlayerData(), CP_AddTechAsResearchable_f(), CP_GetEventsByID(), CP_XVIInit(), MS_LoadXML(), RS_AssignTechLinks(), RS_GetDescription(), RS_LoadXML(), RS_MarkStoryLineEventResearched(), RS_RequiredLinksAssign(), TR_TransferAlienAfterMissionStart(), 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 1653 of file cp_research.c.
References ccs, RS_IsValidTechIndex(), and ccs_s::technologies.
Referenced by BaseSummary_Init(), CL_ParseResearchableCampaignStates(), CL_ParseResearchedCampaignItems(), RS_GetTechWithMostScientists(), RS_InitGUIData(), RS_MarkResearchable(), RS_RequiredLinksAssign(), RS_ResearchRun(), and RS_SaveXML().
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 1689 of file cp_research.c.
References Com_DPrintf(), 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_BuyType(), BS_MarketInfoClick_f(), GAME_CP_DisplayItemInfo(), RS_InitTree(), UFO_GetTechnologyFromType(), and UP_UGVDescription().
technology_t* RS_GetTechForItem | ( | const objDef_t * | item | ) |
Definition at line 489 of file cp_research.c.
References ccs, Com_Error(), 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_SellOrAddItems(), BDEF_AddSlotToSlotList(), BS_Autosell_f(), BS_InitMarket(), CL_CampaignRunMarket(), CP_AddItemAsCollected_f(), GAME_CP_GetModelForItem(), GAME_CP_ItemIsUseable(), PR_DecreaseProduction(), PR_DisassembleItem(), PR_IncreaseProduction(), PR_ItemIsProduceable(), PR_ItemProductionInfo(), PR_ProductionFrame(), PR_ProductionIncrease_f(), PR_ProductionListClick_f(), PR_ProductionListRightClick_f(), PR_QueueDelete(), PR_QueueNew(), PR_UpdateProductionList(), UP_AircraftItemDescription(), UP_DrawAssociatedAmmo(), and UP_ResearchedLinkClick_f().
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 1744 of file cp_research.c.
References Com_HashKey(), Com_Printf(), 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 1716 of file cp_research.c.
References technology_s::base, ccs, ccs_s::numTechnologies, RS_GetTechByIDX(), RS_RUNNING, technology_s::scientists, and technology_s::statusResearch.
Referenced by RS_RemoveFiredScientist(), and RS_RemoveScientistsExceedingCapacity().
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.
Definition at line 1123 of file cp_research.c.
References Cmd_AddCommand().
Referenced by CP_InitStartup().
void RS_InitTree | ( | qboolean | 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] | load | qtrue if we are loading a game, qfalse otherwise |
Add a function to reset ALL research-stati to RS_NONE; -> to be called after start of a new game.
Enhance ammo model display (see comment in code).
Definition at line 509 of file cp_research.c.
References AIR_GetNextFromBase(), ccs_s::aircraftTemplates, B_GetFoundedBaseByIDX(), ccs_s::buildingTemplates, byte, markResearched_s::campaign, ccs, Com_DPrintf(), Com_Error(), Com_Printf(), cp_campaignPool, csi, ccs_s::curCampaign, DEBUG_CLIENT, ERR_DROP, ERR_FATAL, i, aircraft_s::id, building_s::id, technology_s::id, objDef_s::id, objDef_s::idx, building_s::image, objDef_s::image, technology_s::image, INVSH_GetItemByIDX(), technology_s::mail, markResearched_s::markOnly, technology_s::markResearched, technology_s::mdl, Mem_PoolStrDup, aircraft_s::model, objDef_s::model, aircraft_s::name, building_s::name, objDef_s::name, technology_s::name, ccs_s::numAircraftTemplates, ccs_s::numBases, ccs_s::numBuildingTemplates, markResearched_s::numDefinitions, csi_s::numODs, ccs_s::numTechnologies, ccs_s::objDefTechs, csi_s::ods, technology_s::provides, qfalse, qtrue, 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().
qboolean RS_IsResearched_idx | ( | int | techIdx | ) |
Checks if the technology (tech-index) has been researched.
[in] | techIdx | index of the technology. |
Definition at line 1611 of file cp_research.c.
References ccs, qfalse, qtrue, RS_FINISH, RS_IsValidTechIndex(), technology_s::statusResearch, and ccs_s::technologies.
qboolean RS_IsResearched_ptr | ( | const technology_t * | tech | ) |
Checks whether an item is already researched.
Definition at line 1627 of file cp_research.c.
References qfalse, qtrue, RS_FINISH, and technology_s::statusResearch.
Referenced by AC_OpenUFOpedia_f(), AC_ResearchAlien_f(), AC_UpdateMenu(), AIM_CheckTechnologyIntoSlot(), AIM_CrafttypeFilter(), AIM_SelectableCraftItem(), AL_AddAliens(), B_BuildingInit(), B_SellOrAddItems(), BaseSummary_Init(), BDEF_BaseDefenceMenuUpdate_f(), BS_Autosell_f(), BS_BuyType(), BS_InitMarket(), CL_CampaignRunMarket(), CP_IsXVIResearched(), GAME_CP_ItemIsUseable(), GAME_CP_TeamIsKnown(), MAP_DrawMapMarkers(), PR_ProductionListClick_f(), PR_ProductionListRightClick_f(), PR_RequirementsMet(), PR_UpdateProductionList(), RS_GetDescription(), RS_MarkStoryLineEventResearched(), RS_RequirementsMet(), TR_TransferAlienAfterMissionStart(), UFO_AircraftToIDOnGeoscape(), UP_AircraftDescription(), UP_AircraftItemDescription(), UP_Article(), UP_GetUnreadMails(), UP_TechGetsDisplayed(), and UP_UGVDescription().
static qboolean RS_IsValidTechIndex | ( | int | techIdx | ) | [inline, static] |
Definition at line 1593 of file cp_research.c.
References ccs, MAX_TECHNOLOGIES, ccs_s::numTechnologies, qfalse, qtrue, and TECH_INVALID.
Referenced by RS_GetTechByIDX(), and RS_IsResearched_idx().
qboolean RS_LoadXML | ( | mxml_node_t * | parent | ) |
Load callback for research and technologies.
[in] | parent | XML Node structure, where we get the information from |
Definition at line 1843 of file cp_research.c.
References B_GetBaseByIDX(), technology_s::base, Com_GetConstIntFromNamespace(), Com_Printf(), Com_RegisterConstList(), Com_UnregisterConstList(), date_s::day, technology_s::mail, technology_s::mailSent, mxml_GetBool(), mxml_GetDate(), mxml_GetFloat(), mxml_GetInt(), mxml_GetNextNode(), mxml_GetNode(), mxml_GetString(), technology_s::preResearchedDate, qfalse, qtrue, 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, and technology_s::time.
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 328 of file cp_research.c.
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, qfalse, qtrue, RS_FINISH, technology_s::statusCollected, technology_s::statusResearch, and technology_s::time.
Referenced by AII_CarriedItems(), AL_AddAliens(), B_SellOrAddItems(), CP_AddItemAsCollected_f(), PR_DisassembleItem(), 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 113 of file cp_research.c.
References _, ccs, Com_DPrintf(), 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, qfalse, qtrue, RS_GetDescription(), technology_s::statusResearchable, and technology_s::time.
Referenced by CL_ParseResearchableCampaignStates(), CP_AddTechAsResearchable_f(), RS_MarkResearchable(), and RS_ResearchStart_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 358 of file cp_research.c.
References technology_s::base, ccs, Com_DPrintf(), DEBUG_CLIENT, i, technology_s::id, technology_s::mailSent, MAILSENT_FINISHED, MAILSENT_PROPOSAL, ccs_s::numTechnologies, qfalse, technology_s::requireAND, technology_s::requireOR, RS_FINISH, RS_GetTechByIDX(), RS_MarkOneResearchable(), RS_RequirementsMet(), RS_ResearchFinish(), technology_s::statusResearch, technology_s::statusResearchable, and technology_s::time.
Referenced by B_SellOrAddItems(), B_SetUpFirstBase(), RS_InitGUIData(), RS_MarkResearched(), RS_ResearchRun(), and RS_ResearchStart_f().
static void RS_MarkResearched | ( | technology_t * | tech, | |
const base_t * | base | |||
) | [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 809 of file cp_research.c.
References Com_DPrintf(), DEBUG_CLIENT, technology_s::id, qfalse, RS_MarkResearchable(), and RS_ResearchFinish().
Referenced by RS_MarkStoryLineEventResearched(), and RS_ResearchRun().
qboolean 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 821 of file cp_research.c.
References B_GetFoundedBaseByIDX(), ccs, ccs_s::numBases, qfalse, qtrue, RS_GetTechByID(), RS_IsResearched_ptr(), and RS_MarkResearched().
Referenced by CP_CheckCampaignEvents(), and CP_SpawnAlienBaseMission().
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. |
< Remove first char (i.e. we assume it's the "_")
Definition at line 1187 of file cp_research.c.
References _, requirement_s::amount, ccs, Com_DPrintf(), Com_EParse(), Com_EParseValue(), Com_Error(), Com_HashKey(), Com_Parse(), Com_Printf(), cp_campaignPool, DEBUG_CLIENT, technology_s::description, ERR_DROP, pediaChapter_s::first, hash(), technology_s::hashNext, technology_s::hashProvidedNext, pediaChapter_s::id, requirement_s::id, technology_s::id, technology_s::idx, pediaChapter_s::last, requirements_s::links, LIST_AddPointer(), LIST_AddString(), technology_s::mail, MAX_DESCRIPTIONS, MAX_TECHLINKS, MAX_TECHNOLOGIES, Mem_PoolStrDup, Mem_PoolStrDupTo, techMail_s::model, ccs_s::numChapters, descriptions_s::numDescriptions, requirements_s::numLinks, technology_s::numTechMails, ccs_s::numTechnologies, value_s::ofs, technology_s::overallTime, technology_s::preDescription, technology_s::provides, qfalse, 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, value_s::size, technology_s::statusResearch, technology_s::statusResearchable, value_s::string, descriptions_s::tech, TECH_HASH_SIZE, TECHMAIL_MAX, TECHMAIL_PRE, TECHMAIL_RESEARCHED, ccs_s::technologies, descriptions_s::text, technology_s::time, value_s::type, requirement_s::type, technology_s::type, technology_s::upChapter, ccs_s::upChapters, technology_s::upNext, technology_s::upPrev, descriptions_s::usedDescription, V_CLIENT_HUNK_STRING, V_NULL, and V_TRANSLATION_STRING.
Referenced by CL_ParseScriptFirst().
static void RS_PushNewsWhenResearchedFinished | ( | const technology_t * | tech | ) | [inline, static] |
Push a news about this tech when researched.
[in] | tech | Technology pointer. |
Definition at line 49 of file cp_research.c.
Referenced by RS_ResearchFinish().
void RS_RemoveFiredScientist | ( | base_t * | base, | |
employee_t * | employee | |||
) |
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 782 of file cp_research.c.
References E_GetUnassignedEmployee(), EMPL_SCIENTIST, RS_AssignScientist(), RS_GetTechWithMostScientists(), and RS_RemoveScientist().
Referenced by E_RemoveEmployeeFromBuildingOrAircraft().
void RS_RemoveScientist | ( | technology_t * | tech, | |
employee_t * | 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 (NULL if you don't care which one should be removed). |
Definition at line 741 of file cp_research.c.
References technology_s::base, employee_s::building, CAP_LABSPACE, base_s::capacities, Com_Error(), cap_maxcur_s::cur, E_GetAssignedEmployee(), EMPL_SCIENTIST, ERR_DROP, RS_PAUSED, technology_s::scientists, and technology_s::statusResearch.
Referenced by RS_ChangeScientist_f(), RS_RemoveFiredScientist(), RS_RemoveScientist_f(), RS_RemoveScientistsExceedingCapacity(), RS_ResearchFinish(), RS_ResearchRun(), and RS_StopResearch().
void RS_RemoveScientistsExceedingCapacity | ( | base_t * | base | ) |
Remove all exceeding scientist.
[in] | base | Pointer to base where a scientist should be removed. |
Definition at line 1782 of file cp_research.c.
References CAP_LABSPACE, base_s::capacities, cap_maxcur_s::cur, cap_maxcur_s::max, RS_CountScientistsInBase(), RS_GetTechWithMostScientists(), and RS_RemoveScientist().
Referenced by B_BuildingOnDestroy_f().
void RS_RequiredLinksAssign | ( | void | ) |
Assign Link pointers to all required techs/items/etc...
< Use this so we do not change the original redirectedTechs pointer.
Definition at line 455 of file cp_research.c.
References ccs, linkedList_s::data, i, LIST_Delete(), linkedList_s::next, requirements_s::numLinks, ccs_s::numTechnologies, technology_s::redirect, technology_s::requireAND, technology_s::requireForProduction, technology_s::requireOR, RS_AssignTechLinks(), RS_GetTechByID(), and RS_GetTechByIDX().
Referenced by CL_ReadSinglePlayerData().
qboolean RS_RequirementsMet | ( | const requirements_t * | requiredAND, | |
const requirements_t * | requiredOR, | |||
const base_t * | base | |||
) |
Checks if all requirements of a tech have been met so that it becomes researchable.
[in] | requiredAND | Pointer to a list of AND-related requirements. |
[in] | requiredOR | Pointer to a list of OR-related requirements. |
[in] | base | In what base to check the "collected" items etc.. |
true
if all requirements are satisfied otherwise . Definition at line 158 of file cp_research.c.
References AL_CountAll(), AL_GetAlienAmount(), requirement_s::amount, B_AntimatterInBase(), B_ItemInBase(), Com_DPrintf(), Com_Printf(), DEBUG_CLIENT, i, requirement_s::id, requirement_s::link, requirements_s::links, requirements_s::numLinks, qfalse, qtrue, 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, requirement_s::type, and US_UFOsInStorage().
Referenced by RS_MarkResearchable(), RS_ResearchRun(), and RS_ResearchStart_f().
Returns true if the current base is able to handle research.
Definition at line 1916 of file cp_research.c.
References B_GetBuildingStatus(), B_LAB, BASE_UNDER_ATTACK, base_s::baseStatus, E_CountHired(), EMPL_SCIENTIST, qfalse, and qtrue.
Referenced by B_BaseInit_f(), B_BuildingOpenAfterClick(), RS_ResearchRun(), 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 59 of file cp_research.c.
References _, ccs, Cmd_ExecuteString(), Com_sprintf(), cp_messageBuffer, ccs_s::date, technology_s::description, technology_s::finishedResearchEvent, technology_s::mailSent, MAILSENT_FINISHED, MSG_RESEARCH_FINISHED, MSO_CheckAddNewMessage(), technology_s::name, NT_RESEARCH_COMPLETED, technology_s::preDescription, technology_s::preResearchedDate, qfalse, qtrue, technology_s::researchedDate, RS_FINISH, RS_GetDescription(), RS_LOGIC, RS_PushNewsWhenResearchedFinished(), RS_RemoveScientist(), technology_s::scientists, technology_s::statusResearch, technology_s::statusResearchable, technology_s::type, and descriptions_s::usedDescription.
Referenced by RS_InitTree(), RS_MarkResearchable(), and RS_MarkResearched().
void RS_ResearchRun | ( | void | ) |
Checks the research status.
< If there are scientitsts there _has_ to be a base.
rudolfo: please verify; I changed from RS_InitGuiData to RS_MarkResearchable
Definition at line 843 of file cp_research.c.
References _, technology_s::base, ccs, Com_sprintf(), cp_messageBuffer, i, base_s::idx, MAX_BASES, MSG_RESEARCH_HALTED, MSO_CheckAddNewMessage(), base_s::name, technology_s::name, NT_RESEARCH_HALTED, ccs_s::numTechnologies, qfalse, technology_s::requireAND, technology_s::requireOR, RS_GetTechByIDX(), RS_MarkResearchable(), RS_MarkResearched(), RS_PAUSED, RS_RemoveScientist(), RS_RequirementsMet(), RS_ResearchAllowed(), RS_RUNNING, technology_s::scientists, technology_s::statusResearch, and technology_s::time.
Referenced by CL_CampaignRun().
void RS_ResetTechs | ( | void | ) |
This is called everytime RS_ParseTechnologies is called - to prevent cyclic hash tables.
Definition at line 1137 of file cp_research.c.
References LIST_Delete().
Referenced by CL_ResetSinglePlayerData().
qboolean RS_SaveXML | ( | mxml_node_t * | parent | ) |
Save callback for research and technologies.
[out] | parent | XML Node structure, where we write the information to |
Definition at line 1800 of file cp_research.c.
References technology_s::base, ccs, Com_GetConstVariable(), Com_RegisterConstList(), Com_UnregisterConstList(), date_s::day, technology_s::id, base_s::idx, technology_s::mail, technology_s::mailSent, mxml_AddBoolValue(), mxml_AddDate(), mxml_AddFloatValue(), mxml_AddInt(), mxml_AddIntValue(), mxml_AddNode(), mxml_AddString(), ccs_s::numTechnologies, technology_s::preResearchedDate, qtrue, 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, and technology_s::time.
Referenced by SAV_Init().
qboolean RS_ScriptSanityCheck | ( | void | ) |
Checks the parsed tech data for errors.
Definition at line 1931 of file cp_research.c.
References ccs, Com_Printf(), technology_s::description, error(), technology_s::id, technology_s::name, ccs_s::numTechnologies, technology_s::produceTime, technology_s::provides, qfalse, qtrue, RS_ALIEN, RS_BUILDING, RS_LOGIC, RS_NEWS, RS_TECH, ccs_s::technologies, descriptions_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 99 of file cp_research.c.
References RS_PAUSED, RS_RemoveScientist(), technology_s::scientists, and technology_s::statusResearch.
Referenced by RS_ResearchStop_f(), and US_RemoveStoredUFO().
linkedList_t* redirectedTechs [static] |
Definition at line 449 of file cp_research.c.
technology_t* techHash[TECH_HASH_SIZE] [static] |
Definition at line 41 of file cp_research.c.
technology_t* techHashProvided[TECH_HASH_SIZE] [static] |
Definition at line 42 of file cp_research.c.
const value_t valid_tech_vars[] [static] |
{ {"name", V_TRANSLATION_STRING, offsetof(technology_t, name), 0}, {"provides", V_CLIENT_HUNK_STRING, offsetof(technology_t, provides), 0}, {"event", V_CLIENT_HUNK_STRING, offsetof(technology_t, finishedResearchEvent), 0}, {"delay", V_INT, offsetof(technology_t, delay), MEMBER_SIZEOF(technology_t, delay)}, {"producetime", V_INT, offsetof(technology_t, produceTime), MEMBER_SIZEOF(technology_t, produceTime)}, {"time", V_FLOAT, offsetof(technology_t, time), MEMBER_SIZEOF(technology_t, time)}, {"image", V_CLIENT_HUNK_STRING, offsetof(technology_t, image), 0}, {"mdl", V_CLIENT_HUNK_STRING, offsetof(technology_t, mdl), 0}, {NULL, 0, 0, 0} }
The valid definition names in the research.ufo file.
Definition at line 1152 of file cp_research.c.
const value_t valid_techmail_vars[] [static] |
{ {"from", V_TRANSLATION_STRING, offsetof(techMail_t, from), 0}, {"to", V_TRANSLATION_STRING, offsetof(techMail_t, to), 0}, {"subject", V_TRANSLATION_STRING, offsetof(techMail_t, subject), 0}, {"date", V_TRANSLATION_STRING, offsetof(techMail_t, date), 0}, {"icon", V_CLIENT_HUNK_STRING, offsetof(techMail_t, icon), 0}, {"model", V_CLIENT_HUNK_STRING, offsetof(techMail_t, model), 0}, {NULL, 0, 0, 0} }
The valid definition names in the research.ufo file for tech mails.
Definition at line 1168 of file cp_research.c.