/** * @brief Assign as many scientists to the research project as possible. */ static void RS_Max_f (void) { /* The base the tech is researched in. */ base_t* base = B_GetCurrentSelectedBase(); if (!base) return; if (cgi->Cmd_Argc() < 2) { Com_Printf("Usage: %s <tech_id>\n", cgi->Cmd_Argv(0)); return; } /* The technology you want to max out. */ technology_t* tech = RS_GetTechByID(cgi->Cmd_Argv(1)); if (!tech) { Com_Printf("RS_Max_f: Invalid tech '%s'\n", cgi->Cmd_Argv(1)); return; } if (tech->base && tech->base != base) { Com_Printf("RS_Max_f: Tech '%s' is not researched in this base\n", cgi->Cmd_Argv(1)); return; } /* Add as many scientists as possible to this tech. */ while (CAP_GetFreeCapacity(base, CAP_LABSPACE) > 0) { Employee* employee = E_GetUnassignedEmployee(base, EMPL_SCIENTIST); if (!employee) break; RS_AssignScientist(tech, base, employee); if (!employee->isAssigned()) break; } cgi->UI_ExecuteConfunc("ui_research_update_topic %s %d", tech->id, tech->scientists); cgi->UI_ExecuteConfunc("ui_research_update_caps %d %d %d %d", E_CountUnassigned(base, EMPL_SCIENTIST), E_CountHired(base, EMPL_SCIENTIST), CAP_GetFreeCapacity(base, CAP_LABSPACE), CAP_GetMax(base, CAP_LABSPACE)); }