contains everything related to equiping slots of aircraft or base More...
#include "../cl_shared.h"
#include "../ui/ui_main.h"
#include "cp_campaign.h"
#include "cp_mapfightequip.h"
#include "cp_ufo.h"
#include "cp_map.h"
#include "save/save_fightequip.h"
Go to the source code of this file.
Defines | |
#define | UFO_RELOAD_DELAY_MULTIPLIER 2 |
#define | AIRCRAFT_RELOAD_DELAY_MULTIPLIER 2 |
#define | BASE_RELOAD_DELAY_MULTIPLIER 2 |
#define | INSTALLATION_RELOAD_DELAY_MULTIPLIER 2 |
Functions | |
technology_t ** | AII_GetCraftitemTechsByType (int type) |
Returns a list of craftitem technologies for the given type. | |
itemWeight_t | AII_GetItemWeightBySize (const objDef_t *od) |
Returns craftitem weight based on size. | |
qboolean | AIM_SelectableCraftItem (const aircraftSlot_t *slot, const technology_t *tech) |
Check if an aircraft item should or should not be displayed in airequip menu. | |
qboolean | AIM_PilotAssignedAircraft (const base_t *base, const employee_t *pilot) |
Checks to see if the pilot is in any aircraft at this base. | |
void | BDEF_AddBattery (basedefenceType_t basedefType, base_t *base) |
Adds a defence system to base. | |
void | BDEF_RemoveBattery (base_t *base, basedefenceType_t basedefType, int idx) |
Remove a base defence sytem from base. | |
void | BDEF_InitialiseBaseSlots (base_t *base) |
Initialise all values of base slot defence. | |
void | BDEF_InitialiseInstallationSlots (installation_t *installation) |
Initialise all values of installation slot defence. | |
static void | AII_UpdateOneInstallationDelay (base_t *base, installation_t *installation, aircraft_t *aircraft, aircraftSlot_t *slot) |
Update the installation delay of one slot. | |
void | AII_UpdateInstallationDelay (void) |
Update the installation delay of all slots of a given aircraft. | |
void | AII_AutoAddAmmo (aircraftSlot_t *slot) |
Auto add ammo corresponding to weapon, if there is enough in storage. | |
void | AII_RemoveItemFromSlot (base_t *base, aircraftSlot_t *slot, qboolean ammo) |
Remove the item from the slot (or optionally its ammo only) and put it the base storage. | |
void | AII_RemoveNextItemFromSlot (base_t *base, aircraftSlot_t *slot, qboolean ammo) |
Cancel replacing item, move nextItem (or optionally its ammo only) back to the base storage. | |
qboolean | AII_ReloadWeapon (aircraftSlot_t *slot) |
Reloads an aircraft/defence-system weapon. | |
void | AII_ReloadAircraftWeapons (aircraft_t *aircraft) |
Reload the weapons of an aircraft. | |
void | BDEF_ReloadBaseWeapons (base_t *base, installation_t *installation) |
Reload the weapons of a base or intallation. | |
qboolean | AII_AddAmmoToSlot (base_t *base, const technology_t *tech, aircraftSlot_t *slot) |
Add an ammo to an aircraft weapon slot. | |
qboolean | AII_AddItemToSlot (base_t *base, const technology_t *tech, aircraftSlot_t *slot, qboolean nextItem) |
Add an item to an aircraft slot. | |
void | AIM_AutoEquipAircraft (aircraft_t *aircraft) |
Auto Add weapon and ammo to an aircraft. | |
void | AII_InitialiseSlot (aircraftSlot_t *slot, aircraft_t *aircraftTemplate, base_t *base, installation_t *installation, aircraftItemType_t type) |
Initialise values of one slot of an aircraft or basedefence common to all types of items. | |
static qboolean | AII_CheckUpdateAircraftStats (const aircraftSlot_t *slot, int stat) |
Check if item in given slot should change one aircraft stat. | |
aircraftSlot_t * | BDEF_GetBaseSlotByIDX (base_t *base, aircraftItemType_t type, int idx) |
returns the aircraftSlot of a base at an index or the first free slot | |
aircraftSlot_t * | BDEF_GetInstallationSlotByIDX (installation_t *installation, aircraftItemType_t type, int idx) |
returns the aircraftSlot of an installaion at an index or the first free slot | |
aircraftSlot_t * | AII_GetAircraftSlotByIDX (aircraft_t *aircraft, aircraftItemType_t type, int idx) |
returns the aircraftSlot of an aircraft at an index or the first free slot | |
float | AIR_GetMaxAircraftWeaponRange (const aircraftSlot_t *slot, int maxSlot) |
Get the maximum weapon range of aircraft. | |
void | AII_RepairAircraft (void) |
Repair aircraft. | |
void | AII_UpdateAircraftStats (aircraft_t *aircraft) |
Update the value of stats array of an aircraft. | |
static qboolean | AII_WeaponsCanShoot (const baseWeapon_t *weapons, int numWeapons) |
Check if base or installation weapon can shoot. | |
int | AII_BaseCanShoot (const base_t *base) |
Check if the base has weapon and ammo. | |
qboolean | AII_InstallationCanShoot (const installation_t *installation) |
Check if the installation has a weapon and ammo. | |
static void | BDEF_AutoTarget (baseWeapon_t *weapons, int maxWeapons) |
Chooses a target for surface to air defences automatically. | |
void | BDEF_AutoSelectTarget (void) |
Chooses target for all base defences and sam sites. | |
const char * | AII_WeightToName (itemWeight_t weight) |
Translate a weight int to a translated string. | |
void | AII_SaveOneSlotXML (mxml_node_t *p, const aircraftSlot_t *slot, qboolean weapon) |
Save callback for savegames in XML Format. | |
void | AII_LoadOneSlotXML (mxml_node_t *node, aircraftSlot_t *slot, qboolean weapon) |
Loads one slot (base, installation or aircraft). |
contains everything related to equiping slots of aircraft or base
Definition in file cp_mapfightequip.c.
#define AIRCRAFT_RELOAD_DELAY_MULTIPLIER 2 |
Definition at line 37 of file cp_mapfightequip.c.
Referenced by AII_ReloadWeapon().
#define BASE_RELOAD_DELAY_MULTIPLIER 2 |
Definition at line 38 of file cp_mapfightequip.c.
Referenced by AII_ReloadWeapon().
#define INSTALLATION_RELOAD_DELAY_MULTIPLIER 2 |
Definition at line 39 of file cp_mapfightequip.c.
Referenced by AII_ReloadWeapon().
#define UFO_RELOAD_DELAY_MULTIPLIER 2 |
Definition at line 36 of file cp_mapfightequip.c.
Referenced by AII_ReloadWeapon().
qboolean AII_AddAmmoToSlot | ( | base_t * | base, | |
const technology_t * | tech, | |||
aircraftSlot_t * | slot | |||
) |
Add an ammo to an aircraft weapon slot.
[in] | base | Pointer to the base which provides items (NULL if items shouldn't be removed of storage) |
[in] | tech | Pointer to the tech to add to slot |
[in] | slot | Pointer to the slot where you want to add ammos |
Definition at line 701 of file cp_mapfightequip.c.
References AC_ITEM_AMMO, AII_ReloadWeapon(), AII_RemoveItemFromSlot(), AII_RemoveNextItemFromSlot(), aircraftSlot_s::ammo, objDef_s::ammos, B_BaseHasItem(), B_UpdateStorageAndCapacity(), Com_Printf(), objDef_s::craftitem, objDef_s::id, objDef_s::idx, INVSH_GetItemByID(), aircraftSlot_s::item, aircraftSlot_s::nextAmmo, aircraftSlot_s::nextItem, objDef_s::numAmmos, technology_s::provides, qfalse, qtrue, and craftitem_s::type.
Referenced by AII_AutoAddAmmo(), AII_LoadOneSlotXML(), and AIM_AircraftEquipAddItem_f().
qboolean AII_AddItemToSlot | ( | base_t * | base, | |
const technology_t * | tech, | |||
aircraftSlot_t * | slot, | |||
qboolean | nextItem | |||
) |
Add an item to an aircraft slot.
[in] | base | Pointer to the base where item will be removed (NULL for ufos, virtual ammos or while loading game) |
[in] | tech | Pointer to the tech that will be added in this slot. |
[in] | slot | Pointer to the aircraft, base, or installation slot. |
[in] | nextItem | False if we are changing current item in slot, true if this is the item to install after current removal is over. |
Definition at line 779 of file cp_mapfightequip.c.
References AC_ITEM_AMMO, AII_GetItemWeightBySize(), B_BaseHasItem(), B_UpdateStorageAndCapacity(), Com_Printf(), objDef_s::craftitem, objDef_s::id, aircraftSlot_s::idx, craftitem_s::installationTime, aircraftSlot_s::installationTime, INVSH_GetItemByID(), aircraftSlot_s::item, aircraftSlot_s::nextItem, technology_s::provides, qfalse, qtrue, objDef_s::size, aircraftSlot_s::size, aircraftSlot_s::type, and craftitem_s::type.
Referenced by AII_LoadOneSlotXML(), AIM_AircraftEquipAddItem_f(), AIM_AutoEquipAircraft(), and BDEF_AddItem_f().
void AII_AutoAddAmmo | ( | aircraftSlot_t * | slot | ) |
Auto add ammo corresponding to weapon, if there is enough in storage.
[in] | slot | Pointer to the slot where you want to add ammo |
Definition at line 460 of file cp_mapfightequip.c.
References AC_ITEM_WEAPON, AII_AddAmmoToSlot(), AIM_SelectableCraftItem(), aircraftSlot_s::aircraft, aircraftSlot_s::ammo, objDef_s::ammos, aircraftSlot_s::base, objDef_s::craftitem, aircraft_s::homebase, objDef_s::isVirtual, aircraftSlot_s::item, aircraftSlot_s::nextAmmo, aircraftSlot_s::nextItem, objDef_s::numAmmos, RS_GetTechForItem(), and craftitem_s::type.
Referenced by AII_ReloadWeapon(), AIM_AircraftEquipAddItem_f(), AIM_AutoEquipAircraft(), and BDEF_AddItem_f().
int AII_BaseCanShoot | ( | const base_t * | base | ) |
Check if the base has weapon and ammo.
[in] | base | Pointer to the base you want to check (may not be NULL) |
Definition at line 1204 of file cp_mapfightequip.c.
References AII_WeaponsCanShoot(), B_DEFENCE_LASER, B_DEFENCE_MISSILE, B_GetBuildingStatus(), base_s::batteries, base_s::lasers, base_s::numBatteries, base_s::numLasers, qfalse, and qtrue.
Referenced by AIRFIGHT_CampaignRunBaseDefence(), CL_DisplayPopupInterceptUFO(), CL_PopupInterceptBaseClick_f(), and MAP_DrawMapOneBase().
static qboolean AII_CheckUpdateAircraftStats | ( | const aircraftSlot_t * | slot, | |
int | stat | |||
) | [static] |
Check if item in given slot should change one aircraft stat.
[in] | slot | Pointer to the slot containing the item |
[in] | stat | the stat that should be checked |
Definition at line 932 of file cp_mapfightequip.c.
References objDef_s::craftitem, aircraftSlot_s::installationTime, aircraftSlot_s::item, qfalse, qtrue, and craftitem_s::stats.
Referenced by AII_UpdateAircraftStats(), and AIR_GetMaxAircraftWeaponRange().
aircraftSlot_t* AII_GetAircraftSlotByIDX | ( | aircraft_t * | aircraft, | |
aircraftItemType_t | type, | |||
int | idx | |||
) |
returns the aircraftSlot of an aircraft at an index or the first free slot
[in] | aircraft | Pointer to aircraft |
[in] | type | base defence type, see aircraftItemType_t |
[in] | idx | index of aircraftslot |
Definition at line 1016 of file cp_mapfightequip.c.
References AC_ITEM_ELECTRONICS, AC_ITEM_SHIELD, AC_ITEM_WEAPON, aircraft_s::electronics, i, aircraftSlot_s::item, aircraft_s::maxElectronics, aircraft_s::maxWeapons, aircraftSlot_s::nextItem, aircraft_s::shield, and aircraft_s::weapons.
technology_t** AII_GetCraftitemTechsByType | ( | int | type | ) |
Returns a list of craftitem technologies for the given type.
[in] | type | Type of the craft-items to return. |
Definition at line 46 of file cp_mapfightequip.c.
References Com_Printf(), objDef_s::craftitem, csi, i, INVSH_GetItemByIDX(), MAX_TECHNOLOGIES, csi_s::numODs, RS_GetTechForItem(), and craftitem_s::type.
Referenced by AIM_UpdateAircraftItemList(), BDEF_AddItem_f(), BDEF_SelectItem_f(), and BDEF_UpdateAircraftItemList().
itemWeight_t AII_GetItemWeightBySize | ( | const objDef_t * | od | ) |
Returns craftitem weight based on size.
[in] | od | Pointer to objDef_t object being craftitem. |
Definition at line 76 of file cp_mapfightequip.c.
References objDef_s::craftitem, ITEM_HEAVY, ITEM_LIGHT, ITEM_MEDIUM, objDef_s::size, and craftitem_s::type.
Referenced by AII_AddItemToSlot(), AIM_AutoEquipAircraft(), AIM_CheckTechnologyIntoSlot(), AIM_SelectableCraftItem(), AIR_ScriptSanityCheck(), and UP_AircraftItemDescription().
void AII_InitialiseSlot | ( | aircraftSlot_t * | slot, | |
aircraft_t * | aircraftTemplate, | |||
base_t * | base, | |||
installation_t * | installation, | |||
aircraftItemType_t | type | |||
) |
Initialise values of one slot of an aircraft or basedefence common to all types of items.
[in] | slot | Pointer to the slot to initialize. |
[in] | aircraftTemplate | Template Pointer to aircraft template. |
[in] | base | Pointer to base. |
[in] | installation | Pointer to the thing being installed. |
[in] | type |
sa BDEF_AddBattery: it needs to be AMMO_STATUS_NOT_SET and not 0
Definition at line 904 of file cp_mapfightequip.c.
References aircraftSlot_s::aircraft, aircraftSlot_s::ammo, AMMO_STATUS_NOT_SET, aircraftSlot_s::ammoLeft, aircraftSlot_s::base, aircraftSlot_s::installation, aircraftSlot_s::installationTime, aircraftSlot_s::item, ITEM_HEAVY, aircraftSlot_s::nextAmmo, aircraftSlot_s::nextItem, aircraftSlot_s::size, and aircraftSlot_s::type.
Referenced by AII_InitialiseAircraftSlots(), BDEF_InitialiseBaseSlots(), BDEF_InitialiseInstallationSlots(), and BDEF_RemoveBattery().
qboolean AII_InstallationCanShoot | ( | const installation_t * | installation | ) |
Check if the installation has a weapon and ammo.
[in] | installation | Pointer to the installation you want to check (may not be NULL) |
Definition at line 1227 of file cp_mapfightequip.c.
References AII_WeaponsCanShoot(), installation_s::batteries, installation_s::founded, INSTALLATION_WORKING, installation_s::installationStatus, installation_s::installationTemplate, installationTemplate_s::maxBatteries, and qfalse.
Referenced by AIRFIGHT_CampaignRunBaseDefence(), CL_DisplayPopupInterceptUFO(), CL_PopupInterceptBaseClick_f(), and MAP_DrawMapOneInstallation().
void AII_LoadOneSlotXML | ( | mxml_node_t * | node, | |
aircraftSlot_t * | slot, | |||
qboolean | weapon | |||
) |
Loads one slot (base, installation or aircraft).
[in] | node | XML Node structure, where we get the information from |
[out] | slot | Pointer to the slot where item should be added. |
[in] | weapon | True if the slot is a weapon slot. |
Definition at line 1401 of file cp_mapfightequip.c.
References AII_AddAmmoToSlot(), AII_AddItemToSlot(), aircraftSlot_s::ammoLeft, aircraftSlot_s::delayNextShot, aircraftSlot_s::installationTime, mxml_GetInt(), mxml_GetString(), name, qfalse, qtrue, RS_GetTechByProvided(), SAVE_SLOT_AMMOID, SAVE_SLOT_AMMOLEFT, SAVE_SLOT_DELAYNEXTSHOT, SAVE_SLOT_INSTALLATIONTIME, SAVE_SLOT_ITEMID, SAVE_SLOT_NEXTAMMOID, and SAVE_SLOT_NEXTITEMID.
Referenced by AIR_LoadAircraftSlotsXML(), and B_LoadBaseSlotsXML().
void AII_ReloadAircraftWeapons | ( | aircraft_t * | aircraft | ) |
Reload the weapons of an aircraft.
[in,out] | aircraft | Pointer to the aircraft to reload |
Definition at line 653 of file cp_mapfightequip.c.
References AII_ReloadWeapon(), i, aircraft_s::maxWeapons, and aircraft_s::weapons.
Referenced by AIM_AircraftStart_f(), AIR_SendAircraftPursuingUFO(), AIR_SendAircraftToMission(), B_AircraftReturnedToHomeBase(), and UFO_AddToGeoscape().
qboolean AII_ReloadWeapon | ( | aircraftSlot_t * | slot | ) |
Reloads an aircraft/defence-system weapon.
[in,out] | slot | Pointer to the aircraftSlot where weapon is attached to |
Definition at line 594 of file cp_mapfightequip.c.
References AII_AutoAddAmmo(), AIR_IsAircraftInBase(), AIR_IsUFO, aircraftSlot_s::aircraft, AIRCRAFT_RELOAD_DELAY_MULTIPLIER, objDef_s::ammo, aircraftSlot_s::ammo, aircraftSlot_s::ammoLeft, B_BaseHasItem(), B_UpdateStorageAndCapacity(), aircraftSlot_s::base, BASE_RELOAD_DELAY_MULTIPLIER, Com_Error(), objDef_s::craftitem, aircraftSlot_s::delayNextShot, ERR_DROP, aircraft_s::homebase, aircraftSlot_s::installation, INSTALLATION_RELOAD_DELAY_MULTIPLIER, aircraftSlot_s::item, qfalse, qtrue, UFO_RELOAD_DELAY_MULTIPLIER, and craftitem_s::weaponDelay.
Referenced by AII_AddAmmoToSlot(), AII_ReloadAircraftWeapons(), AIRFIGHT_AddProjectile(), AIRFIGHT_CampaignRunBaseDefence(), BDEF_ReloadBaseWeapons(), and CL_CampaignRunAircraft().
void AII_RemoveItemFromSlot | ( | base_t * | base, | |
aircraftSlot_t * | slot, | |||
qboolean | ammo | |||
) |
Remove the item from the slot (or optionally its ammo only) and put it the base storage.
[in] | base | The base to add the item to (may be NULL if item shouldn't be removed from any base). |
[in] | slot | The slot to remove the item from. |
[in] | ammo | qtrue if we want to remove only ammo. qfalse if the whole item should be removed. |
Definition at line 509 of file cp_mapfightequip.c.
References AII_RemoveItemFromSlot(), objDef_s::ammo, aircraftSlot_s::ammo, aircraftSlot_s::ammoLeft, B_UpdateStorageAndCapacity(), objDef_s::craftitem, craftitem_s::installationTime, aircraftSlot_s::installationTime, objDef_s::isVirtual, aircraftSlot_s::item, aircraftSlot_s::nextAmmo, aircraftSlot_s::nextItem, qfalse, and qtrue.
Referenced by AII_AddAmmoToSlot(), AII_RemoveItemFromSlot(), AII_UpdateOneInstallationDelay(), AIM_AircraftEquipAddItem_f(), AIM_AircraftEquipRemoveItem_f(), AIR_DeleteAircraft(), BDEF_AddItem_f(), and BDEF_RemoveItem_f().
void AII_RemoveNextItemFromSlot | ( | base_t * | base, | |
aircraftSlot_t * | slot, | |||
qboolean | ammo | |||
) |
Cancel replacing item, move nextItem (or optionally its ammo only) back to the base storage.
[in] | base | The base to add the item to (may be NULL if item shouldn't be removed from any base). |
[in] | slot | The slot to remove the item from. |
[in] | ammo | qtrue if we want to remove only ammo. qfalse if the whole item should be removed. |
Definition at line 562 of file cp_mapfightequip.c.
References AII_RemoveNextItemFromSlot(), B_UpdateStorageAndCapacity(), objDef_s::isVirtual, aircraftSlot_s::nextAmmo, aircraftSlot_s::nextItem, qfalse, and qtrue.
Referenced by AII_AddAmmoToSlot(), AII_RemoveNextItemFromSlot(), AIM_AircraftEquipAddItem_f(), and AIM_AircraftEquipRemoveItem_f().
void AII_RepairAircraft | ( | void | ) |
Repair aircraft.
< Number of damage points repaired per hour
Definition at line 1085 of file cp_mapfightequip.c.
References AIR_GetNextFromBase(), AIR_IsAircraftInBase(), AIR_STATS_DAMAGE, B_GetFoundedBaseByIDX(), aircraft_s::damage, MAX_BASES, and aircraft_s::stats.
Referenced by CL_CampaignRun().
void AII_SaveOneSlotXML | ( | mxml_node_t * | p, | |
const aircraftSlot_t * | slot, | |||
qboolean | weapon | |||
) |
Save callback for savegames in XML Format.
[out] | p | XML Node structure, where we write the information to |
[in] | slot | The aircraftslot to save |
[in] | weapon | True if this is a weapon slot |
Definition at line 1377 of file cp_mapfightequip.c.
References aircraftSlot_s::ammo, aircraftSlot_s::ammoLeft, aircraftSlot_s::delayNextShot, objDef_s::id, aircraftSlot_s::installationTime, aircraftSlot_s::item, mxml_AddIntValue(), mxml_AddStringValue(), aircraftSlot_s::nextAmmo, aircraftSlot_s::nextItem, SAVE_SLOT_AMMOID, SAVE_SLOT_AMMOLEFT, SAVE_SLOT_DELAYNEXTSHOT, SAVE_SLOT_INSTALLATIONTIME, SAVE_SLOT_ITEMID, SAVE_SLOT_NEXTAMMOID, and SAVE_SLOT_NEXTITEMID.
Referenced by AIR_SaveAircraftSlotsXML(), and B_SaveBaseSlotsXML().
void AII_UpdateAircraftStats | ( | aircraft_t * | aircraft | ) |
Update the value of stats array of an aircraft.
[in] | aircraft | Pointer to the aircraft |
Definition at line 1108 of file cp_mapfightequip.c.
References AII_CheckUpdateAircraftStats(), AIR_GetMaxAircraftWeaponRange(), AIR_HOME, AIR_REFUEL, AIR_STATS_DAMAGE, AIR_STATS_FUELSIZE, AIR_STATS_MAX, AIR_STATS_SPEED, AIR_STATS_WRANGE, objDef_s::craftitem, aircraft_s::damage, aircraft_s::electronics, aircraft_s::fuel, i, int(), aircraftSlot_s::item, aircraft_s::maxElectronics, aircraft_s::maxWeapons, aircraft_s::shield, craftitem_s::stats, aircraft_s::stats, aircraft_s::status, aircraft_s::tpl, and aircraft_s::weapons.
Referenced by AII_UpdateOneInstallationDelay(), AIM_AircraftEquipAddItem_f(), AIM_AircraftEquipRemoveItem_f(), AIM_AutoEquipAircraft(), AIR_NewAircraft(), and UFO_AddToGeoscape().
void AII_UpdateInstallationDelay | ( | void | ) |
Update the installation delay of all slots of a given aircraft.
Definition at line 406 of file cp_mapfightequip.c.
References AII_UpdateOneInstallationDelay(), AIR_GetNextFromBase(), AIR_IsAircraftInBase(), B_GetFoundedBaseByIDX(), base_s::batteries, installation_s::batteries, aircraft_s::electronics, aircraft_s::homebase, INS_GetFoundedInstallationByIDX(), installation_s::installationTemplate, base_s::lasers, MAX_BASES, MAX_INSTALLATIONS, installationTemplate_s::maxBatteries, aircraft_s::maxElectronics, aircraft_s::maxWeapons, base_s::numBatteries, base_s::numLasers, aircraft_s::shield, baseWeapon_s::slot, and aircraft_s::weapons.
Referenced by CL_CampaignRun().
static void AII_UpdateOneInstallationDelay | ( | base_t * | base, | |
installation_t * | installation, | |||
aircraft_t * | aircraft, | |||
aircraftSlot_t * | slot | |||
) | [static] |
Update the installation delay of one slot.
[in] | base | Pointer to the base to update the storage and capacity for |
[in] | installation | Pointer to the installation being installed. |
[in] | aircraft | Pointer to the aircraft (NULL if a base is updated) |
[in] | slot | Pointer to the slot to update |
Definition at line 330 of file cp_mapfightequip.c.
References _, AII_RemoveItemFromSlot(), AII_UpdateAircraftStats(), Com_sprintf(), cp_messageBuffer, aircraft_s::homebase, aircraftSlot_s::installationTime, aircraftSlot_s::item, lengthof, MSG_STANDARD, MSO_CheckAddNewMessage(), installation_s::name, base_s::name, aircraft_s::name, objDef_s::name, NT_INSTALLATION_INSTALLED, NT_INSTALLATION_REMOVED, NT_INSTALLATION_REPLACE, qfalse, and Sys_Error().
Referenced by AII_UpdateInstallationDelay().
static qboolean AII_WeaponsCanShoot | ( | const baseWeapon_t * | weapons, | |
int | numWeapons | |||
) | [static] |
Check if base or installation weapon can shoot.
[in] | weapons | Pointer to the weapon array of the base. |
[in] | numWeapons | Pointer to the number of weapon in this base. |
Definition at line 1186 of file cp_mapfightequip.c.
References AIRFIGHT_CheckWeapon(), AIRFIGHT_WEAPON_CAN_NEVER_SHOOT, i, qfalse, and qtrue.
Referenced by AII_BaseCanShoot(), and AII_InstallationCanShoot().
const char* AII_WeightToName | ( | itemWeight_t | weight | ) |
Translate a weight int to a translated string.
Definition at line 1353 of file cp_mapfightequip.c.
References _, ITEM_HEAVY, ITEM_LIGHT, and ITEM_MEDIUM.
Referenced by AIM_AircraftEquipMenuUpdate(), and UP_AircraftItemDescription().
void AIM_AutoEquipAircraft | ( | aircraft_t * | aircraft | ) |
Auto Add weapon and ammo to an aircraft.
[in] | aircraft | Pointer to the aircraft |
Definition at line 841 of file cp_mapfightequip.c.
References AII_AddItemToSlot(), AII_AutoAddAmmo(), AII_GetItemWeightBySize(), AII_UpdateAircraftStats(), B_BaseHasItem(), Com_Error(), ERR_DROP, aircraft_s::homebase, i, aircraftSlot_s::installationTime, INVSH_GetItemByID(), aircraftSlot_s::item, aircraft_s::maxWeapons, technology_s::provides, qfalse, RS_GetTechByID(), aircraftSlot_s::size, and aircraft_s::weapons.
Referenced by B_SetUpFirstBase().
qboolean AIM_PilotAssignedAircraft | ( | const base_t * | base, | |
const employee_t * | pilot | |||
) |
Checks to see if the pilot is in any aircraft at this base.
[in] | base | Which base has the aircraft to search for the employee in. |
[in] | pilot | Which employee to search for. |
Definition at line 169 of file cp_mapfightequip.c.
References AIR_GetNextFromBase(), aircraft_s::pilot, qfalse, and qtrue.
qboolean AIM_SelectableCraftItem | ( | const aircraftSlot_t * | slot, | |
const technology_t * | tech | |||
) |
Check if an aircraft item should or should not be displayed in airequip menu.
[in] | slot | Pointer to an aircraft slot (can be base/installation too) |
[in] | tech | Pointer to the technology to test |
Definition at line 95 of file cp_mapfightequip.c.
References AC_ITEM_AMMO, AII_GetItemWeightBySize(), aircraftSlot_s::aircraft, objDef_s::ammos, B_BaseHasItem(), aircraftSlot_s::base, objDef_s::craftitem, aircraft_s::homebase, objDef_s::idx, craftitem_s::installationTime, INVSH_GetItemByID(), aircraftSlot_s::item, aircraftSlot_s::nextItem, objDef_s::numAmmos, technology_s::provides, qfalse, qtrue, RS_IsResearched_ptr(), aircraftSlot_s::size, aircraftSlot_s::type, craftitem_s::type, and objDef_s::weapons.
Referenced by AII_AutoAddAmmo(), AIM_UpdateAircraftItemList(), BDEF_AddItem_f(), BDEF_SelectItem_f(), and BDEF_UpdateAircraftItemList().
float AIR_GetMaxAircraftWeaponRange | ( | const aircraftSlot_t * | slot, | |
int | maxSlot | |||
) |
Get the maximum weapon range of aircraft.
[in] | slot | Pointer to the aircrafts weapon slot list. |
[in] | maxSlot | maximum number of weapon slots in aircraft. |
Definition at line 1054 of file cp_mapfightequip.c.
References AII_CheckUpdateAircraftStats(), AIR_STATS_WRANGE, aircraftSlot_s::ammo, objDef_s::craftitem, i, and craftitem_s::stats.
Referenced by AII_UpdateAircraftStats().
void BDEF_AddBattery | ( | basedefenceType_t | basedefType, | |
base_t * | base | |||
) |
Adds a defence system to base.
[in] | basedefType | Base defence type (see basedefenceType_t) |
[in] | base | Pointer to the base in which the battery will be added |
Definition at line 191 of file cp_mapfightequip.c.
References AMMO_STATUS_NOT_SET, aircraftSlot_s::ammoLeft, baseWeapon_s::autofire, BASEDEF_LASER, BASEDEF_MISSILE, base_s::batteries, Com_Printf(), base_s::lasers, MAX_BASE_SLOT, base_s::numBatteries, base_s::numLasers, qtrue, and baseWeapon_s::slot.
Referenced by BDEF_AddBattery_f().
void BDEF_AutoSelectTarget | ( | void | ) |
Chooses target for all base defences and sam sites.
Definition at line 1326 of file cp_mapfightequip.c.
References B_GetFoundedBaseByIDX(), installation_s::batteries, base_s::batteries, BDEF_AutoTarget(), ccs, i, INS_GetFoundedInstallationByIDX(), base_s::lasers, ccs_s::numBases, installation_s::numBatteries, base_s::numBatteries, ccs_s::numInstallations, and base_s::numLasers.
Referenced by CL_CampaignRun().
static void BDEF_AutoTarget | ( | baseWeapon_t * | weapons, | |
int | maxWeapons | |||
) | [static] |
Chooses a target for surface to air defences automatically.
[in,out] | weapons | Weapons array |
[in] | maxWeapons | Number of weapons |
Check if it's a Base or an Installation
Get closest UFO(s)
Loop weaponslots
skip if autofire is disabled
skip if no weapon or ammo assigned
skip if weapon installation not yet finished
skip if no more ammo left
Definition at line 1245 of file cp_mapfightequip.c.
References AIR_STATS_WRANGE, AIRFIGHT_CheckWeapon(), AIRFIGHT_WEAPON_CAN_NEVER_SHOOT, AIRFIGHT_WEAPON_CAN_NOT_SHOOT_AT_THE_MOMENT, aircraftSlot_s::ammo, aircraftSlot_s::ammoLeft, aircraftSlot_s::base, mission_s::category, ccs, Com_Error(), mission_s::data, ERR_DROP, GetDistanceOnGlobe(), i, aircraftSlot_s::installation, aircraftSlot_s::installationTime, INTERESTCATEGORY_BASE_ATTACK, INTERESTCATEGORY_INTERCEPT, aircraftSlot_s::item, aircraft_s::mission, ccs_s::numUFOs, aircraft_s::pos, base_s::pos, installation_s::pos, baseWeapon_s::slot, baseWeapon_s::target, UFO_IsUFOSeenOnGeoscape(), and ccs_s::ufos.
Referenced by BDEF_AutoSelectTarget().
aircraftSlot_t* BDEF_GetBaseSlotByIDX | ( | base_t * | base, | |
aircraftItemType_t | type, | |||
int | idx | |||
) |
returns the aircraftSlot of a base at an index or the first free slot
[in] | base | Pointer to base |
[in] | type | defence type, see aircraftItemType_t |
[in] | idx | index of aircraftslot |
Definition at line 957 of file cp_mapfightequip.c.
References AC_ITEM_BASE_LASER, AC_ITEM_BASE_MISSILE, base_s::batteries, i, aircraftSlot_s::item, base_s::lasers, aircraftSlot_s::nextItem, base_s::numBatteries, base_s::numLasers, and baseWeapon_s::slot.
Referenced by BDEF_AddItem_f(), BDEF_RemoveItem_f(), and BDEF_SelectItem_f().
aircraftSlot_t* BDEF_GetInstallationSlotByIDX | ( | installation_t * | installation, | |
aircraftItemType_t | type, | |||
int | idx | |||
) |
returns the aircraftSlot of an installaion at an index or the first free slot
[in] | installation | Pointer to the installation |
[in] | type | defence type, see aircraftItemType_t |
[in] | idx | index of aircraftslot |
Definition at line 991 of file cp_mapfightequip.c.
References AC_ITEM_BASE_MISSILE, installation_s::batteries, i, aircraftSlot_s::item, aircraftSlot_s::nextItem, installation_s::numBatteries, and baseWeapon_s::slot.
Referenced by BDEF_AddItem_f(), BDEF_RemoveItem_f(), and BDEF_SelectItem_f().
void BDEF_InitialiseBaseSlots | ( | base_t * | base | ) |
Initialise all values of base slot defence.
[in] | base | Pointer to the base which needs initalisation of its slots. |
Definition at line 289 of file cp_mapfightequip.c.
References AC_ITEM_BASE_LASER, AC_ITEM_BASE_MISSILE, AII_InitialiseSlot(), baseWeapon_s::autofire, base_s::batteries, i, base_s::lasers, MAX_BASE_SLOT, qtrue, baseWeapon_s::slot, and baseWeapon_s::target.
Referenced by B_LoadXML(), and B_SetUpBase().
void BDEF_InitialiseInstallationSlots | ( | installation_t * | installation | ) |
Initialise all values of installation slot defence.
[in] | installation | Pointer to the installation which needs initialisation of its slots. |
Definition at line 309 of file cp_mapfightequip.c.
References AC_ITEM_BASE_MISSILE, AII_InitialiseSlot(), baseWeapon_s::autofire, installation_s::batteries, i, installation_s::installationTemplate, installationTemplate_s::maxBatteries, qtrue, baseWeapon_s::slot, and baseWeapon_s::target.
Referenced by INS_FinishInstallation(), and INS_LoadXML().
void BDEF_ReloadBaseWeapons | ( | base_t * | base, | |
installation_t * | installation | |||
) |
Reload the weapons of a base or intallation.
[in,out] | base | Pointer to the base to reload |
[in,out] | installation | Pointer to the samsite to reload |
Definition at line 670 of file cp_mapfightequip.c.
References AII_ReloadWeapon(), installation_s::batteries, base_s::batteries, Com_Error(), ERR_DROP, i, base_s::lasers, installation_s::numBatteries, base_s::numBatteries, base_s::numLasers, and baseWeapon_s::slot.
void BDEF_RemoveBattery | ( | base_t * | base, | |
basedefenceType_t | basedefType, | |||
int | idx | |||
) |
Remove a base defence sytem from base.
[in] | base | The base that is affected |
[in] | basedefType | (see basedefenceType_t) |
[in] | idx | index of the battery to destroy |
Definition at line 235 of file cp_mapfightequip.c.
References AC_ITEM_BASE_LASER, AC_ITEM_BASE_MISSILE, AII_InitialiseSlot(), BASEDEF_LASER, BASEDEF_MISSILE, base_s::batteries, Com_Printf(), i, aircraftSlot_s::item, base_s::lasers, base_s::numBatteries, base_s::numLasers, REMOVE_ELEM, and baseWeapon_s::slot.
Referenced by BDEF_RemoveBattery_f().