cp_employee_callbacks.c File Reference

Header file for menu callback functions used for hire/employee menu. More...

#include "../cl_shared.h"
#include "../cl_team.h"
#include "../ui/ui_main.h"
#include "../ui/ui_data.h"
#include "../ui/ui_draw.h"
#include "cp_campaign.h"
#include "cp_employee_callbacks.h"
#include "cp_employee.h"
Include dependency graph for cp_employee_callbacks.c:

Go to the source code of this file.

Functions

static void E_UpdateGUICount_f (void)
 Update GUI with the current number of employee per category.
static void E_EmployeeSelect (employee_t *employee)
static void E_EmployeeListScroll_f (void)
 Click function for employee_list node.
static void E_EmployeeList_f (void)
 Will fill the list with employees.
static void E_ChangeName_f (void)
 Change the name of the selected actor.
int E_GenerateHiredEmployeesList (const base_t *base)
 Fill employeeList with a list of employees in the current base (i.e. they are hired and not transferred).
employee_tE_GetEmployeeByMenuIndex (int num)
 Find an hired or free employee by the menu index.
static void E_EmployeeDelete_f (void)
 This removes an employee from the global list so that he/she is no longer hireable.
static void E_EmployeeHire_f (void)
 Callback for employee_hire command.
static void E_EmployeeSelect_f (void)
 Callback function that updates the character cvars when calling employee_select.
void E_InitCallbacks (void)
void E_ShutdownCallbacks (void)

Variables

static employee_tselectedEmployee = NULL
static int employeeCategory = 0
static const int maxEmployeesPerPage = 15
static int employeeScrollPos = 0
linkedList_temployeeList
int employeesInCurrentList

Detailed Description

Header file for menu callback functions used for hire/employee menu.

Definition in file cp_employee_callbacks.c.


Function Documentation

static void E_ChangeName_f ( void   )  [static]

Change the name of the selected actor.

Note:
called via "employee_changename"

Definition at line 219 of file cp_employee_callbacks.c.

References employee_s::chr, Cvar_GetInteger(), Cvar_GetString(), E_GetEmployeeFromChrUCN(), character_s::name, and Q_strncpyz().

Referenced by E_InitCallbacks().

static void E_EmployeeDelete_f ( void   )  [static]

This removes an employee from the global list so that he/she is no longer hireable.

Definition at line 253 of file cp_employee_callbacks.c.

References _, Cbuf_AddText(), Cmd_Argc(), Cmd_Argv(), Com_DPrintf(), Com_Printf(), DEBUG_CLIENT, E_DeleteEmployee(), E_GetEmployeeByMenuIndex(), E_IsHired, E_UnhireEmployee(), employeeCategory, employeeScrollPos, employee_s::type, UI_DisplayNotice(), and va().

Referenced by E_InitCallbacks().

static void E_EmployeeHire_f ( void   )  [static]

Callback for employee_hire command.

Note:
a + as parameter indicates, that more than maxEmployeesPerPage are possible
See also:
CL_AssignSoldier_f

Definition at line 288 of file cp_employee_callbacks.c.

References _, B_GetCurrentSelectedBase(), Cmd_Argc(), Cmd_Argv(), Com_DPrintf(), Com_Printf(), DEBUG_CLIENT, E_EmployeeSelect(), E_GetEmployeeByMenuIndex(), E_HireEmployee(), E_IsHired, E_UnhireEmployee(), E_UpdateGUICount_f(), employeeScrollPos, UI_DisplayNotice(), and UI_ExecuteConfunc().

Referenced by E_InitCallbacks().

static void E_EmployeeList_f ( void   )  [static]

Will fill the list with employees.

Note:
this is the init function in the employee hire menu

Note:
0 == nothing is displayed 1 == all is displayed 2 == only stuff wanted for scientists/workers/pilots are displayed
Todo:
replace magic numbers - use confuncs

Definition at line 142 of file cp_employee_callbacks.c.

References B_GetCurrentSelectedBase(), employee_s::chr, Cmd_Argc(), Cmd_Argv(), Com_Printf(), Cvar_Set(), E_EmployeeSelect(), E_GetEmployeeByMenuIndex(), E_GetNext(), E_IsHired, E_IsInBase(), EMPL_PILOT, EMPL_SCIENTIST, EMPL_SOLDIER, EMPL_WORKER, employeeCategory, employeesInCurrentList, LIST_AddPointer(), LIST_Delete(), MAX_EMPL, character_s::name, TEXT_LIST, UI_ExecuteConfunc(), UI_RegisterLinkedListText(), and UI_ResetData().

Referenced by E_InitCallbacks().

static void E_EmployeeListScroll_f ( void   )  [static]
static void E_EmployeeSelect ( employee_t employee  )  [static]
static void E_EmployeeSelect_f ( void   )  [static]

Callback function that updates the character cvars when calling employee_select.

Definition at line 347 of file cp_employee_callbacks.c.

References Cmd_Argc(), Cmd_Argv(), Com_Printf(), E_EmployeeSelect(), E_GetEmployeeByMenuIndex(), and employeesInCurrentList.

Referenced by E_InitCallbacks().

int E_GenerateHiredEmployeesList ( const base_t base  ) 

Fill employeeList with a list of employees in the current base (i.e. they are hired and not transferred).

Note:
Depends on cls.displayHeavyEquipmentList to be set correctly.
See also:
E_GetEmployeeByMenuIndex - It is used to get a specific entry from the generated employeeList.

Definition at line 231 of file cp_employee_callbacks.c.

References E_GetHiredEmployees(), EMPL_SOLDIER, and employeesInCurrentList.

Referenced by AIR_AssignInitial().

employee_t* E_GetEmployeeByMenuIndex ( int  num  ) 

Find an hired or free employee by the menu index.

Parameters:
[in] num The index from the hire menu screen (index inemployeeList).

Definition at line 243 of file cp_employee_callbacks.c.

References LIST_GetByIdx().

Referenced by AIM_AddEmployeeFromMenu(), CL_ActorPilotSelect_f(), CL_ActorTeamSelect_f(), CL_AssignPilot_f(), E_EmployeeDelete_f(), E_EmployeeHire_f(), E_EmployeeList_f(), and E_EmployeeSelect_f().

void E_InitCallbacks ( void   ) 
void E_ShutdownCallbacks ( void   ) 

Definition at line 377 of file cp_employee_callbacks.c.

References Cmd_RemoveCommand().

Referenced by CP_RemoveCampaignCallbackCommands().

static void E_UpdateGUICount_f ( void   )  [static]

Variable Documentation

int employeeCategory = 0 [static]

Definition at line 45 of file cp_employee_callbacks.c.

int employeeScrollPos = 0 [static]
const int maxEmployeesPerPage = 15 [static]

Definition at line 40 of file cp_employee_callbacks.c.

Referenced by E_EmployeeListScroll_f().

employee_t* selectedEmployee = NULL [static]

Currently selected employee.

Definition at line 36 of file cp_employee_callbacks.c.


Generated by  doxygen 1.6.2