25 #include "../../cl_shared.h"
26 #include "../../cl_team.h"
27 #include "../../cgame/cl_game_team.h"
28 #include "../../ui/ui_dataids.h"
44 if (
cgi->Cmd_Argc() < 1 ) {
61 cgi->Com_Error(
ERR_DROP,
"CP_TEAM_SelectActorByUCN_f: No employee with UCN %i", ucn);
74 cgi->UI_ExecuteConfunc(
"aircraft_status_change");
83 if (
cgi->Cmd_Argc() < 1) {
95 cgi->UI_ExecuteConfunc(
"reset_character_cvars");
101 cgi->Com_Error(
ERR_DROP,
"CP_TEAM_SelectActorByUCN_f: No employee with UCN %i", ucn);
109 cgi->CL_UpdateCharacterValues(chr);
118 if (
cgi->Cmd_Argc() < 1) {
130 cgi->UI_ExecuteConfunc(
"reset_character_cvars");
136 cgi->Com_Error(
ERR_DROP,
"CP_TEAM_DeEquipActor_f: No employee with UCN %i", ucn);
140 cgi->INV_DestroyInventory(&chr->
inv);
145 cgi->UI_ContainerNodeUpdateEquipment(&base->
bEquipment, &unused);
148 cgi->CL_UpdateCharacterValues(chr);
155 static void CP_TeamListDebug_f (
void)
159 cgi->Com_Printf(
"Buy/build an aircraft first.\n");
165 cgi->Com_Printf(
"Build and select a base first\n");
172 cgi->Com_Printf(
"ucn %i - name: %s\n", employee->
chr.
ucn, employee->
chr.
name);
182 if (
cgi->Cmd_Argc() <= 1 ) {
183 cgi->Com_Printf(
"Usage: %s <soldier|pilot> [aircraftIDX]\n",
cgi->
Cmd_Argv(0));
192 cgi->Com_Printf(
"Invalid employeeType: %s\n", typeId);
198 if (
cgi->Cmd_Argc() > 2 ) {
201 cgi->Com_Printf(
"No aircraft exist with global idx %i\n", atoi(
cgi->
Cmd_Argv(2)));
209 cgi->UI_ExecuteConfunc(
"aircraft_soldierlist_clear");
216 if (!employee->isHiredInBase(base))
218 if (employee->transfer)
222 if (assignedCraft ==
nullptr) {
224 if (teamSize >= maxTeamSize)
226 tooltip =
_(
"No more employees can be assigned to this aircraft");
232 if (assignedCraft == aircraft)
237 tooltip =
_(
"Employee is assigned to another aircraft");
241 cgi->UI_ExecuteConfunc(
"aircraft_soldierlist_add %d \"%s\" \"%s\" %d %d \"%s\"", employee->chr.ucn, typeId, employee->chr.name, assignedCraft == aircraft, needsHealing, tooltip);
256 if (
cgi->Cmd_Argc() > 1 ) {
262 cgi->Com_Printf(
"No aircraft exist with global idx %i\n", idx);
274 cgi->UI_ExecuteConfunc(
"equipment_soldierlist_clear");
280 cgi->UI_ExecuteConfunc(
"equipment_soldierlist_add %d \"%s\" %d \"\"", chr->
ucn, chr->
name, needsHealing);
285 if (!employee->isHiredInBase(base))
287 if (employee->transfer)
289 if (employee->isAwayFromBase())
295 cgi->UI_ExecuteConfunc(
"equipment_soldierlist_add %d \"%s\" %d \"%s\"",
296 chr->
ucn, chr->
name, needsHealing, assignedCraft ? assignedCraft->
name :
"");
304 cgi->UI_ContainerNodeUpdateEquipment(&base->
bEquipment, &unused);
306 cgi->UI_PopWindow(
false);
322 cgi->UI_ExecuteConfunc(
"soldierlist_clear");
326 if (!employee->isHiredInBase(base))
328 if (employee->transfer)
333 if (employee->isAwayFromBase())
334 tooltip =
_(
"Employee is away from base");
335 else if (!isInTeam && teamSize >= maxTeamSize)
336 tooltip =
_(
"No more employee can be assigned to this team");
341 cgi->UI_ExecuteConfunc(
"soldierlist_add %d \"%s %s\" %d \"%s\"", employee->chr.ucn, (rank) ?
_(rank->
shortname) :
"", employee->chr.name, isInTeam, tooltip);
350 if (
cgi->Cmd_Argc() < 3 ) {
351 cgi->Com_Printf(
"Usage: %s <ucn> <bodyskinidx>\n",
cgi->
Cmd_Argv(0));
358 if (soldier ==
nullptr || !soldier->isSoldier()) {
359 cgi->Com_Printf(
"Invalid soldier UCN: %i\n", ucn);
363 cgi->Cvar_SetValue(
"mn_body_skin", bodySkinIdx);
372 {
"ui_team_fillequip",
CP_TEAM_FillEquipSoldierList_f,
"Fill the employee list for the in-base soldier equip screen and initialize the inventory"},
376 {
"debug_teamlist", CP_TeamListDebug_f,
"Debug function to show all hired and assigned teammembers"},
378 {
nullptr,
nullptr,
nullptr}
385 cgi->Cmd_TableAddList(teamCallbacks);
393 cgi->Cmd_TableRemoveList(teamCallbacks);
static void CP_TEAM_FillEmployeeList_f(void)
Fill the employee list for Soldier/Pilot assignment.
employeeType_t E_GetEmployeeType(const char *type)
Convert string to employeeType_t.
static void CP_TEAM_AssignSoldierByUCN_f(void)
Adds or removes a soldier to/from an aircraft using his/her UCN as reference.
Describes a rank that a recruit can gain.
#define E_Foreach(employeeType, var)
const aircraft_t * AIR_IsEmployeeInAircraft(const Employee *employee, const aircraft_t *aircraft)
Tells you if an employee is assigned to an aircraft.
static void CP_TEAM_ChangeSkin_f(void)
Change the skin of a soldier.
bool AIR_RemoveEmployee(Employee *employee, aircraft_t *aircraft)
Removes a soldier from an aircraft.
base_t * B_GetCurrentSelectedBase(void)
returns the currently selected base
aircraft_t * AIR_AircraftGetFromIDX(int aircraftIdx)
Returns aircraft for a given global index.
#define GEO_GetSelectedAircraft()
rank_t * CL_GetRankByIdx(const int index)
Returns a rank at an index.
void CP_UpdateActorAircraftVar(aircraft_t *aircraft, employeeType_t employeeType)
Updates data about teams in aircraft.
A base with all it's data.
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
aircraft_t * aircraftCurrent
void CP_TEAM_ShutdownCallbacks(void)
Function that unregisters team (UI) callbacks.
Header file for hospital related stuff.
static const cmdList_t teamCallbacks[]
const cgame_import_t * cgi
employeeType_t
The types of employees.
Menu related callback functions for the team menu.
Employee * AIR_GetPilot(const aircraft_t *aircraft)
Get pilot of an aircraft.
Header for Geoscape management.
void CP_TEAM_InitCallbacks(void)
Function that registers team (UI) callbacks.
void CP_CleanupTeam(base_t *base, equipDef_t *ed)
Reloads weapons, removes not assigned and resets defaults.
int AIR_GetTeamSize(const aircraft_t *aircraft)
Counts the number of soldiers in given aircraft.
bool HOS_NeedsHealing(const character_t &chr)
Employee * E_GetEmployeeFromChrUCN(int uniqueCharacterNumber)
Searches all employee for the ucn (character id)
static void CP_TEAM_SelectActorByUCN_f(void)
Selects a soldier by his/her Unique Character Number on team UI.
#define LIST_Foreach(list, type, var)
Iterates over a linked list, it's safe to delete the returned entry from the list while looping over ...
Header file for single player campaign control.
static void CP_TEAM_FillBDEFEmployeeList_f(void)
Fill the employee list for Base defence mission.
bool AIR_SetPilot(aircraft_t *aircraft, Employee *pilot)
Assign a pilot to an aircraft.
void CP_CleanTempInventory(base_t *base)
Clears all containers that are temp containers (see script definition).
static void CP_TEAM_FillEquipSoldierList_f(void)
Fill the employee list for the in-base soldier equip screen and initialize the inventory.
An aircraft with all it's data.
Team management for the campaign gametype headers.
bool AIR_AddToAircraftTeam(aircraft_t *aircraft, Employee *employee)
Adds given employee to given aircraft.
static void CP_TEAM_DeEquipActor_f(void)
Removes every item from a soldier.
const char *IMPORT * Cmd_Argv(int n)
void CP_SetEquipContainer(character_t *chr)
Set up equip (floor) container for soldiers.
Describes a character with all its attributes.