config: Drop configuration table size macros
Macros LND_TYPE_MAX, N_MAXNUKE, PLN_TYPE_MAX, P_MAX, SCT_TYPE_MAX, SHP_TYPE_MAX are only used to size a single array each. Eliminate. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
a374e6435d
commit
e379edc648
12 changed files with 17 additions and 25 deletions
|
@ -30,7 +30,7 @@
|
|||
* Thomas Ruschak, 1992
|
||||
* Ken Stevens, 1995
|
||||
* Steve McClure, 1998
|
||||
* Markus Armbruster, 2004-2016
|
||||
* Markus Armbruster, 2004-2020
|
||||
*/
|
||||
|
||||
#ifndef LAND_H
|
||||
|
@ -41,7 +41,6 @@
|
|||
#include "retreat.h"
|
||||
#include "types.h"
|
||||
|
||||
#define LND_TYPE_MAX 30
|
||||
#define LAND_MINEFF 10
|
||||
#define LAND_MINFIREEFF 40 /* arty must be this effic to fire */
|
||||
|
||||
|
@ -125,7 +124,7 @@ struct lchrstr {
|
|||
#define putland(n, p) ef_write(EF_LAND, (n), (p))
|
||||
#define getlandp(n) ((struct lndstr *)ef_ptr(EF_LAND, (n)))
|
||||
|
||||
extern struct lchrstr lchr[LND_TYPE_MAX + 2];
|
||||
extern struct lchrstr lchr[32];
|
||||
|
||||
enum {
|
||||
LND_AIROPS_EFF = 50 /* min. efficiency for air ops */
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* Known contributors to this file:
|
||||
* Dave Pare, 1986
|
||||
* Markus Armbruster, 2004-2016
|
||||
* Markus Armbruster, 2004-2020
|
||||
*/
|
||||
|
||||
#ifndef NUKE_H
|
||||
|
@ -38,7 +38,6 @@
|
|||
#include "item.h"
|
||||
#include "types.h"
|
||||
|
||||
#define N_MAXNUKE 20
|
||||
#define MIN_DRNUKE_CONST 0.001
|
||||
|
||||
struct nukstr {
|
||||
|
@ -83,7 +82,7 @@ struct nchrstr {
|
|||
#define putnuke(n, p) ef_write(EF_NUKE, (n), (p))
|
||||
#define getnukep(n) ((struct nukstr *)ef_ptr(EF_NUKE, (n)))
|
||||
|
||||
extern struct nchrstr nchr[N_MAXNUKE + 1];
|
||||
extern struct nchrstr nchr[21];
|
||||
|
||||
/* src/lib/common/cargo.c */
|
||||
extern void nuk_carrier_change(struct nukstr *, int, int, int);
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
* Dave Pare, 1986
|
||||
* Ken Stevens, 1995
|
||||
* Steve McClure, 1998
|
||||
* Markus Armbruster, 2004-2016
|
||||
* Markus Armbruster, 2004-2020
|
||||
*/
|
||||
|
||||
#ifndef PLANE_H
|
||||
|
@ -41,7 +41,6 @@
|
|||
#include "queue.h"
|
||||
#include "types.h"
|
||||
|
||||
#define PLN_TYPE_MAX 46
|
||||
#define PLANE_MINEFF 10
|
||||
|
||||
struct plnstr {
|
||||
|
@ -135,7 +134,7 @@ struct plist {
|
|||
#define putplane(n, p) ef_write(EF_PLANE, (n), (p))
|
||||
#define getplanep(n) ((struct plnstr *)ef_ptr(EF_PLANE, (n)))
|
||||
|
||||
extern struct plchrstr plchr[PLN_TYPE_MAX + 2];
|
||||
extern struct plchrstr plchr[48];
|
||||
|
||||
struct shiplist {
|
||||
int uid;
|
||||
|
|
|
@ -57,8 +57,6 @@ struct pchrstr {
|
|||
char *p_sname; /* short (7 char or less) name of product */
|
||||
};
|
||||
|
||||
#define P_MAX 22
|
||||
|
||||
extern struct pchrstr pchr[P_MAX + 2];
|
||||
extern struct pchrstr pchr[24];
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
* Dave Pare
|
||||
* Ken Stevens, 1995
|
||||
* Steve McClure, 1998
|
||||
* Markus Armbruster, 2004-2016
|
||||
* Markus Armbruster, 2004-2020
|
||||
*/
|
||||
|
||||
|
||||
|
@ -160,14 +160,12 @@ struct dchrstr {
|
|||
#define SCT_PLAINS 32 /* plains sector */
|
||||
#define SCT_BTOWER 33 /* Bridge tower */
|
||||
|
||||
#define SCT_TYPE_MAX 38
|
||||
|
||||
#define getsect(x, y, p) ef_read(EF_SECTOR, sctoff((x), (y)), (p))
|
||||
#define putsect(p) ef_write(EF_SECTOR, (p)->sct_uid, (p))
|
||||
#define getsectp(x, y) ((struct sctstr *)ef_ptr(EF_SECTOR, sctoff((x), (y))))
|
||||
#define getsectid(id) ((struct sctstr *)ef_ptr(EF_SECTOR, (id)))
|
||||
|
||||
extern struct dchrstr dchr[SCT_TYPE_MAX + 2];
|
||||
extern struct dchrstr dchr[40];
|
||||
#define IS_BIG_CITY(type) (dchr[(type)].d_pkg == UPKG)
|
||||
|
||||
/* Minimal efficiency of sectors that can be knocked down (bridges) */
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
* Thomas Ruschak, 1992
|
||||
* Ken Stevens, 1995
|
||||
* Steve McClure, 1998
|
||||
* Markus Armbruster, 2004-2016
|
||||
* Markus Armbruster, 2004-2020
|
||||
*/
|
||||
|
||||
#ifndef SHIP_H
|
||||
|
@ -42,7 +42,6 @@
|
|||
#include "retreat.h"
|
||||
#include "types.h"
|
||||
|
||||
#define SHP_TYPE_MAX 46
|
||||
#define SHIP_MINEFF 20
|
||||
|
||||
#define MAXSHPNAMLEN 24
|
||||
|
@ -127,7 +126,7 @@ struct mchrstr {
|
|||
#define putship(n, p) ef_write(EF_SHIP, (n), (p))
|
||||
#define getshipp(n) ((struct shpstr *)ef_ptr(EF_SHIP, (n)))
|
||||
|
||||
extern struct mchrstr mchr[SHP_TYPE_MAX + 2];
|
||||
extern struct mchrstr mchr[48];
|
||||
|
||||
enum {
|
||||
SHP_AIROPS_EFF = 50, /* min. efficiency for air ops */
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
* Initialized on startup from land.config and deity custom config (if any).
|
||||
* Terminated by a sentinel with null l_name.
|
||||
*/
|
||||
struct lchrstr lchr[LND_TYPE_MAX + 2];
|
||||
struct lchrstr lchr[];
|
||||
|
||||
#define logx(a, b) (log((a)) / log((b)))
|
||||
#define LND_ATTDEF(b, t) (((b) * (1.0 + ((sqrt((t)) / 100.0) * 4.0))) \
|
||||
|
|
|
@ -38,4 +38,4 @@
|
|||
* Table of nuke types
|
||||
* Initialized on startup from nuke.config and deity custom config (if any).
|
||||
*/
|
||||
struct nchrstr nchr[N_MAXNUKE + 1];
|
||||
struct nchrstr nchr[];
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
* Initialized on startup from plane.config and deity custom config (if any).
|
||||
* Terminated by a sentinel with null pl_name.
|
||||
*/
|
||||
struct plchrstr plchr[PLN_TYPE_MAX + 2];
|
||||
struct plchrstr plchr[];
|
||||
|
||||
#define logx(a, b) (log((a)) / log((b)))
|
||||
#define PLN_ATTDEF(b, t) (b + ((b?1:0) * ((t/20)>10?10:(t/20))))
|
||||
|
|
|
@ -38,4 +38,4 @@
|
|||
* Table of product types
|
||||
* Initialized on startup from product.config and deity custom config (if any).
|
||||
*/
|
||||
struct pchrstr pchr[P_MAX + 2];
|
||||
struct pchrstr pchr[];
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
* Initialized on startup from sect.config and deity custom config (if any).
|
||||
* Terminated by a sentinel with null d_name.
|
||||
*/
|
||||
struct dchrstr dchr[SCT_TYPE_MAX + 2];
|
||||
struct dchrstr dchr[];
|
||||
|
||||
/*
|
||||
* Table of infrastructure types
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
* Initialized on startup from ship.config and deity custom config (if any).
|
||||
* Terminated by a sentinel with null m_name.
|
||||
*/
|
||||
struct mchrstr mchr[SHP_TYPE_MAX + 2];
|
||||
struct mchrstr mchr[];
|
||||
|
||||
#define logx(a, b) (log((a)) / log((b)))
|
||||
#define SHP_DEF(b, t) (t ? (b * (logx(t, 40.0) < 1.0 ? 1.0 : \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue