UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Employee Class Reference

#include <cp_employee.h>

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. More...
 
employeeType_t getType () const
 
const struct nation_sgetNation () const
 
const struct ugv_sgetUGV () const
 
int salary () const
 Calculates the employee's actual salary. More...
 
bool isAwayFromBase () const
 Tells you if a employee is away from his home base (gone in mission). More...
 
bool unassign ()
 Removes the employee from buildings and aircraft. More...
 
bool unhire ()
 Fires an employee. More...
 
void unequip ()
 Removes the equipment from an employee. More...
 

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 ( employeeType_t  type,
const struct nation_s nation,
const struct ugv_s ugv 
)
inline

Definition at line 48 of file cp_employee.h.

virtual Employee::~Employee ( )
inlinevirtual

Definition at line 52 of file cp_employee.h.

Member Function Documentation

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

Definition at line 103 of file cp_employee.h.

References _nation.

employeeType_t Employee::getType ( ) const
inline
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().

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().

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.

bool Employee::isHired ( ) const
inline

Definition at line 86 of file cp_employee.h.

References baseHired.

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

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().

bool Employee::isPilot ( ) const
inline

Definition at line 66 of file cp_employee.h.

References EMPL_PILOT.

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

bool Employee::isRobot ( ) const
inline

Definition at line 70 of file cp_employee.h.

References EMPL_ROBOT.

Referenced by isAwayFromBase().

bool Employee::isScientist ( ) const
inline

Definition at line 74 of file cp_employee.h.

References EMPL_SCIENTIST.

bool Employee::isSoldier ( ) const
inline

Definition at line 82 of file cp_employee.h.

References EMPL_SOLDIER.

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

bool Employee::isWorker ( ) const
inline

Definition at line 78 of file cp_employee.h.

References EMPL_WORKER.

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 salary_s::base, ccs, chr, CL_GetRankByIdx(), ccs_s::curCampaign, getType(), rank_s::level, chrScoreGlobal_s::rank, salary_s::rankBonus, campaign_s::salaries, and character_s::score.

void Employee::setAssigned ( bool  assigned)
inline
bool Employee::unassign ( )
void Employee::unequip ( )

Removes the equipment from an employee.

Definition at line 466 of file cp_employee.cpp.

References cgi, chr, and character_s::inv.

Referenced by 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(), and E_EmployeeHire_f().

Field Documentation

bool Employee::_assigned
private

Assigned to a building - currently only used for scientists

Definition at line 43 of file cp_employee.h.

Referenced by isAssigned().

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 getNation().

const employeeType_t Employee::_type
private

employee type

Definition at line 42 of file cp_employee.h.

Referenced by getType(), unassign(), and unhire().

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 getUGV().

base_t* Employee::baseHired
bool Employee::transfer

Is this employee currently transferred?

Definition at line 118 of file cp_employee.h.

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


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