1 /** 2 * @file 3 * @brief Header for slot management related stuff. 4 */ 5 6 /* 7 Copyright (C) 2002-2013 UFO: Alien Invasion. 8 9 This program is free software; you can redistribute it and/or 10 modify it under the terms of the GNU General Public License 11 as published by the Free Software Foundation; either version 2 12 of the License, or (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 17 18 See the GNU General Public License for more details. 19 20 You should have received a copy of the GNU General Public License 21 along with this program; if not, write to the Free Software 22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 23 24 */ 25 26 #pragma once 27 28 /** 29 * @brief Zone number in airequip menu or base defence menu. 30 * @note A zone is the rectangular box in the upper right of the screen. 31 * @note A zone is different from a slot or the type of an item. 32 */ 33 typedef enum { 34 ZONE_NONE, /**< This is not a zone (used when no zone is selected). */ 35 ZONE_MAIN, /**< This is the upper (1st) zone containing the current item installed in the slot. */ 36 ZONE_AMMO, /**< This is the lowest (3rd) zone containing the ammo fitting the weapon in ZONE_MAIN 37 ** Therefore, this zone should only be used when 1st zone contain an WEAPON. */ 38 39 ZONE_MAX 40 } zoneaircraftParams_t; 41 42 /** 43 * @brief Different status for numAmmo. 44 * @todo do we still need this? 45 */ 46 typedef enum { 47 AMMO_STATUS_NOT_SET = -1, /**< This weapon can't shoot yet. */ 48 49 AMMO_STATUS_NO_MORE_AMMO = 0 /**< This weapon has no ammo. */ 50 /* positive values are used for number of ammo left in the weapon */ 51 } ammoStatus_t; 52 53 /** 54 * @brief The different possible types of base defence systems. 55 * @sa BDEF_RemoveBattery_f: BASEDEF_LASER must be just after BASEDEF_MISSILE 56 */ 57 typedef enum { 58 BASEDEF_RANDOM, /**< The base defence system should be randomly selected. */ 59 BASEDEF_MISSILE, /**< The base defence system is a missile battery. */ 60 BASEDEF_LASER, /**< The base defence system is a laser battery. */ 61 62 BASEDEF_MAX 63 } basedefenceType_t; 64 65 /* Base defence functions. */ 66 void BDEF_AddBattery(basedefenceType_t basedefType, base_t* base); 67 void BDEF_RemoveBattery(base_t* base, basedefenceType_t basedefType, int idx); 68 void BDEF_InitialiseBaseSlots(base_t* base); 69 void BDEF_InitialiseInstallationSlots(installation_t* installation); 70 void BDEF_ReloadBattery(void); 71 void BDEF_AutoSelectTarget(void); 72 73 technology_t** AII_GetCraftitemTechsByType(aircraftItemType_t type); 74 void AII_UpdateInstallationDelay(void); 75 bool AII_AddItemToSlot(base_t* base, const technology_t* tech, aircraftSlot_t* slot, bool nextItem); 76 bool AII_AddAmmoToSlot(base_t* base, const technology_t* tech, aircraftSlot_t* slot); 77 void AII_RemoveItemFromSlot(base_t* base, aircraftSlot_t* slot, bool ammo); 78 void AII_RemoveNextItemFromSlot(base_t* base, aircraftSlot_t* slot, bool ammo); 79 bool AIM_PilotAssignedAircraft(const base_t* base, const Employee* pilot); 80 void AIM_AutoEquipAircraft(aircraft_t* aircraft); 81 void AII_InitialiseSlot(aircraftSlot_t* slot, aircraft_t* aircraft, base_t* base, installation_t* installation, aircraftItemType_t type); 82 float AIR_GetMaxAircraftWeaponRange(const aircraftSlot_t* slot, int maxSlot); 83 void AII_RepairAircraft(void); 84 void AII_UpdateAircraftStats(aircraft_t* aircraft); 85 int AII_BaseCanShoot(const base_t* base); 86 bool AII_InstallationCanShoot(const installation_t* installation); 87 88 itemWeight_t AII_GetItemWeightBySize(const objDef_t* od); 89 90 const char* AII_WeightToName(itemWeight_t weight); 91 void AII_AutoAddAmmo(aircraftSlot_t* slot); 92 bool AIM_SelectableCraftItem(const aircraftSlot_t* slot, const technology_t* tech); 93 94 aircraftSlot_t* BDEF_GetBaseSlotByIDX(base_t* base, aircraftItemType_t type, int idx); 95 aircraftSlot_t* BDEF_GetInstallationSlotByIDX(installation_t* installation, aircraftItemType_t type, int idx); 96 aircraftSlot_t* AII_GetAircraftSlotByIDX(aircraft_t* aircraft, aircraftItemType_t type, int idx); 97 98 bool AII_ReloadWeapon(aircraftSlot_t* slot); 99 void AII_ReloadAircraftWeapons(aircraft_t* aircraft); 100 101 void AII_SaveOneSlotXML(xmlNode_t* p, const aircraftSlot_t* slot, bool weapon); 102 void AII_LoadOneSlotXML(xmlNode_t* node, aircraftSlot_t* slot, bool weapon); 103