Commit graph

584 commits

Author SHA1 Message Date
2732ac5d1d (lnd_getmil, total_mil): Trivial, inline into callers and remove. The
abstraction from actual land unit mil encoding provided by them was
too leaky to be relied upon anyway.
2006-05-20 16:39:58 +00:00
092a52f2c6 (att_estimate_defense, att_get_offense): Rename. Remove dead code and
unused last parameter.  Callers changed.
2006-05-20 15:17:30 +00:00
7ea516852b (sail): Don't interpret negative x-coordinates as unsail argument. 2006-05-20 14:20:24 +00:00
2ae6be9af6 (num_teles, redir_fp, pipe_fp, exec_fd, sendeof, prompt, command)
(ac_intercept, all_missiles, ac_planedamage, ac_doflak, ac_landflak)
(ac_shipflak, ac_fireflak, can_fly, do_evade, att_calcodds)
(emp_setbitmap, lnd_hit_mine, conditions, get_wp, daemonize): Internal
linkage.
2006-05-20 13:54:45 +00:00
d906fd6b99 DEFENSE_INFRA was implemented in an odd way: sct_defense was used
regardless of the option, but forced to sct_effic when disabled.  This
screws up sct_defense when you disable DEFENSE_INFRA.  Implement it
more like FALLOUT: use sct_defense if enabled, else sct_effic.  The
change should be invisible except in xdump, which shows the real
sct_defense.  Closes #804641.
(SCT_DEFENSE): New.
(dump, sinfra, sector_strength): Use it.
(eff_bomb, build_bridge, build_tower, new, buildeff, sect_damage)
(put_combat, checksect, produce_sect): Don't force sct_defense to
sct_effic when DEFENSE_INFRA is disabled.
2006-05-20 11:53:20 +00:00
499e19f97b (improve): Fix unsafe use of opt_DEFENSE_INFRA as array subscript. 2006-05-20 11:04:00 +00:00
d5eee2175b (nati): Remove weird code to round max safe population that has no
effect unless your floating-point arithmetic is hopelessly broken.
This code appeared in Chainsaw 3.2 or so.  Also remove some redundant
casts.
2006-05-20 08:43:24 +00:00
6844c94b4a (natstr, add, getrejects, putreject): Simplify rejections storage.
The space savings of nibble storage are not worth the hassle,
especially for xdump.

(nat_ca): New selector rejects.
2006-05-18 18:43:38 +00:00
9e15c62d7d (powe): Simplify.
(gen_power): Remove redundant parenthesis.
2006-05-16 20:06:24 +00:00
5258e63b48 Fix rev. 1.31. 2006-05-16 19:54:33 +00:00
6e3b478377 (powe): Rewrite computation of targets[] for power c using
snxtitem()/nxtitem(), for simplicity and more uniform syntax.  Country
names no longer work when specifying more than one country (snxtitem()
restriction).  As usual with nxtitem(), silently ignore unsuitable
items (the old code complained and failed).  Don't skip powerless
countries for power c.  Closes #1025607.
(set_target): Unused, remove.
2006-05-16 18:59:19 +00:00
a50ae4a3d8 (effrange, torprange, fortrange): New.
(multifire, quiet_bigdef, torp, anti_torp, sd, sb)
(lnd_fort_interdiction, lnd_support, perform_mission, oprange)
(shp_fort_interdiction): Use them.  This fixes forts shooting below
FORTEFF in quiet_bigdef(), lnd_fort_interdiction() and
shp_fort_interdiction().  Change variables for rounded ranges to int.

(quiet_bigdef, sd): Don't scale ship firing range by efficiency.

(dd, sb): Simplify.

(sb): Internal linkage.

(perform_mission): Rename range2 to vrange.
2006-05-14 14:06:00 +00:00
5b4b3a13cb Break lines more tastefully. 2006-05-14 07:52:20 +00:00
fcc0162188 (nuke): Players need the uid to work with nukes, show it. Show
members introduced in nuke.h rev. 1.19 and 1.20: nuk_plane, nuk_effic,
nuk_tech, nuk_stockpile.  Make output similar to the other unit
reports while we're at it.
2006-05-13 15:30:30 +00:00
256025736c Remove unused variables. 2006-05-13 07:44:52 +00:00
0fd82cf1d7 (look_land): Use roundintby() instead of ldround() for int argument. 2006-05-13 07:43:59 +00:00
97be5018e2 (hap_req): New.
(nati, populace): Use it.

(populace, nati): Change hap, pct from float to double, because they
are used as double.

(nati): Print happiness needed with just two decimals, like the other
levels.
2006-05-06 11:07:35 +00:00
222847bb75 (fuel): Change extra from float to double, because its value is always
computed and used in double.
2006-05-06 09:02:03 +00:00
8646d6f6d0 (build_ship, build_land, build_plane): Compute initial efficiency in
double rather than float, because all its uses convert it to double.
Remove redundant casts.
2006-05-06 08:44:12 +00:00
276cbc54d2 (comm_bomb): Compute damage percentage in double rather than float,
because all its uses convert it to double.
2006-05-06 08:41:01 +00:00
f819e7ac85 Do not cast to float where default argument promotion obviously
converts the cast's result to double.  Such casts are ugly and may
lose precision.
2006-05-06 08:34:33 +00:00
7a99405942 Do not cast to float where usual arithmetic conversions obviously
convert the cast's result to double.  Such casts are ugly and may lose
precision.
2006-05-06 08:26:31 +00:00
802f69b039 (nukstr): Make it a struct genitem: add members nuk_effic, nuk_mobil,
nuk_tech, nuk_stockpile, nuk_opx, nuk_opy, nuk_mission, nuk_radius.
These have no effect, yet.
(build_nuke): Initialize them.
(nuke_ca): Add genitem selectors: effic, mobil, tech, group, opx, opy,
mission, radius.
(tran_nuke): Zap mission, just in case somebody invents missions for
nukes.
(trade_desc): Show tech and efficiency, for consistency with other
units.
2006-05-06 07:37:00 +00:00
2e40a4bb90 Change nuke storage and commands to match other units:
(nukstr): Hold one nuke instead of a stockpile: replace members nuk_n,
nuk_types by nuk_type, nuk_plane.  Add nuk_land for completeness, like
nuk_ship it's not yet used.
(nuke_ca): Update accordingly: replace selectors number and types by
type and plane.
(build_nuke): Update accordingly.
(ndump, nuke): Update accordingly.  Output is no longer sorted by
location, and nukes in same location no longer share id.  nuke's extra
columns for nuclear plants are repeated for every nuke.
(trade_desc): Update accordingly.
(cede, grab_sect, check_nuke_ok, detonate, trade_nameof): Talk about
nukes instead of nuclear stockpiles.
(arm, disarm): Rewrite, split off new disarm().  Don't remove nuke
from the nuke file on arm.  Allow usual plane syntax, not just plane
number.  Change second argument from nuke type to nuke number.  When
plane is already armed, ignore nuke argument and rearm (broken in
4.2.6).
(tran_nuke): Update for changed struct nukstr, make as similar as
possible to tran_plane.  Change syntax to match transport plane.
(player_coms): Update arm, disarm and transport accordingly.
(prnuke, nuk_on_plane): New.
(nuk_add, nuk_delete): Stockpile management, remove.
2006-05-06 07:20:21 +00:00
7ed308526c Remove redundant casts of argument to (prototyped) double parameter. 2006-05-01 12:34:16 +00:00
7c3899bf89 (starve): Prompted twice for sectors when first argument was empty,
fix.  Simplify.
2006-05-01 06:52:48 +00:00
e352801820 (fire_dchrg, fire_torp): Simplify. 2006-04-30 18:28:54 +00:00
e94c6e5a3e (gen_power): Simplify. 2006-04-30 18:25:50 +00:00
abc14df544 Reorder function definitions. 2006-04-30 16:35:43 +00:00
0e11700d12 (lload): Simplify. 2006-04-30 16:28:48 +00:00
6f4a630e9a (buil): Clarify. 2006-04-30 16:20:14 +00:00
470cd37056 (sate): Use ef_byname_from() for second argument. 2006-04-30 13:10:34 +00:00
8cb55944a3 (TERR_MAX): New.
(terr): Use it.

(terr): When the territory number is bad, do not loop prompting, just
fail.  That's what the vast majority of commands do.
2006-04-30 12:56:41 +00:00
f59fd6e8eb (retr, lretr): Readability fixes. 2006-04-30 12:52:30 +00:00
901499908c (bomb, drop, fly, para, reco): Simplify. 2006-04-30 12:48:21 +00:00
e28851b8e9 Normalize unsigned int to just unsigned. 2006-04-30 12:26:07 +00:00
e09e6e587b Normalize long int and short int to just long and short. 2006-04-30 12:05:23 +00:00
a358704096 (do_desi): Improve message when designation doesn't exist. 2006-04-30 11:56:01 +00:00
4e85ca6b30 (pr_ship, doship, pr_land, dounit): Remove keys deprecated in
rev. 1.20.

(prsect, doland): Deprecate key 'C'.

(pr_plane, doplane): Deprecate keys 'a' and 'd'.

(pr_land, dounit): Deprecate key 'X'.

(pr_ship, doship): Deprecate keys 'H', 'P', 'X' and 'Y'.

(docountry, dounit): Remove parameter farg.
2006-04-30 09:21:57 +00:00
8f998de170 Remove dead code. 2006-04-30 08:43:28 +00:00
b5c62f5c89 Fix long lines. No functional changes. 2006-04-30 08:39:20 +00:00
45ad6a8e71 (rea): Simplify. 2006-04-30 08:38:06 +00:00
b812435762 (lowerit): Simplify. 2006-04-30 08:37:06 +00:00
935d9b736f (grin): Simplify. 2006-04-30 08:36:41 +00:00
37b18621bc (dist): Simplify. 2006-04-30 08:34:05 +00:00
db407ec065 (best): Rename local variable. 2006-04-30 08:32:50 +00:00
0c8c169f88 (s_char): Remove. Use signed char for small integers, plain char for
characters.
2006-04-29 16:25:17 +00:00
0a3a73cf3d Recent s_char purge changed element types to s_char *, but missed
patterns malloc(N * sizeof(s_char *)), fix.
2006-04-29 16:14:48 +00:00
4cf7389ecd (cede_sect): Remove dead code. 2006-04-29 15:28:30 +00:00
3e42c03405 (fly): Use void * for generic pointer dst_ptr. 2006-04-29 15:27:48 +00:00