UFO: Alien Invasion
Loading...
Searching...
No Matches
cp_capacity.h
Go to the documentation of this file.
1
4
5/*
6Copyright (C) 2002-2025 UFO: Alien Invasion.
7
8This program is free software; you can redistribute it and/or
9modify it under the terms of the GNU General Public License
10as published by the Free Software Foundation; either version 2
11of the License, or (at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
17See the GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22*/
23
24#pragma once
25
39
41typedef struct capacities_s {
42 int max;
43 int cur;
45
46void CAP_UpdateStorageCap(struct base_s* base);
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
53void CAP_SetMax(struct base_s* base, baseCapacities_t capacity, int value);
54void CAP_AddMax(struct base_s* base, baseCapacities_t capacity, int value);
55void CAP_SetCurrent(struct base_s* base, baseCapacities_t capacity, int value);
56void CAP_AddCurrent(struct base_s* base, baseCapacities_t capacity, int value);
57
58void CAP_RemoveAntimatterExceedingCapacity(struct base_s* base);
59
60int CAP_GetFreeCapacity(const struct base_s* base, baseCapacities_t cap);
61void CAP_CheckOverflow(void);
baseCapacities_t
All possible capacities in base.
Definition cp_capacity.h:27
@ CAP_ANTIMATTER
Definition cp_capacity.h:35
@ CAP_WORKSPACE
Definition cp_capacity.h:34
@ CAP_ITEMS
Definition cp_capacity.h:32
@ MAX_CAP
Definition cp_capacity.h:37
@ CAP_LABSPACE
Definition cp_capacity.h:33
@ CAP_AIRCRAFT_BIG
Definition cp_capacity.h:30
@ CAP_EMPLOYEES
Definition cp_capacity.h:31
@ CAP_AIRCRAFT_SMALL
Definition cp_capacity.h:29
@ CAP_ALIENS
Definition cp_capacity.h:28
void CAP_CheckOverflow(void)
Checks capacity overflows on bases.
void CAP_AddMax(struct base_s *base, baseCapacities_t capacity, int value)
void CAP_AddCurrent(struct base_s *base, baseCapacities_t capacity, int value)
int CAP_GetFreeCapacity(const struct base_s *base, baseCapacities_t cap)
void CAP_UpdateStorageCap(struct base_s *base)
void CAP_SetMax(struct base_s *base, baseCapacities_t capacity, int value)
void CAP_SetCurrent(struct base_s *base, baseCapacities_t capacity, int value)
void CAP_RemoveAntimatterExceedingCapacity(struct base_s *base)
Store capacities in base.
Definition cp_capacity.h:41