Single player employee stuff. More...
#include "../client.h"
#include "../cl_game.h"
#include "../cl_team.h"
#include "../ui/ui_main.h"
#include "../ui/ui_popup.h"
#include "cp_campaign.h"
#include "cp_employee_callbacks.h"
#include "cp_rank.h"
#include "save/save_employee.h"
Go to the source code of this file.
Functions | |
employee_t * | E_GetNext (employeeType_t type, employee_t *lastEmployee) |
Iterates through employees. | |
employee_t * | E_GetNextFromBase (employeeType_t type, employee_t *lastEmployee, const base_t *base) |
Iterates through employees on a base. | |
employee_t * | E_GetNextHired (employeeType_t type, employee_t *lastEmployee) |
Iterates through hired employees. | |
qboolean | E_IsAwayFromBase (const employee_t *employee) |
Tells you if a employee is away from his home base (gone in mission). | |
void | E_HireForBuilding (base_t *base, building_t *building, int num) |
Hires some employees of appropriate type for a building. | |
qboolean | E_IsInBase (const employee_t *empl, const base_t *const base) |
Checks whether the given employee is in the given base. | |
qboolean | E_MoveIntoNewBase (employee_t *employee, base_t *newBase) |
const char * | E_GetEmployeeString (employeeType_t type) |
Convert employeeType_t to translated string. | |
employeeType_t | E_GetEmployeeType (const char *type) |
Convert string to employeeType_t. | |
void | E_ResetEmployees (void) |
Clears the employees list for loaded and new games. | |
employee_t * | E_GetEmployee (const base_t *const base, employeeType_t type, int idx) |
Return a given employee pointer in the given base of a given type. Also returns those employees, that are not yet hired. | |
static employee_t * | E_GetUnhiredEmployee (employeeType_t type, int idx) |
Return a given "not hired" employee pointer in the given base of a given type. | |
employee_t * | E_GetUnhiredRobot (const ugv_t *ugvType) |
Return a "not hired" ugv-employee pointer of a given ugv-type. | |
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_t * | E_GetHiredRobot (const base_t *const base, const ugv_t *ugvType) |
Return a "hired" ugv-employee pointer of a given ugv-type in a given base. | |
static qboolean | E_EmployeeIsUnassigned (const employee_t *employee) |
Returns true if the employee is _only_ listed in the global list. | |
employee_t * | E_GetAssignedEmployee (const base_t *const base, const employeeType_t type) |
Gets an unassigned employee of a given type from the given base. | |
employee_t * | E_GetUnassignedEmployee (const base_t *const base, const employeeType_t type) |
Gets an assigned employee of a given type from the given base. | |
qboolean | E_HireEmployee (base_t *base, employee_t *employee) |
Hires the employee in a base. | |
qboolean | E_HireEmployeeByType (base_t *base, employeeType_t type) |
Hires the first free employee of that type. | |
qboolean | E_HireRobot (base_t *base, const ugv_t *ugvType) |
Hires the first free employee of that type. | |
void | E_ResetEmployee (employee_t *employee) |
Removes the inventory of the employee and also removes him from buildings. | |
qboolean | E_UnhireEmployee (employee_t *employee) |
Fires an employee. | |
void | E_UnhireAllEmployees (base_t *base, employeeType_t type) |
Reset the hired flag for all employees of a given type in a given base. | |
static employee_t * | E_CreateEmployeeAtIndex (employeeType_t type, nation_t *nation, const ugv_t *ugvType, const int emplIdx) |
Creates an entry of a new employee at the passed index location in the global list and assignes it to no building/base. | |
employee_t * | E_CreateEmployee (employeeType_t type, nation_t *nation, const ugv_t *ugvType) |
Creates an entry of a new employee in the global list and assignes it to no building/base. | |
qboolean | E_DeleteEmployee (employee_t *employee, employeeType_t type) |
Removes the employee completely from the game (buildings + global list). | |
void | E_DeleteAllEmployees (base_t *base) |
Removes all employees completely from the game (buildings + global list) from a given base. | |
void | E_DeleteEmployeesExceedingCapacity (base_t *base) |
Removes employee until all employees fit in quarters capacity. | |
void | E_RefreshUnhiredEmployeeGlobalList (const employeeType_t type, const qboolean excludeUnhappyNations) |
Recreates all the employees for a particular employee type in the global list. But it does not overwrite any employees already hired. | |
qboolean | E_RemoveEmployeeFromBuildingOrAircraft (employee_t *employee) |
Remove one employee from building. | |
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 ugv_t *ugvType) |
Counts 'hired' (i.e. bought or produced UGVs and other robots of a given ugv-type in a given base. | |
int | E_CountAllHired (const base_t *const base) |
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 ugv_t *ugvType) |
Counts all available Robots/UGVs that are for sale. | |
int | E_CountUnassigned (const base_t *const base, employeeType_t type) |
Counts unassigned employees of a given type in a given base. | |
static nation_t * | E_RandomNation (void) |
Hack to get a random nation for the initial. | |
void | E_InitialEmployees (void) |
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. Called from UI_InitStartup resp. CL_InitLocal. | |
employee_t * | E_GetEmployeeFromChrUCN (int uniqueCharacterNumber) |
Searches all employee for the ucn (character id). | |
qboolean | E_SaveXML (mxml_node_t *p) |
Save callback for savegames in XML Format. | |
qboolean | E_LoadXML (mxml_node_t *p) |
Load callback for savegames in XML Format. | |
qboolean | E_HireAllowed (const base_t *base) |
Returns true if the current base is able to handle employees. | |
void | E_RemoveInventoryFromStorage (employee_t *employee) |
Removes the items of an employee (soldier) from the base storage (s)he is hired at. |
Single player employee stuff.
Definition in file cp_employee.c.
int E_CountAllHired | ( | const base_t *const | base | ) |
Counts all hired employees of a given base.
[in] | base | The base where we count |
Definition at line 1064 of file cp_employee.c.
References count, E_CountHired(), MAX_EMPL, and type.
Referenced by B_ResetAllStatusAndCapacities(), and E_UpdateGUICount_f().
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 (NULL to count all). |
[in] | type | The type of employee to search. |
Definition at line 1026 of file cp_employee.c.
References count, E_GetNextHired(), and E_IsInBase().
Referenced by B_CheckBuildingStatusForMenu_f(), B_RemoveItemsExceedingCapacity(), B_UpdateStorageCap(), BaseSummary_Init(), CL_ActorPilotSelect_f(), CL_ActorTeamSelect_f(), CL_AssignPilot_f(), CL_AssignSoldier_f(), CL_EquipSoldierState(), E_CountAllHired(), E_UpdateGUICount_f(), PR_CalculateProductionPercentDone(), PR_ProductionAllowed(), PR_ProductionList_f(), PR_QueueNew(), PR_UpdateProductionCap(), RS_ResearchAllowed(), RS_UpdateInfo(), TR_CargoListSelect_f(), and TR_TransferListSelect_f().
Counts 'hired' (i.e. bought or produced UGVs and other robots of a given ugv-type in a given base.
[in] | base | The base where we count (NULL to count all). |
[in] | ugvType | What type of robot/ugv we are looking for. |
Definition at line 1044 of file cp_employee.c.
References count, E_GetNextHired(), E_IsInBase(), EMPL_ROBOT, and employee_s::ugv.
Referenced by BS_BuyType().
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 1117 of file cp_employee.c.
References employee_s::building, count, and E_GetNextFromBase().
Referenced by RS_InitGUI(), and RS_UpdateInfo().
int E_CountUnhired | ( | employeeType_t | type | ) |
Counts unhired employees of a given type in a given base.
[in] | type | The type of employee to search. |
Definition at line 1084 of file cp_employee.c.
References count, E_GetNext(), and E_IsHired.
int E_CountUnhiredRobotsByType | ( | const ugv_t * | ugvType | ) |
Counts all available Robots/UGVs that are for sale.
[in] | ugvType | What type of robot/ugv we are looking for. |
Definition at line 1100 of file cp_employee.c.
References count, E_GetNext(), E_IsHired, EMPL_ROBOT, and employee_s::ugv.
Referenced by BS_BuyItem_f(), and BS_BuyType().
employee_t* E_CreateEmployee | ( | employeeType_t | type, | |
nation_t * | nation, | |||
const ugv_t * | ugvType | |||
) |
Creates an entry of a new employee in the global list and assignes it to no building/base.
[in] | type | What type of employee to create. |
[in] | nation | What nation the employee (mainly used for soldiers in singleplayer) comes from. |
[in] | ugvType | What type of ugv this employee is. |
Definition at line 742 of file cp_employee.c.
References E_CreateEmployeeAtIndex().
Referenced by CP_NationHandleBudget(), and E_InitialEmployees().
static employee_t* E_CreateEmployeeAtIndex | ( | employeeType_t | type, | |
nation_t * | nation, | |||
const ugv_t * | ugvType, | |||
const int | emplIdx | |||
) | [static] |
Creates an entry of a new employee at the passed index location in the global list and assignes it to no building/base.
[in] | type | Tell the function what type of employee to create. |
[in] | nation | Tell the function what nation the employee (mainly used for soldiers in singleplayer) comes from. |
[in] | ugvType | Tell the function what type of ugv this employee is. |
[in] | emplIdx | the index of the employee to create. -1 will use the next available index, >=0 will be used as the index of the employee. |
Definition at line 638 of file cp_employee.c.
References ugv_s::actors, employee_s::baseHired, employee_s::building, ccs, employee_s::chr, CL_GenerateCharacter(), CL_GetRankIdx(), Com_DPrintf(), Com_Error(), Com_sprintf(), Com_ValueToStr(), ccs_s::curCampaign, DEBUG_CLIENT, EMPL_PILOT, EMPL_ROBOT, EMPL_SCIENTIST, EMPL_SOLDIER, EMPL_WORKER, ccs_s::employees, ERR_DROP, GAME_GetTeamDef(), employee_s::idx, MAX_EMPL, MAX_EMPLOYEES, MAX_VAR, employee_s::nation, ccs_s::numEmployees, Q_strncpyz(), chrScoreGlobal_s::rank, character_s::score, employee_s::speed, campaign_s::team, TEAM_ALIEN, employee_s::type, employee_s::ugv, and V_TEAM.
Referenced by E_CreateEmployee(), and E_RefreshUnhiredEmployeeGlobalList().
void E_DeleteAllEmployees | ( | base_t * | base | ) |
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 851 of file cp_employee.c.
References employee_s::baseHired, ccs, Com_DPrintf(), DEBUG_CLIENT, E_DeleteEmployee(), E_IsInBase(), EMPL_SOLDIER, ccs_s::employees, i, MAX_EMPL, ccs_s::numEmployees, and type.
qboolean E_DeleteEmployee | ( | employee_t * | employee, | |
employeeType_t | type | |||
) |
Removes the employee completely from the game (buildings + global list).
[in] | employee | The pointer to the employee you want to remove. |
[in] | type | What type of employee to delete. |
Definition at line 762 of file cp_employee.c.
References aircraft_s::acTeam, transfer_s::active, AIR_GetNextFromBase(), B_GetFoundedBaseByIDX(), employee_s::baseHired, ccs, Com_DPrintf(), linkedList_s::data, DEBUG_CLIENT, E_UnhireEmployee(), EMPL_PILOT, transfer_s::employeeArray, ccs_s::employees, i, employee_s::idx, MAX_BASES, MAX_EMPL, MAX_EMPLOYEES, linkedList_s::next, ccs_s::numEmployees, ccs_s::numTransfers, aircraft_s::pilot, qfalse, qtrue, employee_s::transfer, ccs_s::transfers, and employee_s::type.
Referenced by AIR_DestroyAircraft(), B_RemoveItemsExceedingCapacity(), CP_MissionEnd(), CP_SpawnRescueMission(), E_DeleteAllEmployees(), E_DeleteEmployeesExceedingCapacity(), and E_EmployeeDelete_f().
void E_DeleteEmployeesExceedingCapacity | ( | base_t * | base | ) |
Removes employee until all employees fit in quarters capacity.
[in] | base | Pointer to the base where the number of employees should be updated. |
Definition at line 889 of file cp_employee.c.
References CAP_EMPLOYEES, base_s::capacities, ccs, Com_Printf(), cap_maxcur_s::cur, E_DeleteEmployee(), E_IsInBase(), EMPL_ROBOT, ccs_s::employees, i, cap_maxcur_s::max, MAX_EMPL, base_s::name, ccs_s::numEmployees, and type.
Referenced by B_BuildingOnDestroy_f().
static qboolean E_EmployeeIsUnassigned | ( | const employee_t * | employee | ) | [inline, static] |
Returns true if the employee is _only_ listed in the global list.
[in] | employee | The employee_t pointer to check |
Definition at line 438 of file cp_employee.c.
References employee_s::building, Com_Error(), and ERR_DROP.
Referenced by E_GetAssignedEmployee(), and E_GetUnassignedEmployee().
employee_t* 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 454 of file cp_employee.c.
References E_EmployeeIsUnassigned(), and E_GetNextFromBase().
Referenced by RS_RemoveScientist().
employee_t* E_GetEmployee | ( | const base_t *const | base, | |
employeeType_t | type, | |||
int | idx | |||
) |
Return a given employee pointer in the given base of a given type. Also returns those employees, that are not yet hired.
[in] | base | Which base the employee should be hired in. |
[in] | type | Which employee type do we search. |
[in] | idx | Which employee id (in global employee array) |
Definition at line 292 of file cp_employee.c.
References E_GetNext(), E_IsHired, E_IsInBase(), employee_s::idx, and MAX_EMPL.
employee_t* E_GetEmployeeFromChrUCN | ( | int | uniqueCharacterNumber | ) |
Searches all employee for the ucn (character id).
[in] | uniqueCharacterNumber | unique character number (UCN) |
Definition at line 1207 of file cp_employee.c.
References employee_s::chr, E_GetNext(), and character_s::ucn.
Referenced by AIR_LoadAircraftXML(), CP_ParseCharacterData(), E_ChangeName_f(), and TR_LoadXML().
const char* E_GetEmployeeString | ( | employeeType_t | type | ) |
Convert employeeType_t to translated string.
type | employeeType_t value |
Definition at line 224 of file cp_employee.c.
References _, Com_Error(), EMPL_PILOT, EMPL_ROBOT, EMPL_SCIENTIST, EMPL_SOLDIER, EMPL_WORKER, and ERR_DROP.
Referenced by B_CheckBuildingStatusForMenu_f(), BaseSummary_Init(), CL_StatsUpdate_f(), CP_NationHandleBudget(), HOS_UpdateMenu(), TR_CargoList(), and TR_TransferSelect().
employeeType_t E_GetEmployeeType | ( | const char * | type | ) |
Convert string to employeeType_t.
type | Pointer to employee type string |
Definition at line 248 of file cp_employee.c.
References EMPL_PILOT, EMPL_ROBOT, EMPL_SCIENTIST, EMPL_SOLDIER, EMPL_WORKER, and MAX_EMPL.
Referenced by CL_ParseRanks().
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 NULL 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. |
Definition at line 371 of file cp_employee.c.
References Com_Printf(), E_GetNextHired(), E_IsInBase(), LIST_AddPointer(), LIST_Count(), LIST_Delete(), MAX_EMPL, and employee_s::transfer.
Referenced by CL_UpdateEmployeeList(), CP_BaseAttackStartMission(), CP_GetWinProbabilty(), E_GenerateHiredEmployeesList(), and E_GetHiredRobot().
employee_t* E_GetHiredRobot | ( | const base_t *const | base, | |
const ugv_t * | ugvType | |||
) |
Return a "hired" ugv-employee pointer of a given ugv-type in a given base.
[in] | base | Which base the ugv should be searched in.c |
[in] | ugvType | What type of robot we want. |
Definition at line 402 of file cp_employee.c.
References Com_DPrintf(), linkedList_s::data, DEBUG_CLIENT, E_GetHiredEmployees(), E_IsHired, E_IsInBase(), EMPL_ROBOT, LIST_Delete(), linkedList_s::next, and employee_s::ugv.
Referenced by B_RemoveItemsExceedingCapacity(), and BS_SellItem_f().
employee_t* E_GetNext | ( | employeeType_t | type, | |
employee_t * | lastEmployee | |||
) |
Iterates through employees.
[in] | type | Employee type to look for |
[in] | lastEmployee | Pointer of the employee to iterate from. call with NULL to get the first one. |
Definition at line 43 of file cp_employee.c.
References ccs, ccs_s::employees, and ccs_s::numEmployees.
Referenced by E_CountUnhired(), E_CountUnhiredRobotsByType(), E_EmployeeList_f(), E_EmployeeListScroll_f(), E_GetEmployee(), E_GetEmployeeFromChrUCN(), E_GetNextFromBase(), E_GetNextHired(), E_GetUnhiredEmployee(), E_GetUnhiredRobot(), and E_SaveXML().
employee_t* E_GetNextFromBase | ( | employeeType_t | type, | |
employee_t * | lastEmployee, | |||
const base_t * | base | |||
) |
Iterates through employees on a base.
[in] | type | Employee type to look for |
[in] | lastEmployee | Pointer of the employee to iterate from. call with NULL to get the first one. |
[in] | base | Pointer to the base where employee hired at |
Definition at line 73 of file cp_employee.c.
References E_GetNext(), and E_IsInBase().
Referenced by CL_UpdateCharacterStats(), E_CountUnassigned(), E_GetAssignedEmployee(), E_GetUnassignedEmployee(), E_UnhireAllEmployees(), HOS_HealAll(), HOS_ListClick_f(), HOS_UpdateMenu(), TR_GetTransferEmployee(), TR_TransferListSelect_f(), and TR_TransferSelect().
employee_t* E_GetNextHired | ( | employeeType_t | type, | |
employee_t * | lastEmployee | |||
) |
Iterates through hired employees.
[in] | type | Employee type to look for |
[in] | lastEmployee | Pointer of the employee to iterate from. call with NULL to get the first one. |
Definition at line 91 of file cp_employee.c.
References E_GetNext(), and E_IsHired.
Referenced by CL_StatsUpdate_f(), CP_NationHandleBudget(), E_CountHired(), E_CountHiredRobotByType(), E_GetHiredEmployees(), and HOS_HospitalRun().
employee_t* 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 472 of file cp_employee.c.
References E_EmployeeIsUnassigned(), and E_GetNextFromBase().
Referenced by RS_AssignScientist(), RS_MaxOutResearch(), and RS_RemoveFiredScientist().
static employee_t* E_GetUnhiredEmployee | ( | employeeType_t | type, | |
int | idx | |||
) | [static] |
Return a given "not hired" employee pointer in the given base of a given type.
[in] | type | Which employee type to search for. |
[in] | idx | Which employee id (in global employee array). Use -1, -2, etc.. to return the first/ second, etc... "unhired" employee. |
Definition at line 316 of file cp_employee.c.
References ccs, Com_Printf(), E_GetNext(), E_IsHired, employee_s::idx, MAX_EMPL, and ccs_s::numEmployees.
Referenced by E_HireEmployeeByType().
employee_t* E_GetUnhiredRobot | ( | const ugv_t * | ugvType | ) |
Return a "not hired" ugv-employee pointer of a given ugv-type.
[in] | ugvType | What type of robot we want. |
Definition at line 349 of file cp_employee.c.
References Com_Printf(), E_GetNext(), E_IsHired, EMPL_ROBOT, and employee_s::ugv.
Referenced by E_HireRobot().
Returns true if the current base is able to handle employees.
Definition at line 1350 of file cp_employee.c.
References B_GetBuildingStatus(), B_QUARTERS, BASE_UNDER_ATTACK, base_s::baseStatus, qfalse, and qtrue.
Referenced by B_BaseInit_f(), and B_BuildingOpenAfterClick().
qboolean E_HireEmployee | ( | base_t * | base, | |
employee_t * | employee | |||
) |
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 490 of file cp_employee.c.
References _, AIR_AutoAddPilotToAircraft(), employee_s::baseHired, CAP_EMPLOYEES, CAP_ITEMS, base_s::capacities, cap_maxcur_s::cur, EMPL_PILOT, EMPL_ROBOT, EMPL_SCIENTIST, EMPL_SOLDIER, EMPL_WORKER, cap_maxcur_s::max, MAX_EMPL, PR_UpdateProductionCap(), qfalse, qtrue, employee_s::type, UGV_SIZE, and UI_Popup().
Referenced by E_EmployeeHire_f(), E_HireEmployeeByType(), E_HireRobot(), and TR_EmptyTransferCargo().
qboolean 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 530 of file cp_employee.c.
References E_GetUnhiredEmployee(), E_HireEmployee(), and qfalse.
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 144 of file cp_employee.c.
References B_HANGAR, B_LAB, B_MISC, B_WORKSHOP, building_s::buildingType, ccs, Com_DPrintf(), DEBUG_CLIENT, E_HireEmployeeByType(), EMPL_SCIENTIST, EMPL_SOLDIER, EMPL_WORKER, building_s::maxEmployees, and ccs_s::numEmployees.
Referenced by B_AddBuildingToBasePos().
Hires the first free employee of that type.
[in] | base | Which base the ugv/robot should be hired in. |
[in] | ugvType | What type of ugv/robot should be hired. |
Definition at line 542 of file cp_employee.c.
References E_GetUnhiredRobot(), E_HireEmployee(), and qfalse.
Referenced by BS_BuyItem_f().
void E_InitialEmployees | ( | void | ) |
Definition at line 1143 of file cp_employee.c.
References ccs, Com_GetUGVByID(), ccs_s::curCampaign, E_CreateEmployee(), E_RandomNation(), EMPL_PILOT, EMPL_ROBOT, EMPL_SCIENTIST, EMPL_SOLDIER, EMPL_WORKER, frand(), i, MAX_EMPLOYEES, ccs_s::nations, ccs_s::numNations, campaign_s::scientists, campaign_s::soldiers, campaign_s::ugvs, and campaign_s::workers.
Referenced by B_SetUpFirstBase().
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. Called from UI_InitStartup resp. CL_InitLocal.
Definition at line 1196 of file cp_employee.c.
References Cmd_AddCommand().
Referenced by CP_InitStartup().
qboolean E_IsAwayFromBase | ( | const employee_t * | employee | ) |
Tells you if a employee is away from his home base (gone in mission).
[in] | employee | Pointer to the employee. |
Definition at line 107 of file cp_employee.c.
References AIR_GetNextFromBase(), AIR_IsAircraftInBase(), AIR_IsInAircraftTeam(), employee_s::baseHired, E_IsHired, EMPL_PILOT, EMPL_ROBOT, EMPL_SOLDIER, qfalse, qtrue, employee_s::transfer, and employee_s::type.
Referenced by CP_BaseAttackStartMission(), CP_GetWinProbabilty(), HOS_ListClick_f(), and HOS_UpdateMenu().
qboolean E_IsInBase | ( | const employee_t * | empl, | |
const base_t *const | base | |||
) |
Checks whether the given employee is in the given base.
Definition at line 185 of file cp_employee.c.
References employee_s::baseHired, E_IsHired, qfalse, and qtrue.
Referenced by CP_MissionEnd(), E_CountHired(), E_CountHiredRobotByType(), E_DeleteAllEmployees(), E_DeleteEmployeesExceedingCapacity(), E_EmployeeList_f(), E_EmployeeListScroll_f(), E_GetEmployee(), E_GetHiredEmployees(), E_GetHiredRobot(), E_GetNextFromBase(), and TR_TransferStart().
qboolean E_LoadXML | ( | mxml_node_t * | p | ) |
Load callback for savegames in XML Format.
[in] | p | XML Node structure, where we get the information from |
Definition at line 1273 of file cp_employee.c.
References B_GetBaseByIDX(), employee_s::baseHired, employee_s::building, ccs_s::buildings, ccs, employee_s::chr, CL_LoadCharacterXML(), Com_GetConstIntFromNamespace(), Com_GetUGVByIDSilent(), Com_Printf(), Com_RegisterConstList(), Com_UnregisterConstList(), ccs_s::employees, i, base_s::idx, employee_s::idx, MAX_EMPLOYEES, mxml_GetInt(), mxml_GetNextNode(), mxml_GetNode(), mxml_GetString(), NAT_GetNationByID(), employee_s::nation, ccs_s::numBases, ccs_s::numEmployees, qfalse, qtrue, SAVE_EMPLOYEE_BASEHIRED, SAVE_EMPLOYEE_BUILDING, SAVE_EMPLOYEE_CHR, SAVE_EMPLOYEE_EMPLOYEE, SAVE_EMPLOYEE_EMPLOYEES, SAVE_EMPLOYEE_IDX, SAVE_EMPLOYEE_NATION, SAVE_EMPLOYEE_TYPE, SAVE_EMPLOYEE_UGV, SAVE_EMPLOYEETYPE_NAMESPACE, saveEmployeeConstants, employee_s::type, type, and employee_s::ugv.
Referenced by SAV_Init().
qboolean E_MoveIntoNewBase | ( | employee_t * | employee, | |
base_t * | newBase | |||
) |
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 NULL
pointer Definition at line 205 of file cp_employee.c.
References employee_s::baseHired, CAP_EMPLOYEES, base_s::capacities, cap_maxcur_s::cur, qfalse, and qtrue.
Referenced by AIR_MoveAircraftIntoNewHomebase().
static nation_t* E_RandomNation | ( | void | ) | [inline, static] |
Hack to get a random nation for the initial.
Definition at line 1137 of file cp_employee.c.
References ccs, ccs_s::nations, and ccs_s::numNations.
Referenced by E_InitialEmployees().
void E_RefreshUnhiredEmployeeGlobalList | ( | const employeeType_t | type, | |
const qboolean | excludeUnhappyNations | |||
) |
Recreates all the employees for a particular employee type in the global list. But it does not overwrite any employees already hired.
[in] | type | The type of the employee list to process. |
[in] | excludeUnhappyNations | True if a nation is unhappy then they wont send any pilots, false if happiness of nations in not considered. |
Definition at line 930 of file cp_employee.c.
References ccs, E_CreateEmployeeAtIndex(), E_IsHired, ccs_s::employees, nationInfo_s::happiness, MAX_EMPLOYEES, MAX_NATIONS, ccs_s::nations, ccs_s::numNations, and nation_s::stats.
Referenced by CP_NationHandleBudget().
qboolean E_RemoveEmployeeFromBuildingOrAircraft | ( | employee_t * | employee | ) |
Remove one employee from building.
[in] | employee | What employee to remove from its building. |
Definition at line 972 of file cp_employee.c.
References AIR_IsEmployeeInAircraft(), AIR_RemoveEmployee(), AIR_RemovePilotFromAssignedAircraft(), employee_s::baseHired, employee_s::building, Com_Error(), EMPL_PILOT, EMPL_ROBOT, EMPL_SCIENTIST, EMPL_SOLDIER, EMPL_WORKER, ERR_DROP, MAX_EMPL, PR_UpdateProductionCap(), qfalse, qtrue, RS_RemoveFiredScientist(), and employee_s::type.
Referenced by E_ResetEmployee().
void E_RemoveInventoryFromStorage | ( | employee_t * | employee | ) |
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 1362 of file cp_employee.c.
References B_UpdateStorageAndCapacity(), employee_s::baseHired, employee_s::chr, CONTAINER, csi, INVDEF, invList_s::item, item_s::m, invList_s::next, csi_s::numIDs, qfalse, and item_s::t.
Referenced by AIR_DestroyAircraft().
void E_ResetEmployee | ( | employee_t * | employee | ) |
Removes the inventory of the employee and also removes him from buildings.
Definition at line 555 of file cp_employee.c.
References employee_s::chr, cls, inventoryInterface_s::DestroyInventory, E_IsHired, E_RemoveEmployeeFromBuildingOrAircraft(), character_s::i, and client_static_s::i.
Referenced by E_UnhireEmployee(), and TR_TransferStart().
void E_ResetEmployees | ( | void | ) |
Clears the employees list for loaded and new games.
Definition at line 272 of file cp_employee.c.
References ccs, Com_DPrintf(), DEBUG_CLIENT, EMPL_SOLDIER, ccs_s::employees, i, MAX_EMPL, and ccs_s::numEmployees.
Referenced by CL_ResetSinglePlayerData().
qboolean E_SaveXML | ( | mxml_node_t * | p | ) |
Save callback for savegames in XML Format.
[out] | p | XML Node structure, where we write the information to |
Definition at line 1233 of file cp_employee.c.
References employee_s::baseHired, employee_s::building, employee_s::chr, CL_SaveCharacterXML(), Com_GetConstVariable(), Com_RegisterConstList(), Com_UnregisterConstList(), E_GetNext(), ugv_s::id, nation_s::id, building_s::idx, base_s::idx, employee_s::idx, mxml_AddInt(), mxml_AddNode(), mxml_AddString(), employee_s::nation, qtrue, SAVE_EMPLOYEE_BASEHIRED, SAVE_EMPLOYEE_BUILDING, SAVE_EMPLOYEE_CHR, SAVE_EMPLOYEE_EMPLOYEE, SAVE_EMPLOYEE_EMPLOYEES, SAVE_EMPLOYEE_IDX, SAVE_EMPLOYEE_NATION, SAVE_EMPLOYEE_TYPE, SAVE_EMPLOYEE_UGV, SAVE_EMPLOYEETYPE_NAMESPACE, saveEmployeeConstants, and employee_s::ugv.
Referenced by SAV_Init().
void E_UnhireAllEmployees | ( | base_t * | base, | |
employeeType_t | type | |||
) |
Reset the hired flag for all employees of a given type in a given base.
[in] | base | Which base the employee should be fired from. |
[in] | type | Which employee type do we search. |
Definition at line 614 of file cp_employee.c.
References E_GetNextFromBase(), E_UnhireEmployee(), and MAX_EMPL.
qboolean E_UnhireEmployee | ( | employee_t * | employee | ) |
Fires an employee.
[in] | employee | The employee who will be fired |
Definition at line 577 of file cp_employee.c.
References employee_s::baseHired, CAP_EMPLOYEES, CAP_ITEMS, base_s::capacities, Com_DPrintf(), cap_maxcur_s::cur, DEBUG_CLIENT, E_IsHired, E_ResetEmployee(), EMPL_PILOT, EMPL_ROBOT, EMPL_SCIENTIST, EMPL_SOLDIER, EMPL_WORKER, MAX_EMPL, qfalse, qtrue, employee_s::transfer, employee_s::type, and UGV_SIZE.
Referenced by BS_SellItem_f(), E_DeleteEmployee(), E_EmployeeDelete_f(), E_EmployeeHire_f(), E_UnhireAllEmployees(), and TR_EmptyTransferCargo().