From: Markus Armbruster Date: Tue, 17 Aug 2004 14:09:04 +0000 (+0000) Subject: (mchrstr, lchrstr): Change from variable-style storage of load X-Git-Tag: v4.2.18~91 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=8a0854b6b899c25c87b668c627a1118cdcac978d (mchrstr, lchrstr): Change from variable-style storage of load capacities to straight arrays. Users now subscript the array instead of calling vl_find() or walking the variable data structure. (mchr, lchr): Initializers adapted. (vl_find): No longer used. Remove file. --- diff --git a/include/land.h b/include/land.h index 4feea8458..85d0e3f2c 100644 --- a/include/land.h +++ b/include/land.h @@ -99,9 +99,7 @@ struct lndstr { #define LND_NOTANY bit(0) /* Just a placeholder, not used */ struct lchrstr { - u_char l_nv; /* number of variables it can hold */ - u_char l_vtype[MAXCHRNV]; - u_short l_vamt[MAXCHRNV]; + u_short l_item[I_MAX+1]; /* load limit */ s_char *l_name; /* full name of type of land unit */ int l_lcm; /* units of lcm to build */ int l_hcm; /* units of hcm to build */ diff --git a/include/prototypes.h b/include/prototypes.h index 8a2b4231f..3d3190645 100644 --- a/include/prototypes.h +++ b/include/prototypes.h @@ -179,15 +179,6 @@ extern void snxtsct_dist(register struct nstr_sect *, coord, coord, int); /* type.c */ extern int sct_typematch(char *); extern int typematch(char *, int); -/* vlist.c */ -extern int vl_find(register int, u_char *, u_short *, int); -extern int vl_set(register int, u_int, u_char *, u_short *, u_char *, int); -extern int vl_damage(register int, register u_char *, register u_short *, - register int); -extern int vl_getvec(register u_char *, register u_short *, register int, - register int, register int *); -extern int vl_setvec(register u_char *, register u_short *, u_char *, - int, register int, register int *); /* wantupd.c */ extern void update_policy_check(void); extern int demand_update_want(int *, int *, int); @@ -604,7 +595,6 @@ extern int prod_plane(int, int, int *, int); extern void populace(struct natstr *, register struct sctstr *, int); extern int total_work(register int, register int, register int, register int, register int); -extern double prod_eff(struct pchrstr *, float); /* prepare.c */ extern void tax(struct sctstr *, struct natstr *, int, long *, int *, int *, int *); @@ -614,6 +604,7 @@ extern int bank_income(struct sctstr *, int); /* produce.c */ extern int produce(struct natstr *, struct sctstr *, short *, int, int, int, int *, int *); +extern double prod_eff(struct pchrstr *, float); /* removewants.c */ extern int update_removewants(void); /* revolt.c */ diff --git a/include/ship.h b/include/ship.h index d6d56fcc6..0b715ca92 100644 --- a/include/ship.h +++ b/include/ship.h @@ -128,9 +128,7 @@ struct fltheadstr { }; struct mchrstr { - u_char m_nv; /* number of variables it can hold */ - u_char m_vtype[MAXCHRNV]; - u_short m_vamt[MAXCHRNV]; + u_short m_item[I_MAX+1]; /* load limit */ int m_lcm; /* units of lcm to build */ int m_hcm; /* units of hcm to build */ int m_armor; /* how well armored it is */ diff --git a/src/lib/commands/load.c b/src/lib/commands/load.c index e08a827da..3ce5c843e 100644 --- a/src/lib/commands/load.c +++ b/src/lib/commands/load.c @@ -754,7 +754,7 @@ load_comm_ship(struct sctstr *sectp, struct shpstr *sp, return RET_SYN; ship_amt = sp->shp_item[item]; - ship_max = vl_find(item, mcp->m_vtype, mcp->m_vamt, mcp->m_nv); + ship_max = mcp->m_item[item]; sect_amt = sectp->sct_item[item]; amount = atoi(p); if (amount < 0) @@ -957,7 +957,7 @@ load_comm_land(struct sctstr *sectp, struct lndstr *lp, return RET_SYN; land_amt = lp->lnd_item[item]; - land_max = vl_find(item, lcp->l_vtype, lcp->l_vamt, lcp->l_nv); + land_max = lcp->l_item[item]; sect_amt = sectp->sct_item[item]; amount = atoi(p); if (amount < 0) diff --git a/src/lib/commands/lten.c b/src/lib/commands/lten.c index 7f6c63121..cddc1eaef 100644 --- a/src/lib/commands/lten.c +++ b/src/lib/commands/lten.c @@ -94,8 +94,7 @@ ltend(void) return RET_FAIL; } vbase = &mchr[(int)tender.shp_type]; - maxtender = vl_find(ip->i_vtype, vbase->m_vtype, - vbase->m_vamt, (int)vbase->m_nv); + maxtender = vbase->m_item[ip->i_vtype]; if (maxtender == 0) { pr("A %s cannot hold any %s\n", mchr[(int)tender.shp_type].m_name, ip->i_name); @@ -121,8 +120,7 @@ ltend(void) continue; } lbase = &lchr[(int)target.lnd_type]; - maxtarget = vl_find(ip->i_vtype, lbase->l_vtype, - lbase->l_vamt, (int)lbase->l_nv); + maxtarget = lbase->l_item[ip->i_vtype]; if (amt < 0) { if (!player->owner) amt = 0; diff --git a/src/lib/commands/new.c b/src/lib/commands/new.c index 6835ce488..b429230fc 100644 --- a/src/lib/commands/new.c +++ b/src/lib/commands/new.c @@ -362,7 +362,7 @@ deity_build_land(int type, coord x, coord y, natid own, int tlev) land.lnd_fuelu = (int)LND_FU(lp->l_fuelu, tlev - lp->l_tech); land.lnd_maxlight = (int)LND_XPL(lp->l_nxlight, tlev - lp->l_tech); land.lnd_maxland = (int)LND_MXL(lp->l_mxland, tlev - lp->l_tech); - land.lnd_item[I_FOOD] = vl_find(V_FOOD, lp->l_vtype, lp->l_vamt, lp->l_nv); + land.lnd_item[I_FOOD] = lp->l_item[I_FOOD]; putland(land.lnd_uid, &land); makenotlost(EF_LAND, land.lnd_own, land.lnd_uid, land.lnd_x, diff --git a/src/lib/commands/tend.c b/src/lib/commands/tend.c index 06e3c73b8..227766b1b 100644 --- a/src/lib/commands/tend.c +++ b/src/lib/commands/tend.c @@ -121,8 +121,7 @@ tend(void) return RET_FAIL; } vbase = &mchr[(int)tender.shp_type]; - maxtender = vl_find(ip->i_vtype, vbase->m_vtype, - vbase->m_vamt, (int)vbase->m_nv); + maxtender = vbase->m_item[ip->i_vtype]; if (maxtender == 0) { pr("A %s cannot hold any %s\n", mchr[(int)tender.shp_type].m_name, ip->i_name); @@ -150,8 +149,7 @@ tend(void) continue; } vbase = &mchr[(int)target.shp_type]; - maxtarget = vl_find(ip->i_vtype, vbase->m_vtype, - vbase->m_vamt, (int)vbase->m_nv); + maxtarget = vbase->m_item[ip->i_vtype]; if (amt < 0) { if (!player->owner) amt = 0; diff --git a/src/lib/common/Makefile b/src/lib/common/Makefile index 0c4bca508..609c59191 100644 --- a/src/lib/common/Makefile +++ b/src/lib/common/Makefile @@ -38,13 +38,13 @@ NTLIB = $(SRCDIR)\lib\libcommon.lib OBJS = bestpath.o bridgefall.o check.o damage.o file.o fsize.o \ hap_fact.o hours.o land.o log.o mailbox.o maps.o move.o \ nat.o path.o res_pop.o sectdamage.o \ - stmtch.o tfact.o type.o vlist.o wantupd.o xy.o + stmtch.o tfact.o type.o wantupd.o xy.o NTOBJS = bestpath.obj bridgefall.obj check.obj damage.obj file.obj fsize.obj \ hap_fact.obj hours.obj land.obj log.obj \ mailbox.obj maps.obj move.obj nat.obj path.obj res_pop.obj \ sectdamage.obj stmtch.obj tfact.obj \ - type.obj vlist.obj wantupd.obj xy.obj + type.obj wantupd.obj xy.obj all: $(LIB) diff --git a/src/lib/common/vlist.c b/src/lib/common/vlist.c deleted file mode 100644 index 3cfe11cf0..000000000 --- a/src/lib/common/vlist.c +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Empire - A multi-player, client/server Internet based war game. - * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak, - * Ken Stevens, Steve McClure - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * --- - * - * See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the - * related information and legal notices. It is expected that any future - * projects/authors will amend these files as needed. - * - * --- - * - * vlist.c: manage variable lists - * - * Known contributors to this file: - * Dave Pare, 1989 - */ - -#include "misc.h" -#include "var.h" -#include "sect.h" -#include "ship.h" -#include "land.h" -#include "product.h" -#include "optlist.h" -#include "common.h" -#include "gen.h" - -#if 0 -static int freeslot(u_char *vec, register u_char *end); -#endif - -int -vl_find(register int vtype, u_char *typevec, u_short *amtvec, int nelem) -{ - register u_char *vp; - register u_short *ap; - register u_char *endp; - - if (vtype < 0 || vtype > V_MAX) - return -1; - vp = typevec; - ap = amtvec; - endp = vp + nelem; - for (; vp < endp; vp++, ap++) { - if (*vp == vtype) - return (int)*ap; - } - return 0; -} - -#if 0 -int -vl_set(register int vtype, u_int amt, u_char *typevec, u_short *amtvec, - u_char *nvp, int max) -{ - register u_char *vp; - register u_char *endp; - register u_short *ap; - int n; - - if (vtype < 0 || vtype > V_MAX) - return 0; - if (amt > 65536) { - logerror("vl_set: bad amt %d (%x), vtype %d\n", (int)amt, amt, - vtype); - return 0; - } - vp = typevec; - ap = amtvec; - endp = vp + *nvp; - for (; vp < endp; vp++, ap++) { - if (*vp == vtype) - break; - } - if (vp == endp) { - if (amt == 0) { - /* deleting, but not present */ - return 0; - } - if (*nvp == max) { - if (isdel(vtype) || isdist(vtype)) - return -1; - /* replace any del or dst entries */ - if ((n = freeslot(typevec, endp)) < 0) - return -1; - vp = &typevec[n]; - ap = &amtvec[n]; - } else { - /* add at end */ - (*nvp)++; - } - *vp = vtype; - *ap = amt; - } else { - if (amt != 0) { - /* altering; just change value */ - *ap = amt; - return 1; - } - (*nvp)--; - if (vp < endp - 1) { - /* if not last element, copy last to current */ - *ap = amtvec[*nvp]; - *vp = typevec[*nvp]; - } - } - return 1; -} - -int -vl_damage(register int pct, register u_char *typevec, - register u_short *amtvec, register int nelem) -{ - register int i; - register int lose; - - if (pct >= 100) - return 0; - if (pct <= 0) - return nelem; - for (i = 0; i < nelem; i++) { - if (!isitem(typevec[i])) - continue; - if (opt_SUPER_BARS && typevec[i] == V_BAR) - continue; - lose = roundavg((double)amtvec[i] * pct * 0.01); - if (typevec[i] == V_CIVIL || - typevec[i] == V_MILIT || typevec[i] == V_UW) - lose = ldround(people_damage * lose, 1); - if ((amtvec[i] -= lose) + 1 == 0) { - nelem--; - if (i == nelem) - break; - typevec[i] = typevec[nelem]; - amtvec[i] = amtvec[nelem]; - i--; - } - } - return nelem; -} - -/* - * extract all "mask" items from the variable list - * caller must pass a pointer to an aray of I_MAX+1, - * or else bad things will happen. - */ -int -vl_getvec(register u_char *src_type, register u_short *src_amt, - register int src_nv, register int class, register int *dst_amt) -{ - register int n; - int count; - int item; - - for (n = 0; n < I_MAX + 1; n++) - dst_amt[n] = 0; - for (count = 0, n = 0; n < src_nv; n++) { - if ((src_type[n] & VT_TYPE) != class) - continue; - item = src_type[n] & ~VT_TYPE; - if (item > I_MAX) { - logerror("vl_getvec: bad I-type %d (vtype %d)\n", - item, src_type[n]); - continue; - } - dst_amt[item] = src_amt[n]; - count++; - } - return count; -} - -/* - * Copy the vec into the variable list. All items zero in - * the vec will be deleted from the vlist, and all items - * present in the vec will be added to the vlist. - */ -int -vl_setvec(register u_char *type, register u_short *amt, u_char *nvp, - int max, register int class, register int *vec) -{ - register int nv; - register int n; - register int vec_n; - - nv = *nvp; - vec_n = 1; - n = 0; - while (n < nv) { - if ((type[n] & VT_TYPE) != class) { - n++; - continue; - } - /* find non-zero vec entry to overwrite current slot */ - for (; vec_n <= I_MAX; vec_n++) - if (vec[vec_n] != 0) - break; - if (vec_n > I_MAX) { - /* no more elements left; delete */ - nv--; - if (n < nv) { - /* copy last entry over current entry */ - type[n] = type[nv]; - amt[n] = amt[nv]; - } - } else { - /* use new (unused) entry */ - type[n] = vec_n | class; - amt[n] = vec[vec_n]; - vec_n++; - n++; - } - } - *nvp = nv; - if (n >= nv && vec_n > I_MAX) - return 1; - /* free slots at end; copy rest of vec into the vlist */ - for (; vec_n <= I_MAX && nv < max; vec_n++) { - if (vec[vec_n] == 0) - continue; - type[nv] = vec_n | class; - amt[nv] = vec[vec_n]; - nv++; - } - *nvp = nv; - if (vec_n <= I_MAX && (class == VT_ITEM || class == VT_COND)) { - /* - * still stuff left; make free slots out of deliveries - * and distributes and stuff 'em in (only for item or cond) - */ - for (; vec_n <= I_MAX; vec_n++) { - if (vec[vec_n] == 0) - continue; - if ((n = freeslot(type, &type[max])) < 0) { - logerror("vl_setvec: no free slots left\n"); - return 0; - } - logerror("vl_setvec: replacing type %d amt %d\n", - type[n], amt[n]); - type[n] = vec_n | class; - amt[n] = vec[vec_n]; - } - } - if (nv == max) { - /* checking for overflow */ - while (vec_n <= I_MAX) { - if (vec[vec_n]) - break; - } - if (vec_n <= I_MAX) { - logerror("vl_setvec: no space for i-type #%d (%d)\n", - vec_n, vec[vec_n]); - return 0; - } - } - return 1; -} - -/* - * make a free slot; deliveries and distributions - * are fair game for us. - */ -static int -freeslot(u_char *vec, register u_char *end) -{ - register u_char *vp; - - for (vp = vec; vp < end; vp++) { - if (isdel(*vp) || isdist(*vp)) - return vp - vec; - } - return -1; -} -#endif diff --git a/src/lib/global/land.c b/src/lib/global/land.c index 1a9e0878e..226c99887 100644 --- a/src/lib/global/land.c +++ b/src/lib/global/land.c @@ -45,200 +45,155 @@ struct lchrstr lchr[] = { flags, nv cargo */ - {2, - {V_FOOD, V_MILIT}, - {12, 20}, + + {{0, 0, 20, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0}, "cav cavalry", 10, 5, 0, 0, 0, 30, 500, 1.2, 0.5, 80, 32, 18, 4, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, L_RECON | L_LIGHT, }, - {3, - {V_FOOD, V_SHELL, V_MILIT}, - {15, 1, 25}, + {{0, 0, 25, 1, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0}, "linf light infantry", 8, 4, 0, 0, 0, 40, 300, 1.0, 1.5, 60, 28, 15, 2, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, L_ASSAULT | L_LIGHT, }, - {2, - {V_FOOD, V_MILIT}, - {24, 100}, + {{0, 0, 100, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0}, "inf infantry", 10, 5, 0, 0, 0, 50, 500, 1.0, 1.5, 60, 25, 15, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, L_ASSAULT | L_LIGHT, }, - {3, - {V_FOOD, V_SHELL, V_MILIT}, - {60, 8, 100}, + {{0, 0, 100, 8, 0, 0, 0, 0, 0, 60, 0, 0, 0, 0, 0}, "mtif motor inf", 15, 10, 0, 0, 0, 190, 400, 1.2, 2.2, 60, 33, 17, 1, 3, 0, 0, 0, 2, 3, 13, 1, 0, 0, L_LIGHT, }, - {3, - {V_FOOD, V_SHELL, V_MILIT}, - {60, 8, 100}, + {{0, 0, 100, 8, 0, 0, 0, 0, 0, 60, 0, 0, 0, 0, 0}, "mif mech inf", 15, 10, 0, 0, 0, 190, 800, 1.5, 2.5, 50, 33, 17, 1, 3, 0, 0, 0, 2, 3, 13, 1, 0, 0, L_LIGHT, }, - {3, - {V_FOOD, V_SHELL, V_MILIT}, - {60, 4, 100}, + {{0, 0, 100, 4, 0, 0, 0, 0, 0, 60, 0, 0, 0, 0, 0}, "mar marines", 10, 5, 0, 0, 0, 140, 1000, 1.4, 2.4, 60, 25, 14, 2, 1, 0, 0, 0, 1, 2, 0, 0, 0, 0, L_MARINE | L_ASSAULT | L_LIGHT, }, - {10, - {V_SHELL, V_GUN, V_FOOD, V_LCM, V_HCM, V_DUST, V_BAR, V_IRON, - V_PETROL, V_MILIT}, - {200, 10, 300, 200, 100, 100, 10, 100, 300, 25}, + {{0, 0, 25, 200, 10, 300, 100, 100, 10, 300, 0, 200, 100, 0, 0}, "sup supply", 10, 5, 0, 0, 0, 50, 500, 0.1, 0.2, 80, 25, 20, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, L_LIGHT | L_SUPPLY, }, - {12, - {V_SHELL, V_GUN, V_FOOD, V_LCM, V_HCM, V_DUST, V_BAR, V_IRON, - V_PETROL, V_MILIT, V_OIL, V_RAD}, - {990, 200, 990, 990, 990, 500, 100, 500, 990, 990, 990, 150}, + {{0, 0, 990, 990, 200, 990, 500, 500, 100, 990, 990, 990, 990, 0, 150}, "tra train", 100, 50, 0, 0, 0, 40, 3500, 0.0, 0.0, 120, 10, 25, 3, 0, 0, 0, 0, 0, 0, 0, 0, 5, 12, L_XLIGHT | L_TRAIN | L_HEAVY | L_SUPPLY, }, - {0, - {V_FOOD}, - {0,}, + {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, "spy infiltrator", 10, 5, 0, 0, 0, 40, 750, 0.0, 0.0, 80, 32, 18, 4, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, L_ASSAULT | L_RECON | L_LIGHT | L_SPY, }, - {1, - {V_SHELL}, - {3,}, + {{0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, "com commando", 10, 5, 0, 0, 0, 55, 1500, 0.0, 0.0, 80, 32, 18, 4, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, L_ASSAULT | L_RECON | L_LIGHT | L_SPY, }, - {3, - {V_FOOD, V_SHELL, V_MILIT}, - {12, 5, 20}, + {{0, 0, 20, 5, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0}, "aau aa unit", 20, 10, 0, 0, 0, 70, 500, 0.5, 1.0, 60, 18, 20, 1, 1, 0, 0, 0, 1, 2, 0, 0, 0, 0, L_FLAK | L_LIGHT, }, - {4, - {V_FOOD, V_SHELL, V_MILIT, V_GUN}, - {24, 40, 25, 10}, + {{0, 0, 25, 40, 10, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0}, "art artillery", 20, 10, 0, 0, 0, 35, 800, 0.1, 0.4, 70, 18, 20, 1, 0, 8, 50, 5, 2, 1, 0, 0, 0, 0, L_LIGHT, }, - {4, - {V_FOOD, V_SHELL, V_MILIT, V_GUN}, - {12, 20, 25, 6}, + {{0, 0, 25, 20, 6, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0}, "lat lt artillery", 20, 10, 0, 0, 0, 70, 500, 0.2, 0.6, 60, 30, 18, 1, 1, 5, 10, 3, 1, 1, 0, 0, 0, 0, L_LIGHT, }, - {4, - {V_FOOD, V_SHELL, V_MILIT, V_GUN}, - {24, 80, 25, 12}, + {{0, 0, 25, 80, 12, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0}, "hat hvy artillery", 40, 20, 0, 0, 0, 100, 800, 0.0, 0.2, 60, 12, 20, 1, 0, 11, 99, 8, 4, 1, 0, 0, 0, 0, 0, }, - {4, - {V_FOOD, V_SHELL, V_MILIT, V_GUN}, - {15, 40, 25, 10}, + {{0, 0, 25, 40, 10, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0}, "mat mech artillery", 20, 10, 0, 0, 0, 200, 1000, 0.2, 0.6, 50, 35, 17, 1, 1, 8, 35, 6, 3, 3, 13, 1, 0, 0, L_LIGHT, }, - {3, - {V_FOOD, V_SHELL, V_MILIT}, - {12, 3, 20}, + {{0, 0, 20, 3, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0}, "eng engineer", 10, 5, 0, 0, 0, 130, 3000, 1.2, 2.4, 50, 25, 14, 2, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, L_ENGINEER | L_ASSAULT | L_LIGHT, }, - {3, - {V_FOOD, V_SHELL, V_MILIT}, - {15, 4, 20}, + {{0, 0, 20, 4, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0}, "meng mech engineer", 10, 5, 0, 0, 0, 260, 4500, 1.8, 3.5, 45, 33, 15, 3, 3, 0, 0, 0, 1, 5, 25, 2, 0, 0, L_ENGINEER | L_ASSAULT | L_LIGHT, }, - {3, - {V_FOOD, V_SHELL, V_MILIT}, - {30, 4, 50}, + {{0, 0, 50, 4, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0}, "lar lt armor", 10, 5, 0, 0, 0, 150, 600, 2.0, 1.0, 50, 42, 15, 4, 4, 0, 0, 0, 1, 2, 25, 1, 0, 0, L_RECON | L_LIGHT, }, - {3, - {V_FOOD, V_SHELL, V_MILIT}, - {48, 3, 100}, + {{0, 0, 100, 3, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0}, "har hvy armor", 20, 10, 0, 0, 0, 120, 500, 2.0, 0.8, 50, 18, 17, 1, 1, 0, 0, 0, 2, 1, 10, 2, 0, 0, 0, }, - {3, - {V_FOOD, V_SHELL, V_MILIT}, - {30, 4, 50}, + {{0, 0, 50, 4, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0}, "arm armor", 20, 10, 0, 0, 0, 170, 1000, 3.0, 1.5, 40, 33, 16, 2, 2, 0, 0, 0, 1, 2, 13, 1, 0, 0, L_LIGHT, }, - {3, - {V_FOOD, V_SHELL, V_MILIT}, - {30, 4, 50}, + {{0, 0, 50, 4, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0}, "sec security", 10, 5, 0, 0, 0, 170, 600, 1.0, 2.0, 60, 25, 15, 2, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, L_SECURITY | L_LIGHT, }, - {2, - {V_FOOD, V_MILIT}, - {7, 10}, + {{0, 0, 10, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0}, "rad radar unit", 10, 5, 0, 0, 0, 270, 1000, 0.0, 0.0, 50, 33, 15, 3, 0, 0, 0, 0, 0, 2, 25, 2, 1, 0, @@ -252,9 +207,7 @@ struct lchrstr lchr[] = { cargo */ - {0, - {0}, - {0}, + {{0}, "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/src/lib/global/ship.c b/src/lib/global/ship.c index b4be4826c..44f396b0f 100644 --- a/src/lib/global/ship.c +++ b/src/lib/global/ship.c @@ -56,297 +56,158 @@ struct mchrstr mchr[] = { /* c c o e i g g i p p l l */ /* m m r d b e e m l l c u name tech Cost*/ - {4, - {V_CIVIL, V_MILIT, V_FOOD, V_UW}, - {300, 10, 900, 15}, - 25, 15, 10, 10, 15, 2, 0, 0, 0, 0, 0, 0, "fb fishing boat", 0, 180, - M_FOOD, 0, 0, - }, - - {4, - {V_CIVIL, V_MILIT, V_FOOD, V_UW}, - {300, 10, 900, 15}, - 25, 15, 10, 25, 15, 2, 0, 0, 0, 0, 20, 1, "ft fishing trawler", 35, - 300, - M_FOOD, 0, 0, - }, - - {8, - {V_CIVIL, V_MILIT, V_SHELL, V_GUN, V_FOOD, V_LCM, V_HCM, V_UW}, - {600, 50, 300, 50, 900, 1400, 900, 250}, - 60, 40, 20, 25, 35, 3, 0, 0, 1, 0, 0, 0, "cs cargo ship", 20, 500, - M_SUPPLY, 0, 2, - }, - - {7, - {V_CIVIL, V_MILIT, V_IRON, V_DUST, V_FOOD, V_UW, V_RAD}, - {30, 5, 990, 990, 200, 45, 990}, - 60, 40, 20, 25, 35, 3, 0, 0, 1, 0, 30, 1, "os ore ship", 20, 500, - 0, 0, 0, - }, - - {4, - {V_CIVIL, V_MILIT, V_FOOD, V_UW}, - {20, 80, 200, 1200}, - 60, 40, 20, 10, 35, 3, 0, 0, 1, 0, 0, 0, "ss slave ship", 0, 300, - 0, 0, 0, - }, - - {3, - {V_CIVIL, V_MILIT, V_FOOD}, - {50, 50, 100}, - 200, 100, 20, 25, 35, 3, 0, 0, 1, 0, 30, 1, "ts trade ship", 30, - 1750, - M_TRADE, 0, 0, - }, - - {4, - {V_MILIT, V_SHELL, V_GUN, V_FOOD}, - {60, 10, 2, 60}, - 30, 30, 50, 25, 25, 3, 1, 1, 1, 0, 0, 0, "frg frigate", 0, 600, - M_SEMILAND, 0, 2, - }, - - {4, - {V_CIVIL, V_MILIT, V_FOOD, V_OIL}, - {10, 5, 100, 1}, + {{0, 300, 10, 0, 0, 0, 0, 0, 0, 900, 0, 0, 0, 15, 0}, + 25, 15, 10, 10, 15, 2, 0, 0, 0, 0, 0, 0, "fb fishing boat", + 0, 180, M_FOOD, 0, 0}, + + {{0, 300, 10, 0, 0, 0, 0, 0, 0, 900, 0, 0, 0, 15, 0}, + 25, 15, 10, 25, 15, 2, 0, 0, 0, 0, 20, 1, "ft fishing trawler", + 35, 300, M_FOOD, 0, 0}, + + {{0, 600, 50, 300, 50, 0, 0, 0, 0, 900, 0,1400, 900, 250, 0}, + 60, 40, 20, 25, 35, 3, 0, 0, 1, 0, 0, 0, "cs cargo ship", + 20, 500, M_SUPPLY, 0, 2}, + + {{0, 30, 5, 0, 0, 0, 990, 990, 0, 200, 0, 0, 0, 45, 990}, + 60, 40, 20, 25, 35, 3, 0, 0, 1, 0, 30, 1, "os ore ship", + 20, 500, 0, 0, 0}, + + {{0, 20, 80, 0, 0, 0, 0, 0, 0, 200, 0, 0, 0,1200, 0}, + 60, 40, 20, 10, 35, 3, 0, 0, 1, 0, 0, 0, "ss slave ship", + 0, 300, 0, 0, 0}, + + {{0, 50, 50, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0}, + 200, 100, 20, 25, 35, 3, 0, 0, 1, 0, 30, 1, "ts trade ship", + 30, 1750, M_TRADE, 0, 0}, + + {{0, 0, 60, 10, 2, 0, 0, 0, 0, 60, 0, 0, 0, 0, 0}, + 30, 30, 50, 25, 25, 3, 1, 1, 1, 0, 0, 0, "frg frigate", + 0, 600, M_SEMILAND, 0, 2}, + + {{0, 10, 5, 0, 0, 0, 0, 0, 0, 100, 1, 0, 0, 0, 0}, 25, 15, 10, 25, 15, 2, 0, 0, 0, 0, 20, 1, "oe oil exploration boat", - 40, 800, - M_OIL, 0, 0, - }, - - {5, - {V_CIVIL, V_MILIT, V_FOOD, V_OIL, V_UW}, - {990, 80, 990, 990, 990}, - 60, 60, 30, 15, 65, 3, 0, 0, 2, 0, 0, 0, "od oil derrick", 50, 1500, - M_OIL, 0, 0, - }, - - {4, - {V_MILIT, V_GUN, V_SHELL, V_FOOD}, - {2, 2, 12, 5}, - 20, 10, 10, 38, 10, 2, 1, 1, 0, 0, 4, 1, "pt patrol boat", 40, 300, - M_TORP, 0, 0, - }, - - {4, - {V_MILIT, V_SHELL, V_GUN, V_FOOD}, - {100, 40, 5, 100}, - 30, 40, 50, 30, 30, 5, 6, 3, 1, 0, 40, 1, "lc light cruiser", 45, - 800, - M_MINE, 0, 2, - }, - - {4, - {V_MILIT, V_SHELL, V_GUN, V_FOOD}, - {120, 100, 8, 200}, - 40, 50, 70, 30, 30, 5, 8, 4, 1, 0, 30, 1, "hc heavy cruiser", 50, - 1200, - 0, 0, 4, - }, - - {4, - {V_MILIT, V_SHELL, V_GUN, V_FOOD}, - {120, 20, 4, 120}, - 50, 50, 60, 20, 35, 3, 1, 2, 1, 0, 0, 0, "tt troop transport", 10, - 800, - M_SEMILAND, 0, 2, - }, - - {4, - {V_MILIT, V_SHELL, V_GUN, V_FOOD}, - {200, 200, 10, 900}, - 50, 70, 95, 25, 35, 6, 10, 7, 1, 0, 50, 2, "bb battleship", 45, - 1800, - 0, 0, 2, - }, - - {4, - {V_MILIT, V_SHELL, V_GUN, V_FOOD}, - {180, 100, 10, 400}, - 50, 60, 55, 30, 35, 6, 10, 6, 1, 0, 60, 2, "bbc battlecruiser", 75, - 1500, - 0, 0, 2, - }, - - {6, - {V_CIVIL, V_MILIT, V_PETROL, V_FOOD, V_OIL, V_UW}, - {30, 5, 990, 200, 990, 25}, - 60, 40, 75, 25, 45, 3, 0, 0, 1, 0, 30, 1, "tk tanker", 35, 600, - M_OILER | M_SUPPLY, 0, 0, - }, - - {4, - {V_MILIT, V_FOOD, V_SHELL, V_GUN}, - {10, 90, 100, 1}, - 25, 15, 10, 25, 15, 2, 0, 0, 0, 0, 20, 1, "ms minesweeper", 40, 400, - M_MINE | M_SWEEP, 0, 0, - }, - - {4, - {V_MILIT, V_SHELL, V_GUN, V_FOOD}, - {60, 40, 4, 80}, - 30, 30, 45, 35, 20, 4, 6, 3, 1, 0, 30, 1, "dd destroyer", 70, 600, - M_MINE | M_DCH | M_SONAR, 0, 1, - }, - - {4, - {V_MILIT, V_SHELL, V_GUN, V_FOOD}, - {25, 36, 5, 80}, - 30, 30, 25, 20, 5, 4, 3, 3, 0, 0, 30, 1, "sb submarine", 60, 650, - M_TORP | M_SUB | M_MINE | M_SONAR, 0, 0, - }, - - {8, - {V_CIVIL, V_MILIT, V_SHELL, V_GUN, V_FOOD, V_LCM, V_HCM, V_PETROL}, - {5, 10, 104, 20, 900, 500, 300, 100}, - 40, 40, 50, 30, 2, 3, 0, 0, 0, 0, 50, 2, "sbc cargo submarine", 150, - 1200, - M_SUPPLY | M_OILER | M_SUB | M_SONAR, 0, 0, - }, - - {5, - {V_MILIT, V_SHELL, V_GUN, V_PETROL, V_FOOD}, - {175, 250, 4, 300, 180}, - 50, 60, 60, 30, 40, 5, 2, 2, 4, 20, 50, 2, "cal light carrier", 80, - 2700, - M_FLY, 20, 0, - }, - - {5, - {V_MILIT, V_SHELL, V_GUN, V_PETROL, V_FOOD}, - {350, 500, 4, 500, 900}, + 40, 800, M_OIL, 0, 0}, + + {{0, 990, 80, 0, 0, 0, 0, 0, 0, 990, 990, 0, 0, 990, 0}, + 60, 60, 30, 15, 65, 3, 0, 0, 2, 0, 0, 0, "od oil derrick", + 50, 1500, M_OIL, 0, 0}, + + {{0, 0, 2, 12, 2, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0}, + 20, 10, 10, 38, 10, 2, 1, 1, 0, 0, 4, 1, "pt patrol boat", + 40, 300, M_TORP, 0, 0}, + + {{0, 0, 100, 40, 5, 0, 0, 0, 0, 100, 0, 0, 0, 0, 0}, + 30, 40, 50, 30, 30, 5, 6, 3, 1, 0, 40, 1, "lc light cruiser", + 45, 800, M_MINE, 0, 2 }, + + {{0, 0, 120, 100, 8, 0, 0, 0, 0, 200, 0, 0, 0, 0, 0}, + 40, 50, 70, 30, 30, 5, 8, 4, 1, 0, 30, 1, "hc heavy cruiser", + 50, 1200, 0, 0, 4}, + + {{0, 0, 120, 20, 4, 0, 0, 0, 0, 120, 0, 0, 0, 0, 0}, + 50, 50, 60, 20, 35, 3, 1, 2, 1, 0, 0, 0, "tt troop transport", + 10, 800, M_SEMILAND, 0, 2 }, + + {{0, 0, 200, 200, 10, 0, 0, 0, 0, 900, 0, 0, 0, 0, 0}, + 50, 70, 95, 25, 35, 6, 10, 7, 1, 0, 50, 2, "bb battleship", + 45, 1800, 0, 0, 2}, + + {{0, 0, 180, 100, 10, 0, 0, 0, 0, 400, 0, 0, 0, 0, 0}, + 50, 60, 55, 30, 35, 6, 10, 6, 1, 0, 60, 2, "bbc battlecruiser", + 75, 1500, 0, 0, 2}, + + {{0, 30, 5, 0, 0, 990, 0, 0, 0, 200, 990, 0, 0, 25, 0}, + 60, 40, 75, 25, 45, 3, 0, 0, 1, 0, 30, 1, "tk tanker", + 35, 600, M_OILER | M_SUPPLY, 0, 0}, + + {{0, 0, 10, 100, 1, 0, 0, 0, 0, 90, 0, 0, 0, 0, 0}, + 25, 15, 10, 25, 15, 2, 0, 0, 0, 0, 20, 1, "ms minesweeper", + 40, 400, M_MINE | M_SWEEP, 0, 0}, + + {{0, 0, 60, 40, 4, 0, 0, 0, 0, 80, 0, 0, 0, 0, 0}, + 30, 30, 45, 35, 20, 4, 6, 3, 1, 0, 30, 1, "dd destroyer", + 70, 600, M_MINE | M_DCH | M_SONAR, 0, 1}, + + {{0, 0, 25, 36, 5, 0, 0, 0, 0, 80, 0, 0, 0, 0, 0}, + 30, 30, 25, 20, 5, 4, 3, 3, 0, 0, 30, 1, "sb submarine", + 60, 650, M_TORP | M_SUB | M_MINE | M_SONAR, 0, 0}, + + {{0, 5, 10, 104, 20, 100, 0, 0, 0, 900, 0, 500, 300, 0, 0}, + 40, 40, 50, 30, 2, 3, 0, 0, 0, 0, 50, 2, "sbc cargo submarine", + 150, 1200, M_SUPPLY | M_OILER | M_SUB | M_SONAR, 0, 0}, + + {{0, 0, 175, 250, 4, 300, 0, 0, 0, 180, 0, 0, 0, 0, 0}, + 50, 60, 60, 30, 40, 5, 2, 2, 4, 20, 50, 2, "cal light carrier", + 80, 2700, M_FLY, 20, 0}, + + {{0, 0, 350, 500, 4, 500, 0, 0, 0, 900, 0, 0, 0, 0, 0}, 60, 70, 80, 35, 40, 7, 2, 2, 10, 40, 120, 3, "car aircraft carrier", - 160, 4500, - M_FLY, 40, 0, - }, - - {5, - {V_MILIT, V_SHELL, V_GUN, V_PETROL, V_FOOD}, - {350, 999, 4, 999, 900}, - 70, 80, 100, 45, 40, 9, 2, 2, 20, 4, 0, 0, "can nuc carrier", 305, - 8000, - M_OILER | M_FLY | M_SUPPLY, 60, 0, - }, - - {4, - {V_MILIT, V_FOOD, V_GUN, V_SHELL}, - {400, 300, 1, 10}, - 60, 40, 40, 30, 30, 2, 0, 0, 2, 0, 30, 1, "ls landing ship", 145, - 1000, - M_LAND, 0, 6, - }, - - {4, - {V_MILIT, V_SHELL, V_GUN, V_FOOD}, - {60, 60, 4, 120}, - 40, 30, 50, 35, 30, 5, 2, 2, 4, 0, 40, 1, "af asw frigate", 220, - 800, - M_TORP | M_SUBT | M_DCH | M_SONAR, 0, 0, - }, - - {4, - {V_MILIT, V_SHELL, V_GUN, V_FOOD}, - {25, 60, 6, 500}, - 30, 40, 45, 40, 3, 6, 5, 3, 0, 0, 0, 0, "na nuc attack sub", 260, - 1200, - M_TORP | M_SUB | M_MINE | M_SONAR | M_SUBT, 0, 0, - }, - - {5, - {V_MILIT, V_SHELL, V_GUN, V_PETROL, V_FOOD}, - {100, 80, 6, 40, 500}, - 40, 40, 60, 40, 35, 6, 8, 3, 10, 2, 80, 2, "ad asw destroyer", 240, - 1500, - M_TORP | M_SUBT | M_DCH | M_SONAR, 0, 0, - }, - - {4, - {V_MILIT, V_SHELL, V_FOOD, V_GUN}, - {25, 200, 500, 1}, - 30, 40, 55, 35, 2, 6, 0, 0, 0, 0, 0, 0, "nm nuc miss sub", 270, - 1500, - M_SUB | M_SONAR, 20, 0, - }, - - {4, - {V_MILIT, V_SHELL, V_FOOD, V_GUN}, - {25, 100, 500, 1}, - 30, 30, 35, 30, 3, 3, 0, 0, 0, 0, 30, 1, "msb missile sub", 230, - 1200, - M_SUB | M_SONAR, 10, 0, - }, - - {4, - {V_MILIT, V_SHELL, V_GUN, V_FOOD}, - {5, 100, 3, 500}, - 20, 20, 15, 40, 15, 3, 2, 2, 0, 0, 7, 1, "mb missile boat", 180, - 500, - 0, 10, 0, - }, - - {4, - {V_MILIT, V_SHELL, V_GUN, V_FOOD}, - {60, 220, 4, 120}, - 40, 30, 50, 35, 30, 5, 2, 2, 2, 0, 30, 1, "mf missile frigate", 280, - 1000, - 0, 20, 0, - }, - - {5, - {V_MILIT, V_SHELL, V_GUN, V_PETROL, V_FOOD}, - {120, 500, 6, 160, 200}, - 50, 50, 70, 35, 35, 8, 8, 6, 8, 8, 35, 1, "mc missile cruiser", 290, - 1500, - M_ANTIMISSILE, 40, 0, - }, - - {4, - {V_MILIT, V_SHELL, V_GUN, V_FOOD}, - {100, 100, 15, 200}, - 50, 60, 80, 35, 30, 6, 1, 8, 1, 0, 60, 2, "aac aa cruiser", 130, - 1500, - M_ANTIMISSILE, 0, 4, - }, - - {5, - {V_MILIT, V_SHELL, V_GUN, V_PETROL, V_FOOD}, - {200, 400, 25, 40, 900}, - 50, 60, 80, 35, 30, 6, 1, 16, 30, 2, 0, 0, "agc aegis cruiser", 265, - 4000, - M_ANTIMISSILE, 32, 0, - }, - - {5, - {V_MILIT, V_SHELL, V_GUN, V_PETROL, V_FOOD}, - {200, 400, 8, 40, 900}, - 50, 50, 100, 45, 35, 6, 14, 7, 10, 2, 0, 0, "ncr nuc cruiser", 325, - 1800, - M_ANTIMISSILE, 20, 0, - }, - - {5, - {V_MILIT, V_SHELL, V_GUN, V_PETROL, V_FOOD}, - {200, 120, 6, 160, 500}, + 160, 4500, M_FLY, 40, 0}, + + {{0, 0, 350, 999, 4, 999, 0, 0, 0, 900, 0, 0, 0, 0, 0}, + 70, 80, 100, 45, 40, 9, 2, 2, 20, 4, 0, 0, "can nuc carrier", + 305, 8000, M_OILER | M_FLY | M_SUPPLY, 60, 0}, + + {{0, 0, 400, 10, 1, 0, 0, 0, 0, 300, 0, 0, 0, 0, 0}, + 60, 40, 40, 30, 30, 2, 0, 0, 2, 0, 30, 1, "ls landing ship", + 145, 1000, M_LAND, 0, 6}, + + {{0, 0, 60, 60, 4, 0, 0, 0, 0, 120, 0, 0, 0, 0, 0}, + 40, 30, 50, 35, 30, 5, 2, 2, 4, 0, 40, 1, "af asw frigate", + 220, 800, M_TORP | M_SUBT | M_DCH | M_SONAR, 0, 0}, + + {{0, 0, 25, 60, 6, 0, 0, 0, 0, 500, 0, 0, 0, 0, 0}, + 30, 40, 45, 40, 3, 6, 5, 3, 0, 0, 0, 0, "na nuc attack sub", + 260, 1200, M_TORP | M_SUB | M_MINE | M_SONAR | M_SUBT, 0, 0}, + + {{0, 0, 100, 80, 6, 40, 0, 0, 0, 500, 0, 0, 0, 0, 0}, + 40, 40, 60, 40, 35, 6, 8, 3, 10, 2, 80, 2, "ad asw destroyer", + 240, 1500, M_TORP | M_SUBT | M_DCH | M_SONAR, 0, 0}, + + {{0, 0, 25, 200, 1, 0, 0, 0, 0, 500, 0, 0, 0, 0, 0}, + 30, 40, 55, 35, 2, 6, 0, 0, 0, 0, 0, 0, "nm nuc miss sub", + 270, 1500, M_SUB | M_SONAR, 20, 0}, + + {{0, 0, 25, 100, 1, 0, 0, 0, 0, 500, 0, 0, 0, 0, 0}, + 30, 30, 35, 30, 3, 3, 0, 0, 0, 0, 30, 1, "msb missile sub", + 230, 1200, M_SUB | M_SONAR, 10, 0}, + + {{0, 0, 5, 100, 3, 0, 0, 0, 0, 500, 0, 0, 0, 0, 0}, + 20, 20, 15, 40, 15, 3, 2, 2, 0, 0, 7, 1, "mb missile boat", + 180, 500, 0, 10, 0}, + + {{0, 0, 60, 220, 4, 0, 0, 0, 0, 120, 0, 0, 0, 0, 0}, + 40, 30, 50, 35, 30, 5, 2, 2, 2, 0, 30, 1, "mf missile frigate", + 280, 1000, 0, 20, 0}, + + {{0, 0, 120, 500, 6, 160, 0, 0, 0, 200, 0, 0, 0, 0, 0}, + 50, 50, 70, 35, 35, 8, 8, 6, 8, 8, 35, 1, "mc missile cruiser", + 290, 1500, M_ANTIMISSILE, 40, 0}, + + {{0, 0, 100, 100, 15, 0, 0, 0, 0, 200, 0, 0, 0, 0, 0}, + 50, 60, 80, 35, 30, 6, 1, 8, 1, 0, 60, 2, "aac aa cruiser", + 130, 1500, M_ANTIMISSILE, 0, 4}, + + {{0, 0, 200, 400, 25, 40, 0, 0, 0, 900, 0, 0, 0, 0, 0}, + 50, 60, 80, 35, 30, 6, 1, 16, 30, 2, 0, 0, "agc aegis cruiser", + 265, 4000, M_ANTIMISSILE, 32, 0}, + + {{0, 0, 200, 400, 8, 40, 0, 0, 0, 900, 0, 0, 0, 0, 0}, + 50, 50, 100, 45, 35, 6, 14, 7, 10, 2, 0, 0, "ncr nuc cruiser", + 325, 1800, M_ANTIMISSILE, 20, 0}, + + {{0, 0, 200, 120, 6, 160, 0, 0, 0, 500, 0, 0, 0, 0, 0}, 50, 50, 80, 45, 35, 9, 10, 4, 25, 8, 0, 0, "nas nuc asw cruiser", - 330, 1800, - M_TORP | M_SUBT | M_DCH | M_SONAR, 0, 0, - }, - - {8, - {V_CIVIL, V_MILIT, V_SHELL, V_GUN, V_PETROL, V_FOOD, V_LCM, V_HCM}, - {50, 50, 600, 50, 999, 999, 1500, 900}, - 60, 40, 40, 45, 35, 6, 0, 0, 10, 2, 0, 0, "nsp nuc supply ship", 360, - 1500, - M_SUPPLY, 0, 2, - }, - - {0, - {0}, - {0}, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", 0, 0, - 0, 0, 0, - } + 330, 1800, M_TORP | M_SUBT | M_DCH | M_SONAR, 0, 0}, + +/* ? c m s g p i d b f o l h u r */ + {{0, 50, 50, 600, 50, 999, 0, 0, 0, 999, 0,1500, 900, 0, 0}, + 60, 40, 40, 45, 35, 6, 0, 0, 10, 2, 0, 0, "nsp nuc supply ship", + 360, 1500, M_SUPPLY, 0, 2}, + + {{0}, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", + 0, 0, 0, 0, 0} }; int shp_maxno = (sizeof(mchr) / sizeof(struct mchrstr)) - 1; diff --git a/src/lib/subs/attsub.c b/src/lib/subs/attsub.c index eb9d3b3de..071a7b92b 100644 --- a/src/lib/subs/attsub.c +++ b/src/lib/subs/attsub.c @@ -868,8 +868,7 @@ get_mob_support(int combat_mode, struct combat *off, struct combat *def) case A_BOARD: if (off->type == EF_SECTOR && off->mob <= 0) return 0; - mob_support = vl_find(V_MILIT, def->shp_mcp->m_vtype, - def->shp_mcp->m_vamt, def->shp_mcp->m_nv); + mob_support = def->shp_mcp->m_item[I_MILIT]; if (mob_support < off->troops) pr("The size of the ship you are trying to board limits your party to %d mil,\n", mob_support); else @@ -880,8 +879,7 @@ get_mob_support(int combat_mode, struct combat *off, struct combat *def) return 0; if (def->lnd_lcp->l_flags & L_SPY) return 1; - mob_support = vl_find(V_MILIT, def->lnd_lcp->l_vtype, - def->lnd_lcp->l_vamt, def->lnd_lcp->l_nv); + mob_support = def->lnd_lcp->l_item[I_MILIT]; if (mob_support < off->troops) pr("The size of the unit you are trying to board limits your party to %d mil,\n", mob_support); else diff --git a/src/lib/subs/lndsub.c b/src/lib/subs/lndsub.c index 1b293e5ba..4d3bfb691 100644 --- a/src/lib/subs/lndsub.c +++ b/src/lib/subs/lndsub.c @@ -705,8 +705,7 @@ lnd_sweep(struct emp_qelem *land_list, int verbose, int takemob, putland(llp->land.lnd_uid, &llp->land); if (!(mines = sect.sct_mines)) continue; - max = vl_find(V_SHELL, llp->lcp->l_vtype, - llp->lcp->l_vamt, (int)llp->lcp->l_nv); + max = llp->lcp->l_item[I_SHELL]; lshells = llp->land.lnd_item[I_SHELL]; sshells = sect.sct_item[I_SHELL]; for (m = 0; mines > 0 && m < max * 2; m++) { diff --git a/src/lib/subs/plnsub.c b/src/lib/subs/plnsub.c index 3e0bc1adc..cd2cb116b 100644 --- a/src/lib/subs/plnsub.c +++ b/src/lib/subs/plnsub.c @@ -303,8 +303,7 @@ pln_dropoff(struct emp_qelem *list, struct ichrstr *ip, coord tx, coord ty, sp = ptr; there = sp->shp_item[ip->i_vtype]; mp = &mchr[(int)sp->shp_type]; - max = vl_find(ip->i_vtype, mp->m_vtype, - mp->m_vamt, (int)mp->m_nv); + max = mp->m_item[ip->i_vtype]; } there += amt; if (there > max) { diff --git a/src/lib/subs/retreat.c b/src/lib/subs/retreat.c index 4149cd759..a0dae1f0e 100644 --- a/src/lib/subs/retreat.c +++ b/src/lib/subs/retreat.c @@ -279,8 +279,7 @@ retreat_ship1(struct shpstr *sp, s_char code, int orig) mines = sect.sct_mines; if ((mcp->m_flags & M_SWEEP) && mines > 0 && !player->owner) { - max = vl_find(V_SHELL, mcp->m_vtype, - mcp->m_vamt, (int)mcp->m_nv); + max = mcp->m_item[I_SHELL]; shells = sp->shp_item[I_SHELL]; for (m = 0; mines > 0 && m < 5; m++) { if (chance(0.66)) { @@ -520,8 +519,7 @@ retreat_land1(struct lndstr *lp, s_char code, int orig) mines = sect.sct_mines; if ((lcp->l_flags & L_ENGINEER) && mines > 0 && (sect.sct_oldown != lp->lnd_own)) { - max = vl_find(V_SHELL, lcp->l_vtype, - lcp->l_vamt, (int)lcp->l_nv); + max = lcp->l_item[I_SHELL]; shells = lp->lnd_item[I_SHELL]; for (m = 0; mines > 0 && m < 5; m++) { if (chance(0.66)) { diff --git a/src/lib/subs/show.c b/src/lib/subs/show.c index 402a65423..139da95f6 100644 --- a/src/lib/subs/show.c +++ b/src/lib/subs/show.c @@ -420,13 +420,9 @@ void show_ship_capab(int tlev) { register struct mchrstr *mp; - register u_short *ap; - register u_char *type; register int i; - register int it; int scount; int n; - s_char c; s_char *p; pr("%25s cargos & capabilities\n", ""); @@ -440,18 +436,9 @@ show_ship_capab(int tlev) pr("%-25.25s ", mp->m_name); - /* - * should use vector stuff - */ - for (ap = mp->m_vamt, type = mp->m_vtype, i = 0; - i < mp->m_nv; i++, ap++, type++) { - it = unitem((int)*type); - if (it > 0 && it <= I_MAX && ichr[it].i_name != 0) - c = ichr[it].i_name[0]; - else - c = '?'; - pr(" %d%c", *ap, c); - } + for (i = 0; i <= I_MAX; ++i) + if (mp->m_item[i]) + pr(" %d%c", mp->m_item[i], ichr[i].i_mnem); pr(" "); for (i = n = 0; i < 32; i++) { if (!(mp->m_flags & bit(i))) @@ -559,11 +546,8 @@ show_land_capab(int tlev) { struct lchrstr *lcp; int lcount; - register u_short *ap; - register u_char *type; register int i, n; - register int it; - register s_char *p, c; + register s_char *p; pr("%25s capabilities\n", ""); @@ -575,18 +559,9 @@ show_land_capab(int tlev) pr("%-25s ", lcp->l_name); - /* - * should use vector stuff - */ - for (ap = lcp->l_vamt, type = lcp->l_vtype, i = 0; - i < lcp->l_nv; i++, ap++, type++) { - it = unitem((int)*type); - if (it > 0 && it <= I_MAX && ichr[it].i_name != 0) - c = ichr[it].i_name[0]; - else - c = '?'; - pr(" %d%c", *ap, c); - } + for (i = 0; i <= I_MAX; ++i) + if (lcp->l_item[i]) + pr(" %d%c", lcp->l_item[i], ichr[i].i_mnem); pr(" "); for (i = n = 0; i < 32; i++) { if (!(lcp->l_flags & bit(i))) diff --git a/src/lib/subs/shpsub.c b/src/lib/subs/shpsub.c index 7fcf9208b..91cf1c906 100644 --- a/src/lib/subs/shpsub.c +++ b/src/lib/subs/shpsub.c @@ -250,8 +250,7 @@ shp_sweep(struct emp_qelem *ship_list, int verbose, natid actor) putship(mlp->ship.shp_uid, &mlp->ship); if (!(mines = sect.sct_mines)) continue; - max = vl_find(V_SHELL, mlp->mcp->m_vtype, - mlp->mcp->m_vamt, (int)mlp->mcp->m_nv); + max = mlp->mcp->m_item[I_SHELL]; shells = mlp->ship.shp_item[I_SHELL]; for (m = 0; mines > 0 && m < 5; m++) { if (chance(0.66)) { diff --git a/src/lib/subs/supply.c b/src/lib/subs/supply.c index df0ac37df..d6c6cd00a 100644 --- a/src/lib/subs/supply.c +++ b/src/lib/subs/supply.c @@ -439,7 +439,7 @@ get_minimum(struct lndstr *lp, int type) int max, want = 0; lcp = &lchr[(int)lp->lnd_type]; - max = vl_find(V_ITEM(type), lcp->l_vtype, lcp->l_vamt, (int)lcp->l_nv); + max = lcp->l_item[type]; switch (type) { case I_FOOD: diff --git a/src/lib/update/nav_ship.c b/src/lib/update/nav_ship.c index c12866f2f..1a5c021cc 100644 --- a/src/lib/update/nav_ship.c +++ b/src/lib/update/nav_ship.c @@ -329,8 +329,7 @@ nav_ship(register struct shpstr *sp) /* special case for fishing boats */ if ((mchr[(int)sp->shp_type].m_flags & M_FOOD) == 1) { food_amt = sp->shp_item[I_FOOD]; - max_amt = vl_find(V_FOOD, vship->m_vtype, - vship->m_vamt, vship->m_nv); + max_amt = vship->m_item[I_FOOD]; sectp = getsectp(sp->shp_x, sp->shp_y); if (food_amt < max_amt && (sectp->sct_own == 0)) diff --git a/src/lib/update/nav_util.c b/src/lib/update/nav_util.c index 0a1513b68..90769cd58 100644 --- a/src/lib/update/nav_util.c +++ b/src/lib/update/nav_util.c @@ -107,8 +107,7 @@ load_it(register struct shpstr *sp, register struct sctstr *psect, int i) if (comm == V_CIVIL || comm == V_MILIT) sect_amt--; /* leave 1 civ or mil to hold the sector. */ vship = &mchr[(int)sp->shp_type]; - abs_max = max_amt = vl_find(comm, vship->m_vtype, - vship->m_vamt, (int)vship->m_nv); + abs_max = max_amt = vship->m_item[comm]; if (!abs_max) return 0; /* can't load the ship, skip to the end. */ diff --git a/src/lib/update/ship.c b/src/lib/update/ship.c index 9df018941..88a545636 100644 --- a/src/lib/update/ship.c +++ b/src/lib/update/ship.c @@ -176,7 +176,7 @@ upd_ship(register struct shpstr *sp, register int etus, * (double)sp->shp_effic / 100.0 * (double)sectp->sct_oil / 100.0 * prod_eff(product, sp->shp_tech)); - max_oil = vl_find(V_OIL, mp->m_vtype, mp->m_vamt, mp->m_nv); + max_oil = mp->m_item[I_OIL]; if (sp->shp_item[I_OIL] + oil_gained > max_oil) oil_gained = max_oil - sp->shp_item[I_OIL]; sp->shp_item[I_OIL] += oil_gained; @@ -201,7 +201,7 @@ upd_ship(register struct shpstr *sp, register int etus, if (n > 10) nreport(sp->shp_own, N_DIE_FAMINE, 0, 1); } - max_food = vl_find(V_FOOD, mp->m_vtype, mp->m_vamt, mp->m_nv); + max_food = mp->m_item[I_FOOD]; if (sp->shp_item[I_FOOD] > max_food) sp->shp_item[I_FOOD] = max_food; /* diff --git a/src/server/main.c b/src/server/main.c index c284532f3..70c4da20f 100644 --- a/src/server/main.c +++ b/src/server/main.c @@ -414,10 +414,7 @@ nullify_objects(void) if (opt_NO_LCMS) lchr[i].l_lcm = 0; /* Fix up the military values */ - for (j = 0; j < lchr[i].l_nv; j++) { - if (lchr[i].l_vtype[j] == V_MILIT) - lchr[i].l_mil = lchr[i].l_vamt[j]; - } + lchr[i].l_mil = lchr[i].l_item[I_MILIT]; } for (i = 0; i < shp_maxno; i++) { if (opt_NO_HCMS)