|
UFO: Alien Invasion
|
Header for employee related stuff. More...

Go to the source code of this file.
Data Structures | |
| class | Employee |
Macros | |
| #define | E_Foreach(employeeType, var) |
Enumerations | |
| enum | employeeType_t { EMPL_SOLDIER , EMPL_SCIENTIST , EMPL_WORKER , EMPL_PILOT , EMPL_ROBOT , MAX_EMPL } |
| The types of employees. More... | |
Functions | |
| Employee * | E_CreateEmployee (employeeType_t type, const struct nation_s *nation, const struct ugv_s *ugvType=nullptr) |
| bool | E_DeleteEmployee (Employee *employee) |
| Removes the employee completely from the game (buildings + global list). | |
| int | E_CountByType (employeeType_t type) |
| Returns number of employees of a type. | |
| int | E_CountHired (const base_t *const base, employeeType_t type) |
| Counts hired employees of a given type in a given base. | |
| int | E_CountHiredRobotByType (const base_t *const base, const struct ugv_s *ugvType) |
| int | E_CountAllHired (const base_t *const base, const bool peopleOnly=false) |
| Counts all hired employees of a given base. | |
| int | E_CountUnhired (employeeType_t type) |
| Counts unhired employees of a given type in a given base. | |
| int | E_CountUnhiredRobotsByType (const struct ugv_s *ugvType) |
| int | E_CountUnassigned (const base_t *const base, employeeType_t type) |
| Counts unassigned employees of a given type in a given base. | |
| bool | E_HireEmployee (base_t *base, Employee *employee) |
| Hires the employee in a base. | |
| bool | E_HireEmployeeByType (base_t *base, employeeType_t type) |
| Hires the first free employee of that type. | |
| bool | E_HireRobot (base_t *base, const struct ugv_s *ugvType) |
| bool | E_UnhireEmployee (Employee *employee) |
| employeeType_t | E_GetEmployeeType (const char *type) |
| Convert string to employeeType_t. | |
| const char * | E_GetEmployeeString (employeeType_t type, int n) |
| Convert employeeType_t to translated string. | |
| Employee * | E_GetUnhired (employeeType_t type) |
| Iterates through unhired employees. | |
| Employee * | E_GetUnhiredRobot (const struct ugv_s *ugvType) |
| int | E_GetHiredEmployees (const base_t *const base, employeeType_t type, linkedList_t **hiredEmployees) |
| Return a list of hired employees in the given base of a given type. | |
| Employee * | E_GetHiredRobot (const base_t *const base, const struct ugv_s *ugvType) |
| Employee * | E_GetUnassignedEmployee (const base_t *const base, employeeType_t type) |
| Gets an assigned employee of a given type from the given base. | |
| Employee * | E_GetAssignedEmployee (const base_t *const base, employeeType_t type) |
| Gets an unassigned employee of a given type from the given base. | |
| Employee * | E_GetEmployeeFromChrUCN (int uniqueCharacterNumber) |
| Searches all employee for the ucn (character id). | |
| Employee * | E_GetEmployeeByTypeFromChrUCN (employeeType_t type, int uniqueCharacterNumber) |
| Searches employee from a type for the ucn (character id). | |
| void | E_UnhireAllEmployees (base_t *base, employeeType_t type) |
| Reset the hired flag for all employees of a given type in a given base. | |
| void | E_DeleteAllEmployees (base_t *base) |
| Removes all employees completely from the game (buildings + global list) from a given base. | |
| void | E_HireForBuilding (base_t *base, building_t *building, int num) |
| Hires some employees of appropriate type for a building. | |
| void | E_InitialEmployees (const struct campaign_s *campaign) |
| bool | E_MoveIntoNewBase (Employee *employee, base_t *newBase) |
| void | E_RemoveInventoryFromStorage (Employee *employee) |
| Removes the items of an employee (soldier) from the base storage (s)he is hired at. | |
| void | E_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. | |
| void | E_Shutdown (void) |
| Closing actions for employee-subsystem. | |
Header for employee related stuff.
Definition in file cp_employee.h.
| #define E_Foreach | ( | employeeType, | |
| var ) |
Definition at line 122 of file cp_employee.h.
Referenced by AIR_AssignInitial(), BS_FillMarket_f(), CHAR_UpdateStats(), CP_BaseAttackStartMission(), CP_CleanTempInventory(), CP_CleanupTeam(), CP_MissionEnd(), CP_TEAM_FillBDEFEmployeeList_f(), CP_TEAM_FillEmployeeList_f(), CP_TEAM_FillEquipSoldierList_f(), E_CountHired(), E_CountHiredRobotByType(), E_CountUnassigned(), E_CountUnhired(), E_CountUnhiredRobotsByType(), E_DeleteAllEmployees(), E_EmployeeList_f(), E_GetAssignedEmployee(), E_GetEmployeeByTypeFromChrUCN(), E_GetHiredEmployees(), E_GetUnassignedEmployee(), E_GetUnhired(), E_GetUnhiredRobot(), E_SaveXML(), E_UnhireAllEmployees(), HOS_HospitalRun(), HOS_Init_f(), NAT_HandleBudget(), STAT_GetExpenses_f(), TEST_F(), TEST_F(), TR_Add_f(), and TR_FillEmployees().
| enum employeeType_t |
The types of employees.
| Enumerator | |
|---|---|
| EMPL_SOLDIER | |
| EMPL_SCIENTIST | |
| EMPL_WORKER | |
| EMPL_PILOT | |
| EMPL_ROBOT | |
| MAX_EMPL | For counting over all available enums. |
Definition at line 30 of file cp_employee.h.
Counts all hired employees of a given base.
| [in] | base | The base where we count |
| [in] | peopleOnly | Count people only (skip robots) |
Definition at line 688 of file cp_employee.cpp.
References count, E_CountHired(), EMPL_ROBOT, i, MAX_EMPL, and type.
Referenced by B_ResetAllStatusAndCapacities(), and E_UpdateGUICount_f().
| int E_CountByType | ( | employeeType_t | type | ) |
Returns number of employees of a type.
| [in] | type | Employeetype to check |
Definition at line 39 of file cp_employee.cpp.
References ccs, cgi, and type.
Referenced by CP_BaseAttackPrepareBattle(), and E_HireForBuilding().
| int E_CountHired | ( | const base_t *const | base, |
| employeeType_t | type ) |
Counts hired employees of a given type in a given base.
| [in] | base | The base where we count (nullptr to count all). |
| [in] | type | The type of employee to search. |
Definition at line 649 of file cp_employee.cpp.
References count, E_Foreach, and type.
Referenced by CAP_UpdateStorageCap(), E_CountAllHired(), E_GetCounts_f(), E_UpdateGUICount_f(), PR_ProductionAllowed(), PR_ProductionInfo(), PR_ProductionList_f(), PR_UpdateProductionCap(), PR_WorkersAvailable(), RS_Change_f(), RS_FillTechnologyList_f(), RS_Max_f(), RS_ResearchAllowed(), RS_Stop_f(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TR_FillEmployees().
References type.
| int E_CountUnassigned | ( | const base_t *const | base, |
| employeeType_t | type ) |
Counts unassigned employees of a given type in a given base.
| [in] | type | The type of employee to search. |
| [in] | base | The base where we count |
Definition at line 741 of file cp_employee.cpp.
References count, E_Foreach, and type.
Referenced by RS_Change_f(), RS_FillTechnologyList_f(), RS_Max_f(), and RS_Stop_f().
| int E_CountUnhired | ( | employeeType_t | type | ) |
| Employee * E_CreateEmployee | ( | employeeType_t | type, |
| const struct nation_s * | nation, | ||
| const struct ugv_s * | ugvType = nullptr ) |
References type.
Removes all employees completely from the game (buildings + global list) from a given base.
| [in] | base | Which base the employee should be fired from. |
Definition at line 630 of file cp_employee.cpp.
References E_DeleteEmployee(), E_Foreach, EMPL_SOLDIER, i, MAX_EMPL, and type.
Referenced by B_Destroy(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
| bool E_DeleteEmployee | ( | Employee * | employee | ) |
Removes the employee completely from the game (buildings + global list).
| [in] | employee | The pointer to the employee you want to remove. |
Definition at line 602 of file cp_employee.cpp.
References Employee::baseHired, ccs, cgi, Employee::getType(), Employee::transfer, type, and Employee::unhire().
Referenced by AIR_DestroyAircraft(), CP_MissionEnd(), CP_SpawnRescueMission(), E_DeleteAllEmployees(), E_EmployeeDelete_f(), TEST_F(), and TR_EmptyTransferCargo().
| Employee * E_GetAssignedEmployee | ( | const base_t *const | base, |
| const employeeType_t | type ) |
Gets an unassigned employee of a given type from the given base.
| [in] | base | Which base the employee should be hired in. |
| [in] | type | The type of employee to search. |
Definition at line 334 of file cp_employee.cpp.
References E_Foreach, and type.
Referenced by RS_RemoveScientist().
| Employee * E_GetEmployeeByTypeFromChrUCN | ( | employeeType_t | type, |
| int | uniqueCharacterNumber ) |
Searches employee from a type for the ucn (character id).
| [in] | type | employee type |
| [in] | uniqueCharacterNumber | unique character number (UCN) |
Definition at line 832 of file cp_employee.cpp.
References E_Foreach, and type.
Referenced by AIR_GetPilot(), BS_Buy_f(), BS_ShowInfo_f(), and E_GetEmployeeFromChrUCN().
Searches all employee for the ucn (character id).
| [in] | uniqueCharacterNumber | unique character number (UCN) |
Definition at line 846 of file cp_employee.cpp.
References E_GetEmployeeByTypeFromChrUCN(), EMPL_SOLDIER, i, and MAX_EMPL.
Referenced by AIR_LoadAircraftXML(), CHAR_UpdateData(), CP_TEAM_AssignSoldierByUCN_f(), CP_TEAM_ChangeSkin_f(), CP_TEAM_DeEquipActor_f(), CP_TEAM_SelectActorByUCN_f(), E_ChangeName_f(), GAME_CP_GetSelectedChr(), TR_Add_f(), and TR_LoadXML().
|
extern |
Convert employeeType_t to translated string.
| type | employeeType_t value |
| n | number of persons of that kind (for plural detection) |
Definition at line 189 of file cp_employee.cpp.
References cgi, EMPL_PILOT, EMPL_ROBOT, EMPL_SCIENTIST, EMPL_SOLDIER, EMPL_WORKER, ERR_DROP, ngettext, and type.
Referenced by E_GetCounts_f(), HOS_GetRank(), NAT_HandleBudget(), TR_CargoList(), TR_FillEmployees(), and TR_List_f().
| employeeType_t E_GetEmployeeType | ( | const char * | type | ) |
Convert string to employeeType_t.
| type | Pointer to employee type string |
Definition at line 213 of file cp_employee.cpp.
References EMPL_PILOT, EMPL_ROBOT, EMPL_SCIENTIST, EMPL_SOLDIER, EMPL_WORKER, MAX_EMPL, Q_streq, and type.
Referenced by CL_ParseRanks(), and CP_TEAM_FillEmployeeList_f().
| int E_GetHiredEmployees | ( | const base_t *const | base, |
| employeeType_t | type, | ||
| linkedList_t ** | hiredEmployees ) |
Return a list of hired employees in the given base of a given type.
| [in] | base | Which base the employee should be searched in. If nullptr is given employees in all bases will be listed. |
| [in] | type | Which employee type to search for. |
| [out] | hiredEmployees | Linked list of hired employees in the base. |
-1 in case of an error. Definition at line 273 of file cp_employee.cpp.
References cgi, E_Foreach, MAX_EMPL, and type.
Referenced by E_GetHiredRobot().
References type.
| Employee * E_GetUnassignedEmployee | ( | const base_t *const | base, |
| const employeeType_t | type ) |
Gets an assigned employee of a given type from the given base.
| [in] | base | Which base the employee should be hired in. |
| [in] | type | The type of employee to search. |
Definition at line 353 of file cp_employee.cpp.
References E_Foreach, and type.
Referenced by RS_AssignScientist(), RS_Max_f(), and RS_RemoveFiredScientist().
| Employee * E_GetUnhired | ( | employeeType_t | type | ) |
Iterates through unhired employees.
Definition at line 49 of file cp_employee.cpp.
References E_Foreach, and type.
Referenced by E_HireEmployeeByType().
Hires the employee in a base.
| [in] | base | Which base the employee should be hired in |
| [in] | employee | Which employee to hire |
Definition at line 373 of file cp_employee.cpp.
References _, AIR_AutoAddPilotToAircraft(), Employee::baseHired, CAP_AddCurrent(), CAP_EMPLOYEES, CAP_GetFreeCapacity(), CAP_ITEMS, CP_Popup(), EMPL_PILOT, EMPL_ROBOT, EMPL_SCIENTIST, EMPL_SOLDIER, EMPL_WORKER, Employee::getType(), MAX_EMPL, PR_UpdateProductionCap(), and UGV_SIZE.
Referenced by E_EmployeeHire_f(), E_HireEmployeeByType(), E_HireRobot(), and TEST_F().
| bool E_HireEmployeeByType | ( | base_t * | base, |
| employeeType_t | type ) |
Hires the first free employee of that type.
| [in] | base | Which base the employee should be hired in |
| [in] | type | Which employee type do we search |
Definition at line 414 of file cp_employee.cpp.
References E_GetUnhired(), E_HireEmployee(), and type.
Referenced by B_SetUpFirstBase(), and E_HireForBuilding().
| void E_HireForBuilding | ( | base_t * | base, |
| building_t * | building, | ||
| int | num ) |
Hires some employees of appropriate type for a building.
| [in] | base | Which base the employee should be hired in. |
| [in] | building | in which building |
| [in] | num | how many employees, if -1, hire building->maxEmployees |
Definition at line 107 of file cp_employee.cpp.
References B_HANGAR, B_LAB, B_MISC, B_WORKSHOP, building_t::buildingType, cgi, DEBUG_CLIENT, E_CountByType(), E_HireEmployeeByType(), EMPL_SCIENTIST, EMPL_SOLDIER, EMPL_WORKER, and building_t::maxEmployees.
Referenced by B_AddBuildingToBasePos().
| bool E_HireRobot | ( | base_t * | base, |
| const struct ugv_s * | ugvType ) |
| void E_InitialEmployees | ( | const struct campaign_s * | campaign | ) |
This is more or less the initial Bind some of the functions in this file to console-commands that you can call ingame.
Definition at line 1027 of file cp_employee.cpp.
References cgi, debugEmployeeCmds, and E_InitCallbacks().
Referenced by CP_InitStartup().
Will change the base where the employee is located in and will also update the capacity in the affected bases.
| employee | The employee to change the base for |
| newBase | The base where the employee should be located at |
false if employee was a nullptr pointer Definition at line 151 of file cp_employee.cpp.
References Employee::baseHired, CAP_AddCurrent(), CAP_EMPLOYEES, CAP_ITEMS, EMPL_PILOT, EMPL_ROBOT, EMPL_SCIENTIST, EMPL_SOLDIER, EMPL_WORKER, Employee::getType(), MAX_EMPL, PR_UpdateProductionCap(), and UGV_SIZE.
Referenced by AIR_MoveAircraftIntoNewHomebase(), and TR_TransferStart().
Removes the items of an employee (soldier) from the base storage (s)he is hired at.
| [in] | employee | Pointer to the soldier whose items should be removed |
Definition at line 996 of file cp_employee.cpp.
References Item::ammoDef(), B_AddToStorage(), Employee::baseHired, Employee::chr, Item::def(), Inventory::getNextCont(), Container::getNextItem(), and character_t::inv.
Referenced by AIR_DestroyAircraft(), and AM_UpdateSurivorsAfterBattle().
Closing actions for employee-subsystem.
Definition at line 1036 of file cp_employee.cpp.
References ccs, cgi, debugEmployeeCmds, E_ShutdownCallbacks(), EMPL_SOLDIER, i, and MAX_EMPL.
Referenced by CP_Shutdown().
| void E_UnhireAllEmployees | ( | base_t * | base, |
| employeeType_t | type ) |