(drop, fly): Fix previous rev. not to prohibit flying civilians to an
ally. Since you can load them onto their ships, you should be able to
fly them over.
(pln_mine, pln_dropoff): Split off aerial mining into new pln_mine().
Callers changed.
(drop): Do not disclose anything about target sector before planes
actually got there, unless the target sector is owned by the player or
an ally. This plugs a major loophole. Consequently, the command can
no longer always refuse to attempt to drop stuff where it won't work.
Instead, the planes fly out to try. Other plane commands (para, bomb)
behave exactly the same. Also closes #909859.
(pln_dropoff): Cope with planes trying to drop where they can't.
(drop): Refuse to drop civilians into allied sectors, for consistency
with other means to move around stuff.
(pln_oneway_to_carrier_ok): New.
(fly, reco): Use it to prevent flying to a carrier that doesn't have
space for the planes. Previously, planes that did this were
teleported home, which could be abused.
(fly): Fail if pln_sel() comes up empty, just like the other commands
to fly planes.
(bomb): Don't tell the player that target is a sanctuary before his
planes got there. This closes a loophole that allowed players with
any planes to find all sanctuaries.
(move, explore): Return early when interdiction destroys everything
moved. Without that, loyalty computation divided by zero and crashed
when moving civilians to a sector without civilians. Found and
debugged by Jeff Cotter. Closes #1005005.
(gamedown): Printed down message with pr(), as a printf()-like format
string! This reads and formats junk from the stack when message
contains '%', and can even crash. Use prnf() instead. Catched by Ron
Koenderink.
(infect_people): Use max_pop() to compute space. This makes all
crowded sectors equally vulnerable, including mountains, plains, and
inefficient big cities. Closes #917488.
Update info.
(show_motd): Printed motd with pr(), as a printf()-like format string!
This reads and formats junk from the stack when motd contains '%', and
can even crash. Use prnf() instead.
(sarg_xy, sarg_getrange, sarg_range, sarg_list): These choke on
trailing junk since the previous rev. That's too strict. Silently
ignore trailing junk as long as it starts with whitespace. That's
somewhat lax, but will do for now. Closes #982018.
(nstr_comp_val): Since rev. 1.10, selectors were always preferred to
type literals, unless type inference rejects the selector. This
doesn't work for NSC_TYPE selectors: `?des=n' is interpreted as
`?des=newdes'. Prefer type literal to NSC_TYPE selector. Closes
#982021.
Marc Olzheim [Sun, 20 Jun 2004 17:58:10 +0000 (17:58 +0000)]
Now that src/scripts/nightly/patches/All/prng.patch:1.5 makes sure that
all randomness is predictable and repeatable, we're ready for some
real scripts.
Marc Olzheim [Sun, 20 Jun 2004 16:36:51 +0000 (16:36 +0000)]
Make it possible to skip steps of the build by specifying so in the
environment variable "NIGHTLY_SKIP_STEP", making it easier to debug
problems in the build.
Marc Olzheim [Sun, 20 Jun 2004 15:30:41 +0000 (15:30 +0000)]
Instead of patching Make.sysdefs, introduce emp_{,s}random() and patch
all files to use it. Output from the nightly build machines should
now be the same for the different platforms.
Marc Olzheim [Sat, 19 Jun 2004 13:54:49 +0000 (13:54 +0000)]
Make sure that the same prng is used on all systems, namely *rand48().
For now, only fairland.c is "fixed". We'll have to patch the random
calls in the server to use the RANDOM and SRANDOM macros to make
things completely reproducible.
New, more comprehensive guidelines. Compiled existing Empire
practice, rounded off with classical C usage, edited into a readable
form. Work in progress.
(shp_set_tech, pln_set_tech, lnd_set_tech): New, factored out of build
and upgrade code.
(build_ship, build_plane, build_land, supgr, pupgr, lupgr): Use them.
Upgrading planes no longer sets plane range to maximum.
(pupgr): Just clear the mission, don't bother to clear op area.
(doship, doplane, dounit): Editing tech now updates stats, like an
upgrade command. Proper range checking.
(warn_deprecated): New.
(pr_ship, doship): Deprecate key 'D'.
(pr_land, dounit): Deprecate key 'A' and 'D'.
(explore): Clear start sector's MOVE_IN_PROGRESS after updating end
sector. Otherwise, clearing MOVE_IN_PROGRESS can abandon the start
sector when it shouldn't, leading to bogus records in the `lost' file.
Closes #931184.
(dship, dounit, doplane): No longer accept efficiency values that
would destroy the edited unit. Deities can still delete a units by
setting the owner to zero. Efficiency values less than 10 used to
delete the unit without informing the owner. Ship efficiency values
between 10 and 20 did inform the owner, but didn't give him any clue
about the reason.
(do_feed): Rev. 1.4 accidentally limited avail after rollover to 999,
even when option ROLLOVER_AVAIL was off. Previous revision correctly
limits rollover to rollover_avail_max, but missed the limiting after
rollover. Fix.
(line_of_sight): Normalize coordinates before indexing. Closes
#950514.
(line_of_sight): There's just one straight line between two points on
a plane, but on a torus there are four. Code assumed plane, and thus
could screw up near the origin. Pick a shortest line of the four.
Partial fix for #950510.
(buy, mark, display_mark): Move argument evaluation from
display_mark() to callers. buy() no longer accepts "all". It used to
display all lots, but didn't let you buy any. Similar nonsense
happened for "" if buy() prompted for it.
(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.
(build_ship, orde, qorde, nav_loadship, load_it, unload_it): Store
item types instead of mnemo characters in shpstr members shp_tstart[]
and shp_tend[].
(com_num): No longer used, remove.
(strtox, strtoy): New. Use it instead of inputxy() to avoid the
double-remainder problem: x-coordinate SHRT_MAX+1 is truncated to 0 by
cast to coord, then converted by xabs(). This is wrong unless WORLD_X
divides SHRT_MAX+1.
(sarg_xy, sarg_getrange, sarg_range): Use them.
(inputxy): No longer used, remove.
(sarg_type): Use NS_UNDEF instead of 0.
(sarg_list): Change confusing loop control. Properly diagnose
overlong lists; used to silently ignore list tail and return MAX+1,
which made a later snxtitem_list() fail.
(atoip): No longer used, remove. Parsing was broken anyway.
(sarg_type, sarg_xy, sarg_area, sarg_range, sarg_list, sarg_getrange):
Use plain char * instead of s_char *.
(snxtitem): Assigning NS_UNDEF to NP->type is an application domain
type error not reflected in C. The former is a selection type, the
latter is a file type. Harmless, as the variable is overwritten on
all paths to successful return.
(getminleft): Parameter hours unused since the previous rev., remove.
Change parameter mpd from int * to int, because its only use is *mpd
as r-value. Callers changed.
(kw_read, kw_find, kwtab, kw_list): Were used to evaluate the hours
file until 4.2.7. Since then kw_read() is unused, and kw_find()
always returns NULL. Remove. kw_find() callers changed.
Selector rewrite: values other than long, interpret identifiers
according to context, to make `lstat * ?type#spy&spy>1' work. Closes
bug#825363, #905809, #905814 and #922968.
(nsc_type, packed_nsc_type, nsc_cat, packed_nsc_cat, nsc_flags): New.
(valstr): New. Old code encoded values in type long, which was
somewhat hard to read and could only support signed integer values.
(nscstr): Redesign. Use valstr. Typed operator.
(castr): Split ca_code into ca_type, ca_flags, ca_off. Tables
changed.
(nstr_comp, nstr_exec): Redesign and rewrite. Callers changed. They
used the old design incorrectly, which let players smash the stack
by supplying more than NCOND conditions.
(encode, nstr_comp_val, decode, nstr_exec_val): Rename, redesign, and
rewrite. Callers changed.
(nstr_coerce_val): New.
(var_ca, sect_ca, ship_ca, land_ca): Checking both var_ca[] and the
object's ca complicates proper recognition of unique abbreviations.
Copy contents of var_ca[] into the ca of objects, remove var_ca[].
(surv): Reject values with category other than NSC_OFF and types that
can't be coerced to NSC_LONG. Old code happily passed values with
category NSC_VAL to code_char(). The previous version interpreted
them correctly, but earlier versions interpreted them as NSC_OFF, then
logged `bad type in decode: 0' and evaluated them into zero.
(code_char): Used to test category NSC_VAR to decide whether to
display tens or hundreds. NSC_VAR no longer exists. Test type
instead. Makes more sense anyway.
(RANDOM, SRANDOM): New, to allow overriding the PRNG on the compiler
command line for reproducible automated tests. This is expected to be
a temporary solution until we get more capable system configuration.
Callers of random(), srandom() changed. From Marc Olzheim.