44 if (
cgi->Cmd_Argc() < 1 ) {
45 cgi->Com_Printf(
"Usage: %s <ucn>\n",
cgi->Cmd_Argv(0));
49 const int ucn = atoi(
cgi->Cmd_Argv(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) {
84 cgi->Com_Printf(
"Usage: %s <ucn>\n",
cgi->Cmd_Argv(0));
93 const int ucn = atoi(
cgi->Cmd_Argv(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) {
119 cgi->Com_Printf(
"Usage: %s <ucn>\n",
cgi->Cmd_Argv(0));
128 const int ucn = atoi(
cgi->Cmd_Argv(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);
155static 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 ) {
257 int idx = atoi(
cgi->Cmd_Argv(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));
354 const int ucn = atoi(
cgi->Cmd_Argv(1));
355 const int bodySkinIdx = atoi(
cgi->Cmd_Argv(2));
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}
cgame team management headers.
Share stuff between the different cgame implementations.
Employee * AIR_GetPilot(const aircraft_t *aircraft)
Get pilot of an aircraft.
bool AIR_SetPilot(aircraft_t *aircraft, Employee *pilot)
Assign a pilot to an aircraft.
bool AIR_AddToAircraftTeam(aircraft_t *aircraft, Employee *employee)
Adds given employee to given aircraft.
bool AIR_RemoveEmployee(Employee *employee, aircraft_t *aircraft)
Removes a soldier from an aircraft.
int AIR_GetTeamSize(const aircraft_t *aircraft)
Counts the number of soldiers in given aircraft.
const aircraft_t * AIR_IsEmployeeInAircraft(const Employee *employee, const aircraft_t *aircraft)
Tells you if an employee is assigned to an aircraft.
aircraft_t * AIR_AircraftGetFromIDX(int aircraftIdx)
Returns aircraft for a given global index.
base_t * B_GetCurrentSelectedBase(void)
returns the currently selected base
Header file for single player campaign control.
const cgame_import_t * cgi
Employee * E_GetEmployeeFromChrUCN(int uniqueCharacterNumber)
Searches all employee for the ucn (character id).
employeeType_t E_GetEmployeeType(const char *type)
Convert string to employeeType_t.
employeeType_t
The types of employees.
#define E_Foreach(employeeType, var)
Header for Geoscape management.
#define GEO_GetSelectedAircraft()
bool HOS_NeedsHealing(const character_t &chr)
Header file for hospital related stuff.
rank_t * CL_GetRankByIdx(const int index)
Returns a rank at an index.
void CP_SetEquipContainer(character_t *chr)
Set up equip (floor) container for soldiers.
void CP_CleanupTeam(base_t *base, equipDef_t *ed)
Reloads weapons, removes not assigned and resets defaults.
void CP_UpdateActorAircraftVar(aircraft_t *aircraft, employeeType_t employeeType)
Updates data about teams in aircraft.
void CP_CleanTempInventory(base_t *base)
Clears all containers that are temp containers (see script definition).
Team management for the campaign gametype headers.
static void CP_TEAM_FillEmployeeList_f(void)
Fill the employee list for Soldier/Pilot assignment.
static void CP_TEAM_FillEquipSoldierList_f(void)
Fill the employee list for the in-base soldier equip screen and initialize the inventory.
void CP_TEAM_ShutdownCallbacks(void)
Function that unregisters team (UI) callbacks.
static void CP_TEAM_SelectActorByUCN_f(void)
Selects a soldier by his/her Unique Character Number on team UI.
static void CP_TEAM_FillBDEFEmployeeList_f(void)
Fill the employee list for Base defence mission.
static void CP_TEAM_AssignSoldierByUCN_f(void)
Adds or removes a soldier to/from an aircraft using his/her UCN as reference.
static void CP_TEAM_DeEquipActor_f(void)
Removes every item from a soldier.
static void CP_TEAM_ChangeSkin_f(void)
Change the skin of a soldier.
void CP_TEAM_InitCallbacks(void)
Function that registers team (UI) callbacks.
static const cmdList_t teamCallbacks[]
Menu related callback functions for the team menu.
#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 ...
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
An aircraft with all it's data.
A base with all it's data.
aircraft_t * aircraftCurrent
Describes a character with all its attributes.
Describes a rank that a recruit can gain.