26 #include "../../cl_shared.h"
42 if (
cgi->Cmd_Argc() < 2) {
49 cgi->Com_Printf(
"RS_Max_f: Invalid tech '%s'\n",
cgi->
Cmd_Argv(1));
52 if (tech->
base && tech->
base != base) {
53 cgi->Com_Printf(
"RS_Max_f: Tech '%s' is not researched in this base\n",
cgi->
Cmd_Argv(1));
67 cgi->UI_ExecuteConfunc(
"ui_research_update_topic %s %d", tech->
id, tech->
scientists);
79 if (
cgi->Cmd_Argc() < 2) {
85 cgi->Com_Printf(
"RS_ChangeScientist_f: Invalid tech '%s'\n",
cgi->
Cmd_Argv(1));
88 if (tech->
base && tech->
base != base) {
89 cgi->Com_Printf(
"RS_ChangeScientist_f: Tech '%s' is not researched in this base\n",
cgi->
Cmd_Argv(1));
98 }
else if (tech->
base) {
102 cgi->UI_ExecuteConfunc(
"ui_research_update_topic %s %d", tech->
id, tech->
scientists);
114 if (
cgi->Cmd_Argc() < 2) {
120 cgi->Com_Printf(
"RS_Stop_f: Invalid tech '%s'\n",
cgi->
Cmd_Argv(1));
126 if (tech->
base != base) {
127 cgi->Com_Printf(
"RS_Stop_f: Tech '%s' is not researched in this base\n",
cgi->
Cmd_Argv(1));
133 cgi->UI_ExecuteConfunc(
"ui_research_update_topic %s %d", tech->
id, tech->
scientists);
143 if (
cgi->Cmd_Argc() < 2) {
149 cgi->Com_Printf(
"RS_GetDetails_f: Invalid tech '%s'\n",
cgi->
Cmd_Argv(1));
152 cgi->UI_ExecuteConfunc(
"ui_research_details \"%s\" \"%s\" \"%s\"",
_(tech->
name), tech->
image ? tech->
image :
"", tech->
mdl ? tech->
mdl :
"");
169 cgi->UI_ExecuteConfunc(
"ui_techlist_clear");
181 percentage = std::min(100, std::max(0, 100 -
int(round(tech->
time * 100.0 / tech->
overallTime))));
186 if (tech->
base == base) {
187 cgi->UI_ExecuteConfunc(
"ui_techlist_add %s \"%s\" %d %d %s %d \"%s\"",
190 cgi->UI_ExecuteConfunc(
"ui_techlist_add %s \"%s\" %d %d base %d \"%s\"",
199 cgi->UI_ExecuteConfunc(
"ui_techlist_add %s \"%s\" %d %d %s %d \"%s\"",
204 cgi->UI_ExecuteConfunc(
"ui_techlist_add %s \"%s\" %d %d %s %d \"%s\"",
216 if (
cgi->Cmd_Argc() < 2) {
221 if (base ==
nullptr) {
222 cgi->Com_Printf(
"PR_ShowActiveResearch_f: Invalid base_idx!\n");
233 if (tech->
base != base)
239 const double completition = (1 - tech->
time / tech->
overallTime) * 100;
240 cgi->UI_ExecuteConfunc(
"show_research %s \"%s\" %i %3.0f", tech->
id, tech->
name, tech->
scientists, completition);
246 {
"ui_research_getdetails",
RS_GetDetails_f,
"Show technology image/model in reseach screen"},
247 {
"ui_research_stop",
RS_Stop_f,
"Stops the research"},
248 {
"ui_research_change",
RS_Change_f,
"Change number of scientists working on the research"},
249 {
"ui_research_max",
RS_Max_f,
"Allocates as many scientists on the research as possible"},
251 {
nullptr,
nullptr,
nullptr}
256 cgi->Cmd_TableAddList(research_commands);
261 cgi->Cmd_TableRemoveList(research_commands);
static void RS_Stop_f(void)
Removes all scientists from the selected research-list entry.
static void RS_FillTechnologyList_f(void)
Fills technology list on research UI.
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.
Header for menu related research stuff.
researchStatus_t statusResearch
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 ...
static void RS_Change_f(void)
Script function to add and remove a scientist to the technology entry in the research-list.
base_t * B_GetCurrentSelectedBase(void)
returns the currently selected base
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.
static void RS_ShowActiveResearch_f(void)
Show active research topics in Base sections.
int E_CountHired(const base_t *const base, employeeType_t type)
Counts hired employees of a given type in a given base.
A base with all it's data.
base_t * B_GetFoundedBaseByIDX(int baseIdx)
Array bound check for the base index.
int CAP_GetFreeCapacity(const base_t *base, baseCapacities_t capacityType)
Returns the free capacity of a type.
static const cmdList_t research_commands[]
const cgame_import_t * cgi
This is the technology parsed from research.ufo.
bool RS_ResearchAllowed(const base_t *base)
Returns true if the current base is able to handle research.
technology_t * RS_GetTechByID(const char *id)
return a pointer to the technology identified by given id string
#define CAP_GetMax(base, capacity)
static void RS_Max_f(void)
Assign as many scientists to the research project as possible.
void RS_InitCallbacks(void)
void RS_StopResearch(technology_t *tech)
Stops a research (Removes scientists from it)
int E_CountUnassigned(const base_t *const base, employeeType_t type)
Counts unassigned employees of a given type in a given base.
Header file for single player campaign control.
Employee * E_GetUnassignedEmployee(const base_t *const base, const employeeType_t type)
Gets an assigned employee of a given type from the given base.
void RS_AssignScientist(technology_t *tech, base_t *base, Employee *employee)
Assigns scientist to the selected research-project.
Header for base management related stuff.
const char *IMPORT * Cmd_Argv(int n)
static void RS_GetDetails_f(void)
Shows research image/model and title on the research screen.
void RS_RemoveScientist(technology_t *tech, Employee *employee)
Remove a scientist from a technology.
void RS_ShutdownCallbacks(void)