Commit graph

32 commits

Author SHA1 Message Date
Ron Koenderink
18902e45d0 (dchrstr): Rename member d_flg to d_nav. Users changed. 2006-01-17 21:17:19 +00:00
3e400c018c Update copyright notice. 2006-01-05 13:36:57 +00:00
fa52e6944d Normalize inclusion guards: use NAME_H for name.h. Some headers
lacked them, others used reserved identifiers.
2005-12-29 10:16:01 +00:00
fdec6a8aae (dchrstr, pchrstr, rptstr): New member d_uid, p_uid, r_uid.
(dchr, bigcity_dchr, pchr, rpt): Initialize it.
(dchr_ca, pchr_ca, rpt_ca): New selector uid for it.
2005-11-19 17:37:43 +00:00
Ron Koenderink
a2798857cf (fuel, load, prod, max_population, shp_nav_one_sector,
nav_loadship, upd_buildeff): Identify BIG_CITY
(IS_BIG_CITY) by using packing type of UPKG instead of
opt_BIG_CITY and sector type of SCT_CAPITAL.
2005-11-14 13:52:12 +00:00
b8e2f4a92a (dchr): Remove second sentinel. 2005-10-29 06:34:21 +00:00
Ron Koenderink
7c93f70ee4 (nchr): Move the array size to nuke.h. Add rows for configurable units.
(lchr,plchr,mchr): Add array size to land.h/plane.h/ship.h.  Add rows for
configurable units.
(ichr,pchr,dchr,intrchr): Add array size to item.h/product.h/sect.h.
2005-10-28 13:23:08 +00:00
4a67b91f8a Document struct equivalence hack and implications of EFF_XY and
EFF_GROUP.
2005-05-28 08:03:31 +00:00
Ron Koenderink
276a99841f (MINES_MAX): Change to 32767. MINES_MAX was not adjusted from 65535
when sct_mines was changed from unsigned short to short in rev. 1.15.
2005-05-07 19:49:04 +00:00
345ad3dfe0 Update copyright notice. 2005-03-16 22:03:16 +00:00
153527a3eb From Ray Hyatt:
(dchrstr): New member d_maxpop.
(dchr): Initialize it.
(max_pop): Use it.  Use dchr[SCT_MINE].d_maxpop when called with null
argument.  RES_POP now affects mountains and plains as well.
2005-02-12 16:17:57 +00:00
Ron Koenderink
4a6346b0df (sct_pstage, sct_ptime, shp_pstage, shp_ptime, lnd_pstage, lnd_ptime):
Use `short' instead of `unsigned short'.  With variables, plague stage
and time were stored unsigned and used signed, which worked.  Removal
of variables dropped the conversion to signed, which broke
plague_people() (plague.c rev. 1.6): stage didn't progress correctly
due to catastrophic underflow of time.
2004-12-12 19:39:35 +00:00
Marc Olzheim
e9a040adb9 Do not include var.h where no longer needed. Clean up register keywords in these file at the same time. No functional changes. 2004-10-12 20:08:51 +00:00
9dbc1cb5e3 Use plain char * instead of s_char *. 2004-09-10 18:18:31 +00:00
fac342ed49 Update copyright notice. 2004-09-07 15:07:16 +00:00
eaa90d0590 (getsect, putsect, getsectp): Remove superflous casts, parenthesize
macro parameters properly.
2004-08-23 18:35:50 +00:00
dcfd251f95 caddr_t is obsolete. Replace by void *, except for struct empfile
member cache, which becomes char * to keep pointer arithmetic simple.
2004-08-23 18:29:44 +00:00
059353e957 (sctstr, sect_ca): Make sct_mines signed for same reasons as
sct_item[] (see sect.h rev. 1.10).
2004-08-23 15:50:32 +00:00
5a725c9177 (nullify_objects): Use SCT_MAXDEF instead of sct_maxno. Loop no
longer covers the extra empty slots at the end of the dchr[]; doesn't
matter.

(sct_maxno): Unused, remove.
2004-08-19 17:45:36 +00:00
17494e74d1 (SCT_BLD_WORK, SHP_BLD_WORK, PLN_BLD_WORK, LND_BLD_WORK,
NUK_BLD_WORK): New, to encapsulate the formula in one place.

(SCT_MINEFF): New.  Use it instead of literal 20.

(buil): Use CANT_HAPPEN() for internal error.

(build_ship, build_land, build_bridge, build_nuke, build_plane,
build_tower): Simplify avail calculation.

(lupgr, supgr, pupgr): Charge 15% of total build avail instead of an
undocumented amount computed from build lcm and hcm.

(build_ship, build_land, build_bridge, build_nuke, build_plane,
build_tower, lupgr, supgr, pupgr): Fix reporting of required avail
when there's not enough.  Closes #942823.

(lupgr, supgr, pupgr): Code printed cost rounded down, but required
and charged unrounded cost.  Confusing.  Round cost down, like the
build command.  Closes #942811.

(UPGR_COST, UPGR_EFF, lupgr, supgr, pupgr): New UPGR_COST, UPGR_COST replace
literal values.

(show_bridge, show_tower): Don't claim bridge building requires
`workers' (whatever that is), since it doesn't.
2004-05-15 13:23:39 +00:00
b0627a97cb (i_packing): New. Use where appropriate.
(NPKG, WPKG, UPKG, BPKG, NUMPKG): Turn macros into enumeration
constants.
(NPKG, WPKG, UPKG, BPKG): Move from sect.h to item.h.
2004-04-09 06:30:21 +00:00
91cc2ddc42 Remove unused variables and such. No functional changes. 2004-03-11 22:10:19 +00:00
9989c5b3ec (sctstr, shpstr, lndstr): Use short' instead of unsigned short' for
item storage.  Rationale: Permitted values are 0..M, where M depends
on the container.  The largest M is ITEM_MAX (9999).  Benign
overflow/underflow occurs at those limits.  Catastrophic
overflow/underflow occurs at the limits of the underlying data type.
For `unsigned short', any underflow is catastrophic.  For `short',
benign undeflow happens long before catastrophic underflow.  Moreover,
unsigned arithmetic tends to trip up unwary programmers.
2004-03-05 07:56:50 +00:00
95ef2b139d (ITEM_MAX): New, value 9999.
(give, deliver_it): Use it instead of 9990.
(load_comm_ship, load_comm_land, rese): Use it instead of 9999.
(thre): Use it instead of 10000.
(check_market, explore, move, pln_dropoff): Use it instead of 32767.
(unload_it): Use it instead of 99999 (which couldn't possibly work,
but what do you expect from the autonav code).
2004-03-05 06:34:34 +00:00
abd1fd2c1e (FALLOUT_MAX): New.
(doland, detonate, spread_fallout): Use it.  With variables, fallout
beyond the capacity of variables (65535) was ignored, except in
doland(), where it saturated at 9999, and spread_fallout, where it
could overflow.  Now it always saturates at FALLOUT_MAX.
2004-03-04 16:19:50 +00:00
828b84d840 (MINES_MAX): New.
(doland, mine, landmine, setsector, pln_dropoff): Use it.  With
variables, mining beyond the capacity of variables (65535) was
ignored.  Now the mines saturate at MINES_MAX.
2004-03-04 15:54:46 +00:00
5bad9875a5 (sctstr): Member sct_che encoded number of che and their target.
Simplify.  Split into member sct_che (number) and sct_che_target.
Users changed.
(get_che_cnum, set_che_cnum, get_che_value, get_che_value): Che
encoding/decoding functions; remove.
(CHE_MAX): Move from var.h to sect.h.
(prsect, doland): Print / edit the new field.
2004-03-04 13:49:25 +00:00
eccc5cb7d7 Sectors need space for items, deliveries and distribution thresholds.
To save space, the ancients invented `variables': a collection of
key-value pairs, missing means zero value, space for `enough' keys.
This complicates the code, as assigning to a `variable' can fail for
lack of space.  Over time, `enough' increased, and for quite some time
now `variables' have been *wasting* space.  This changeset replaces
them, except in struct mchrstr, struct lchrstr and struct pchrstr,
where they are read-only, and will be replaced later.  It is only a
first step; further cleanup is required.  To simplify and minimize
this necessarily huge changeset, the new item[] arrays have an unused
slot 0, and the old variable types V_CIVIL, ... are still defined, but
must have the same values as the item types I_CIVIL, ...
2004-03-03 16:54:22 +00:00
c1be5d8657 Don't declare things in more than one place. Move some declarations
between headers.  Code is now fully prototyped and compiles cleanly
with gcc -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs
-Wredundant-decls.  Closes #723788.
2004-02-20 20:45:18 +00:00
237baffca9 Supply prototypes where possible. This uncovered type errors with
thread entrypoints:
(lwpSelect, shutdown_sequence): Parameters didn't match thread entry
point prototype.
(lwpEntryPoint): Arguments didn't match thread entry point prototype.

Change linkage of functions without prototype declaration to static
where possible.

Remove some superflous declarations, replace others by suitable
includes.
2004-02-17 17:59:30 +00:00
9b7adfbecc Indented with src/scripts/indent-emp. 2003-09-02 20:48:48 +00:00
d8b7fdfae1 Import of Empire 4.2.12 2003-08-23 12:23:04 +00:00