UFO: Alien Invasion
Loading...
Searching...
No Matches
Employee Class Reference

#include <cp_employee.h>

Collaboration diagram for Employee:
Collaboration graph

Public Member Functions

 Employee (employeeType_t type, const struct nation_s *nation, const struct ugv_s *ugv)
virtual ~Employee ()
bool isAssigned () const
void setAssigned (bool assigned)
bool isPilot () const
bool isRobot () const
bool isScientist () const
bool isWorker () const
bool isSoldier () const
bool isHired () const
bool isHiredInBase (const base_t *const base) const
 Checks whether the given employee is in the given base.
employeeType_t getType () const
const struct nation_s * getNation () const
const struct ugv_s * getUGV () const
int salary () const
 Calculates the employee's actual salary.
bool isAwayFromBase () const
 Tells you if a employee is away from his home base (gone in mission).
bool unassign ()
 Removes the employee from buildings and aircraft.
bool unhire ()
 Fires an employee.
void unequip ()
 Removes the equipment from an employee.

Data Fields

base_tbaseHired
bool transfer
character_t chr

Private Attributes

const employeeType_t _type
bool _assigned
const struct nation_s * _nation
const struct ugv_s * _ugv

Detailed Description

The definition of an employee

Definition at line 40 of file cp_employee.h.

Constructor & Destructor Documentation

◆ Employee()

Employee::Employee ( employeeType_t type,
const struct nation_s * nation,
const struct ugv_s * ugv )
inline

Definition at line 48 of file cp_employee.h.

References _assigned, _nation, _type, _ugv, baseHired, nullptr, transfer, and type.

◆ ~Employee()

virtual Employee::~Employee ( )
inlinevirtual

Definition at line 52 of file cp_employee.h.

Member Function Documentation

◆ getNation()

const struct nation_s * Employee::getNation ( ) const
inline

Definition at line 103 of file cp_employee.h.

References _nation.

◆ getType()

employeeType_t Employee::getType ( ) const
inline

◆ getUGV()

const struct ugv_s * Employee::getUGV ( ) const
inline

Definition at line 107 of file cp_employee.h.

References _ugv.

Referenced by BS_SellUGV(), and BS_ShowInfo_f().

◆ isAssigned()

bool Employee::isAssigned ( ) const
inline
Returns
true if the employee is not yet assigned to a building

Definition at line 58 of file cp_employee.h.

References _assigned.

Referenced by RS_Max_f(), and unassign().

◆ isAwayFromBase()

bool Employee::isAwayFromBase ( ) const

Tells you if a employee is away from his home base (gone in mission).

Returns
bool true if the employee is away in mission, false if he is not or he is unhired.

Definition at line 75 of file cp_employee.cpp.

References AIR_Foreach, AIR_IsAircraftInBase(), AIR_IsEmployeeInAircraft(), baseHired, isHired(), isPilot(), isRobot(), isSoldier(), and transfer.

◆ isHired()

bool Employee::isHired ( ) const
inline

Definition at line 86 of file cp_employee.h.

References baseHired.

Referenced by E_EmployeeDelete_f(), E_EmployeeHire_f(), isAwayFromBase(), and unhire().

◆ isHiredInBase()

bool Employee::isHiredInBase ( const base_t *const base) const
inline

Checks whether the given employee is in the given base.

Parameters
[in]baseThe base the employee must be hired in for this function to return true.

Definition at line 94 of file cp_employee.h.

References baseHired.

Referenced by TR_Add_f().

◆ isPilot()

bool Employee::isPilot ( ) const
inline

Definition at line 66 of file cp_employee.h.

References _type, and EMPL_PILOT.

Referenced by AIR_IsEmployeeInAircraft(), CP_TEAM_AssignSoldierByUCN_f(), and isAwayFromBase().

◆ isRobot()

bool Employee::isRobot ( ) const
inline

Definition at line 70 of file cp_employee.h.

References _type, and EMPL_ROBOT.

Referenced by isAwayFromBase().

◆ isScientist()

bool Employee::isScientist ( ) const
inline

Definition at line 74 of file cp_employee.h.

References _type, and EMPL_SCIENTIST.

◆ isSoldier()

bool Employee::isSoldier ( ) const
inline

Definition at line 82 of file cp_employee.h.

References _type, and EMPL_SOLDIER.

Referenced by CP_TEAM_ChangeSkin_f(), HOS_Entry(), HOS_GetRank(), and isAwayFromBase().

◆ isWorker()

bool Employee::isWorker ( ) const
inline

Definition at line 78 of file cp_employee.h.

References _type, and EMPL_WORKER.

◆ salary()

int Employee::salary ( ) const

Calculates the employee's actual salary.

Returns
Monthly salary of the employee

Definition at line 63 of file cp_employee.cpp.

References ccs, chr, CL_GetRankByIdx(), getType(), rank_t::level, campaign_t::salaries, and salary().

Referenced by salary().

◆ setAssigned()

void Employee::setAssigned ( bool assigned)
inline

Definition at line 62 of file cp_employee.h.

References _assigned.

Referenced by E_LoadXML(), RS_AssignScientist(), RS_RemoveFiredScientist(), and RS_RemoveScientist().

◆ unassign()

bool Employee::unassign ( )

◆ unequip()

void Employee::unequip ( )

Removes the equipment from an employee.

Definition at line 466 of file cp_employee.cpp.

References cgi, and chr.

Referenced by unhire().

◆ unhire()

bool Employee::unhire ( )

Fires an employee.

Note
also unassigns him from the aircraft and buildings
See also
E_HireEmployee
E_HireEmployeeByType
CL_RemoveSoldierFromAircraft
Todo
handle EMPL_ROBOT capacities here?

Definition at line 480 of file cp_employee.cpp.

References _type, baseHired, CAP_AddCurrent(), CAP_EMPLOYEES, CAP_ITEMS, cgi, DEBUG_CLIENT, EMPL_PILOT, EMPL_ROBOT, EMPL_SCIENTIST, EMPL_SOLDIER, EMPL_WORKER, isHired(), MAX_EMPL, PR_UpdateProductionCap(), transfer, UGV_SIZE, unassign(), and unequip().

Referenced by BS_SellUGV(), E_DeleteEmployee(), E_EmployeeDelete_f(), and E_EmployeeHire_f().

Field Documentation

◆ _assigned

bool Employee::_assigned
private

Assigned to a building - currently only used for scientists

Definition at line 43 of file cp_employee.h.

Referenced by Employee(), isAssigned(), and setAssigned().

◆ _nation

const struct nation_s* Employee::_nation
private

What nation this employee came from. This is nullptr if the nation is unknown for some (code-related) reason.

Definition at line 44 of file cp_employee.h.

Referenced by Employee(), and getNation().

◆ _type

const employeeType_t Employee::_type
private

employee type

Definition at line 42 of file cp_employee.h.

Referenced by Employee(), getType(), isPilot(), isRobot(), isScientist(), isSoldier(), isWorker(), unassign(), and unhire().

◆ _ugv

const struct ugv_s* Employee::_ugv
private

if this is an employee of type EMPL_ROBOT then this is a pointer to the matching ugv_t struct. For normal employees this is nullptr.

Definition at line 45 of file cp_employee.h.

Referenced by Employee(), and getUGV().

◆ baseHired

base_t* Employee::baseHired

◆ chr

◆ transfer

bool Employee::transfer

Is this employee currently transferred?

Definition at line 118 of file cp_employee.h.

Referenced by AIR_IsEmployeeInAircraft(), E_DeleteEmployee(), Employee(), isAwayFromBase(), TR_LoadXML(), and unhire().


The documentation for this class was generated from the following files: