UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cp_team.h File Reference

Team management for the campaign gametype headers. More...

Go to the source code of this file.

Functions

void CP_CleanTempInventory (base_t *base)
 Clears all containers that are temp containers (see script definition). More...
 
void CP_UpdateActorAircraftVar (aircraft_t *aircraft, employeeType_t employeeType)
 Updates data about teams in aircraft. More...
 
void CP_CleanupAircraftTeam (aircraft_t *aircraft, equipDef_t *ed)
 Reloads weapons, removes not assigned and resets defaults. More...
 
void CP_CleanupTeam (base_t *base, equipDef_t *ed)
 Reloads weapons, removes not assigned and resets defaults. More...
 
void CP_SetEquipContainer (character_t *chr)
 Set up equip (floor) container for soldiers. More...
 
void CP_AddWeaponAmmo (equipDef_t *ed, Item *item)
 Updates status of weapon (sets pointers, reloads, etc). More...
 

Detailed Description

Team management for the campaign gametype headers.

Definition in file cp_team.h.

Function Documentation

void CP_AddWeaponAmmo ( equipDef_t ed,
Item item 
)

Updates status of weapon (sets pointers, reloads, etc).

Parameters
[in]edPointer to equipment definition.
[in]itemAn item to update.
Returns
Updated item in any case, even if there was no update.
See also
CP_CleanupAircraftCrew
Todo:
We may want to change this to use the type->ammo[] info.
Todo:
on return from a mission with no clips left and one weapon half-loaded wielded by soldier and one empty in equip, on the first opening of equip, the empty weapon will be in soldier hands, the half-full in equip; this should be the other way around.
Todo:
We may want to change this to use the type->ammo[] info.

Definition at line 38 of file cp_team.cpp.

References objDef_s::ammo, Item::ammoDef(), cgi, cgame_import_s::csi, DEBUG_CLIENT, Item::def(), Item::getAmmoLeft(), i, objDef_s::id, objDef_s::idx, INVSH_GetItemByIDX(), objDef_s::isAmmo(), objDef_s::isArmour(), objDef_s::isLoadableInWeapon(), NONE_AMMO, equipDef_s::numItems, equipDef_s::numItemsLoose, csi_s::numODs, Item::setAmmoDef(), Item::setAmmoLeft(), type, and objDef_s::weapons.

Referenced by CP_CleanupContainerWeapons().

void CP_CleanTempInventory ( base_t base)

Clears all containers that are temp containers (see script definition).

See also
GAME_SaveTeamInfo
GAME_SendCurrentTeamSpawningInfo

Definition at line 273 of file cp_team.cpp.

References base_s::bEquipment, cgi, E_Foreach, EMPL_ROBOT, and EMPL_SOLDIER.

Referenced by CP_StartSelectedMission(), CP_TEAM_DeEquipActor_f(), CP_TEAM_FillEquipSoldierList_f(), and GAME_CP_Spawn().

void CP_CleanupAircraftTeam ( aircraft_t aircraft,
equipDef_t ed 
)

Reloads weapons, removes not assigned and resets defaults.

Parameters
[in]aircraftPointer to an aircraft for given team.
[in]edequipDef_t pointer to equipment
See also
CL_AddWeaponAmmo
Note
Iterate through in container order (right hand, left hand, belt, holster, backpack) at the top level, i.e. each squad member reloads the right hand, then each reloads the left hand, etc. The effect of this is that when things are tight, everyone has the opportunity to get their preferred weapon(s) loaded before anyone is allowed to keep her spares in the backpack or on the floor. We don't want the first person in the squad filling their backpack with spare ammo leaving others with unloaded guns in their hands...

Definition at line 240 of file cp_team.cpp.

References aircraft_s::acTeam, cgi, CID_MAX, CP_CleanupContainerWeapons(), Item::def(), Inventory::getRightHandContainer(), character_s::inv, INVDEF, INVSH_GetItemByID(), and LIST_Foreach.

Referenced by CP_StartSelectedMission().

void CP_CleanupTeam ( base_t base,
equipDef_t ed 
)

Reloads weapons, removes not assigned and resets defaults.

Parameters
[in]basePointer to a base for given team.
[in]edequipDef_t pointer to equipment
See also
CL_AddWeaponAmmo
Note
Iterate through in container order (right hand, left hand, belt, holster, backpack) at the top level, i.e. each squad member reloads the right hand, then each reloads the left hand, etc. The effect of this is that when things are tight, everyone has the opportunity to get their preferred weapon(s) loaded before anyone is allowed to keep her spares in the backpack or on the floor. We don't want the first person in the squad filling their backpack with spare ammo leaving others with unloaded guns in their hands...

Definition at line 185 of file cp_team.cpp.

References cgi, CID_MAX, CP_CleanupContainerWeapons(), Item::def(), E_Foreach, EMPL_ROBOT, EMPL_SOLDIER, Inventory::getRightHandContainer(), character_s::inv, INVDEF, and INVSH_GetItemByID().

Referenced by CP_TEAM_DeEquipActor_f(), and CP_TEAM_FillEquipSoldierList_f().

void CP_SetEquipContainer ( character_t chr)

Set up equip (floor) container for soldiers.

Parameters
[in,out]chrPointer to soldiers character structure

Definition at line 137 of file cp_team.cpp.

References cgi, CID_EQUIP, Inventory::getContainer2(), character_s::inv, Inventory::resetContainer(), Inventory::setContainer(), and cgame_import_s::ui_inventory.

Referenced by CP_TEAM_FillEquipSoldierList_f(), CP_TEAM_SelectActorByUCN_f(), and HOS_Init_f().

void CP_UpdateActorAircraftVar ( aircraft_t aircraft,
employeeType_t  employeeType 
)

Updates data about teams in aircraft.

Parameters
[in]aircraftPointer to an aircraft for a desired team.
[in]employeeTypeType of employee for which data is being updated.
Returns
the number of employees that are in the aircraft and were added to the character list

Definition at line 296 of file cp_team.cpp.

References _, AIR_GetPilot(), AIR_GetTeamSize(), character_s::bodySkin, cgi, Employee::chr, CHRSH_CharGetBody(), CHRSH_CharGetHead(), cgame_import_s::Cvar_Set(), character_s::headSkin, aircraft_s::maxTeamSize, and character_s::name.

Referenced by AIR_AircraftSelect(), and CP_TEAM_AssignSoldierByUCN_f().