72 cgi->Cvar_SetValue(
"mn_ucn", chr->
ucn);
75 cgi->CL_UpdateCharacterValues(chr);
99 if (
cgi->Cmd_Argc() < 2) {
100 cgi->Com_Printf(
"Usage: %s <category> <employeeid>\n",
cgi->Cmd_Argv(0));
108 int hiredEmployeeIdx;
109 if (
cgi->Cmd_Argc() == 3)
110 hiredEmployeeIdx = atoi(
cgi->Cmd_Argv(2));
112 hiredEmployeeIdx = -1;
117 cgi->UI_ExecuteConfunc(
"hire_clear");
121 if (e->isHired() && !e->isHiredInBase(base))
129 cgi->UI_ExecuteConfunc(
"hire_addemployee %i \"%s\" %i \"%s\"",
132 if (e->isAwayFromBase())
151 cgi->Cvar_Set(
"mn_show_employee",
"0");
154 cgi->Cvar_Set(
"mn_show_employee",
"3");
156 cgi->Cvar_Set(
"mn_show_employee",
"2");
158 cgi->Cvar_Set(
"mn_show_employee",
"1");
183 cgi->Cvar_ForceSet(
"mn_name", employee->
chr.
name);
197 if (
cgi->Cmd_Argc() < 2) {
198 cgi->Com_Printf(
"Usage: %s <num>\n",
cgi->Cmd_Argv(0));
203 int num = atoi(
cgi->Cmd_Argv(1));
211 if (!employee->
unhire()) {
212 cgi->UI_DisplayNotice(
_(
"Could not fire employee"), 2000,
"employees");
220 num = std::max(0, num - 1);
221 cgi->Cbuf_AddText(
"employee_select %i\n", num);
222 cgi->Cbuf_AddText(
"hire_select %i\n", num);
224 cgi->Cbuf_AddText(
"employee_update_count\n");
240 if (
cgi->Cmd_Argc() < 2) {
241 cgi->Com_Printf(
"Usage: %s <+num>\n",
cgi->Cmd_Argv(0));
245 const char* arg =
cgi->Cmd_Argv(1);
250 const int num = atoi(arg);
258 if (!employee->
unhire()) {
260 cgi->UI_DisplayNotice(
_(
"Could not fire employee"), 2000,
"employees");
262 cgi->UI_ExecuteConfunc(
"employeehire %i", num);
267 cgi->UI_DisplayNotice(
_(
"Could not hire employee"), 2000,
"employees");
268 cgi->UI_ExecuteConfunc(
"employeehire %i", num);
270 cgi->UI_ExecuteConfunc(
"employeefire %i", num);
274 cgi->Cbuf_AddText(
"hire_select %i\n", num);
285 if (
cgi->Cmd_Argc() < 2) {
286 cgi->Com_Printf(
"Usage: %s <num>\n",
cgi->Cmd_Argv(0));
290 const int num = atoi(
cgi->Cmd_Argv(1));
325 if (
cgi->Cmd_Argc() < 3) {
326 cgi->Com_Printf(
"Usage: %s <callback> <base-IDX>\n",
cgi->Cmd_Argv(0));
332 const int baseIdx = atoi(
cgi->Cmd_Argv(2));
334 if (base ==
nullptr) {
335 cgi->Com_Printf(
"E_GetCounts_f: Invalid base Idx given\n");
341 cgi->UI_ExecuteConfunc(
"%s %s %d %s",
354 {
"employee_update_count",
E_UpdateGUICount_f,
"Callback to update the employee count of the current GUI"},
355 {
"employee_init",
E_EmployeeList_f,
"Init function for employee hire menu"},
356 {
"employee_delete",
E_EmployeeDelete_f,
"Remove an employee from the global employee list"},
359 {
"employee_changename",
E_ChangeName_f,
"Change the name of an employee"},
361 {
"ui_get_employee_counts",
E_GetCounts_f,
"Callback return the number of each employee types hired on a base"},
362 {
nullptr,
nullptr,
nullptr}
Share stuff between the different cgame implementations.
bool unhire()
Fires an employee.
const aircraft_t * AIR_IsEmployeeInAircraft(const Employee *employee, const aircraft_t *aircraft)
Tells you if an employee is assigned to an aircraft.
base_t * B_GetFoundedBaseByIDX(int baseIdx)
Array bound check for the base index.
base_t * B_GetCurrentSelectedBase(void)
returns the currently selected base
Header file for single player campaign control.
const cgame_import_t * cgi
#define CAP_GetMax(base, capacity)
bool E_DeleteEmployee(Employee *employee)
Removes the employee completely from the game (buildings + global list).
Employee * E_GetEmployeeFromChrUCN(int uniqueCharacterNumber)
Searches all employee for the ucn (character id).
int E_CountAllHired(const base_t *const base, const bool peopleOnly)
Counts all hired employees of a given base.
const char * E_GetEmployeeString(employeeType_t type, int n)
Convert employeeType_t to translated string.
int E_CountHired(const base_t *const base, employeeType_t type)
Counts hired employees of a given type in a given base.
bool E_HireEmployee(base_t *base, Employee *employee)
Hires the employee in a base.
Header for employee related stuff.
employeeType_t
The types of employees.
#define E_Foreach(employeeType, var)
static int employeeCategory
static const cmdList_t employeeCmds[]
List of UI command callbacks.
static const char * E_GetEmployeeTypeString(employeeType_t type)
Convert employeeType_t to string id.
static void E_EmployeeDelete_f(void)
This removes an employee from the global list so that he/she is no longer hireable.
void E_InitCallbacks(void)
Register UI callbacks.
static void E_UpdateGUICount_f(void)
Update GUI with the current number of employee per category.
static void E_EmployeeSelect(Employee *employee)
void E_ShutdownCallbacks(void)
Unregister UI callbacks.
static void E_EmployeeHire_f(void)
Callback for employee_hire command.
static void E_ChangeName_f(void)
Change the name of the selected actor.
static int employeesInCurrentList
static linkedList_t * employeeList
static Employee * E_GetEmployeeByMenuIndex(int num)
Find an hired or free employee by the menu index.
static void E_GetCounts_f(void)
Returns the number of employees hired on a base for the UI.
static Employee * selectedEmployee
static void E_EmployeeSelect_f(void)
Callback function that updates the character cvars when calling employee_select.
static void E_EmployeeList_f(void)
Will fill the list with employees.
Header file for menu callback functions used for hire/fire employee menu.
bool HOS_NeedsHealing(const character_t &chr)
Header file for hospital related stuff.
QGL_EXTERN GLint GLenum type
bool Com_IsValidName(const char *input)
Checks whether the given input string is allowed to be used as a user-given name string for aircraft,...
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
An aircraft with all it's data.
A base with all it's data.
Describes a character with all its attributes.