1 /** 2 * @file 3 */ 4 5 /* 6 Copyright (C) 2002-2013 UFO: Alien Invasion. 7 8 This program is free software; you can redistribute it and/or 9 modify it under the terms of the GNU General Public License 10 as published by the Free Software Foundation; either version 2 11 of the License, or (at your option) any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 17 See the GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program; if not, write to the Free Software 21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 */ 23 24 #pragma once 25 26 /** @brief All possible capacities in base. */ 27 typedef enum { 28 CAP_ALIENS, /**< Live aliens stored in base. */ 29 CAP_AIRCRAFT_SMALL, /**< Small aircraft in base. */ 30 CAP_AIRCRAFT_BIG, /**< Big aircraft in base. */ 31 CAP_EMPLOYEES, /**< Personel in base. */ 32 CAP_ITEMS, /**< Items in base. */ 33 CAP_LABSPACE, /**< Space for scientists in laboratory. */ 34 CAP_WORKSPACE, /**< Space for workers in workshop. */ 35 CAP_ANTIMATTER, /**< Space for Antimatter Storage. */ 36 37 MAX_CAP 38 } baseCapacities_t; 39 40 /** @brief Store capacities in base. */ 41 typedef struct capacities_s { 42 int max; /**< Maximum capacity. */ 43 int cur; /**< Currently used capacity. */ 44 } capacities_t; 45 46 void CAP_UpdateStorageCap(struct base_s* base); 47 /** 48 * @brief Capacity macros 49 */ 50 #define CAP_Get(base, capacity) &((base)->capacities[(capacity)]) 51 #define CAP_GetMax(base, capacity) (base)->capacities[(capacity)].max 52 #define CAP_GetCurrent(base, capacity) (base)->capacities[(capacity)].cur 53 void CAP_SetMax(struct base_s* base, baseCapacities_t capacity, int value); 54 void CAP_AddMax(struct base_s* base, baseCapacities_t capacity, int value); 55 void CAP_SetCurrent(struct base_s* base, baseCapacities_t capacity, int value); 56 void CAP_AddCurrent(struct base_s* base, baseCapacities_t capacity, int value); 57 58 void CAP_RemoveAntimatterExceedingCapacity(struct base_s* base); 59 60 int CAP_GetFreeCapacity(const struct base_s* base, baseCapacities_t cap); 61 void CAP_CheckOverflow(void); 62