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.
(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.
(nsc_type): New member NSC_HIDDEN.
(meta_type): Add its entry.
(setnum, nstr_promote, nstr_exec_val): Deal with it. nstr_exec_val()
implements opt_HIDDEN by mapping unknown values to -1.
(natstr, nat_ca): Use it for member nat_relate. This also halves its
size. Fixes very minor leak: before, player could see relations to
all countries, regardless of contact.
(nation_relations): Add entry for -1.
(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.
(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.
(detonate): Change parameters from carrying plane to nuke and
airburst. Leave taking nuke off the plane to caller. Use coord for
coordinate parameters.
(pln_damage): Take nuke off the plane.
(detonate): Destroy the nuke. This is required since arming doesn't
remove nukes from the nuke file anymore (arm.c rev. 1.15).
(nuk_postread): Update nuke location to match that of the plane
carrying it. This is required since arming doesn't remove nukes from
the nuke file anymore (arm.c rev. 1.15).
(nuk_prewrite): Properly destroy nuke. This is required since nuke
file contains individual nukes instead of stockpiles (nuke.h
rev. 1.19).
(pln_prewrite): Destroy nuke along with the plane carrying it. This
is required since arming doesn't remove nukes from the nuke file
anymore (arm.c rev. 1.15).
(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.
(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.
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.
Don't wrap global variables in a struct for no reason:
(LwpMaxfd, LwpNfds, LwpReadfds, LwpWritefds, LwpFdwait, LwpDelayq)
(LwpSelProc): New, matching members of LwpSelect, internal linkage.
(lwpSelect, LwpSelect): Remove.
(guerrilla): Round security unit raid value below one to zero instead
of one. Before, an empty, inefficient unit could be used to kill one
rebel per update.