(ANNO_KEEP_DAYS, anno_keep_days): Replace macro ANNO_KEEP_DAYS by
new configuration key. Closes #780425.
(delete_old_announcements): Do nothing when anno_keep_days is
negative.
(trad, set): Treat trade file slots with zero owner as unused, so that
freshly extended trade file makes sense. When set() removes a lot,
simply zero the slot.
(set): Initialize trd_uid.
(trade_check_ok): Use check_land_ok() & friends instead of doing it by
hand, but wrong. This fixes bying planes and land units loaded on
ships that moved after loading.
(check_trade_ok): New.
(trade_check_ok): Use it. Remove unused argument lot. Callers
changed.
Ron Koenderink [Sat, 28 Aug 2004 13:52:20 +0000 (13:52 +0000)]
(show_land_build, show_plane_build): Adjust the position of the $ column to match
'show ship b'. Adjust the crew column (show_plane_build) and the adjacent columns
to be right-justified.
(min_to_next_daytime): Happily returned zero if DTIME happend to be in
TIMES. This can make callers fire another update right away, possibly
several times. Observed for update policy UDP_TIMES while updates
were disabled, which makes them complete in much less than a second.
Fills up server.log real fast. Fix to consider DTIME tomorrow.
(IPKG): New.
(ichr): Set IPKG packing bonus for all sectors to 1.
(move): Use it. No functional change.
(deliver, dodistribute): Use it. Inefficient sectors now get IPKG
instead of NPKG packing bonus, cutting civilian packing bonus from 10
to 1.
(dodistribute): Export uses the better of sector or distribution
center packing bonus. Previously, it assumed that distribution center
WPKG packing is always best. Which is currently true, but needlessly
breaks the abstraction.
(NSC_EXTRA): New.
(sect_ca, NSC_GENITEM, plane_ca, land_ca): Use it for aliases and
cached functions of tech.
(xdflds, xdfldnam): Skip NSC_EXTRA fields.
Ron Koenderink [Sat, 21 Aug 2004 00:44:20 +0000 (00:44 +0000)]
(delete_old_announcements, copy_and_expire): Split off
copy_and_expire() to simplify cleanup. Previously, cleanup was
missing or incomplete on many less common code paths, which leaked
file descriptors and memory, and could corrupt the anno file. Use
stdio instead of POSIX I/O for writing. Check for I/O errors
properly. Treat bad telegram type just like bad telegram length (give
up). Closes #1013234.
(valstr): Replace member val_as.off by val_as.sym, which contains
offset and index. This is for the new dumps; conditions can't use it,
yet.
(nstr_comp_val): Zero index.
(nstr_exec_val): Implement index.
(coll, fina, repa, shark, disloan): Fix calculation of regular and
extended (beyond due date) loan time. At the due date, or after a
last payment made at the due date, durations were zero in fina() and
unpredictable elsewhere. With luck, debtors could abuse this to repay
loans cheap (they couldn't gain cash, though), sharks to purchase
loans cheap, and creditors to collect excessively.
(PRI_SMAINT, PRI_PMAINT, PRI_LMAINT, PRI_SBUILD, PRI_PBUILD,
PRI_LBUILD): Turn macros into enumeration constants. Value
SCT_MAXDEF+1 was previously unused; use it.
(PRI_MAX): New; replacing the horrible SCT_MAXDEF+8.
(show_sect_build): Simply examine all sector types, don't skip the
first five. The code ignores them just fine.
(show_sect_build, show_sect_stats, show_sect_capab): Don't try to show
sector types beyond SCT_MAXDEF. The table has some empty extra slots,
for whatever reasons; no use examining them.
(pln_onewaymission, carriersatxy): Change to match ordinary sorties:
offer carriers regardless of the sector they're in, require carriers
to be efficient. Closes #875376.
(show_sect_capab, V_ITEM): The difference between variable and
item types was removed some time ago. Simplify.
(VT_ITEM, VT_TYPE, V_MAX): Unused, remove.
(show_sect_capab): Properly use ichr[] member i_mnem to print item
characters.
(pchrstr, MAXPRCON): Simplify variable-style storage of constituents.
Store only up to MAXPRCON constituents, not MAXCHRNV; code doesn't
fully support more than three anyway. Remove member p_nv, use item
type I_NONE for unused slots. Rename members p_vtype, p_vamt to
p_ctype, p_camt to avoid confusion with variable-style storage.
(pchr): Initializers adapted.
(nullify_objects, materials_cost, materials_charge, prod,
show_sect_capab, grind): Adapt, simplify where possible, protect
against bad item types in pchr[].
(MAXCHRNV): Unused, remove.
(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.
Ron Koenderink [Tue, 17 Aug 2004 13:17:50 +0000 (13:17 +0000)]
(prod_eff): New, factored out of produce() and prod().
(upd_ship): Oil and food production used special rules that didn't
match ordinary production and didn't make much sense. Made them
follow ordinary production rules. This puts uw and mil to work, and
makes ship tech and efficiency relevant to production. Closes #917461
and #955072.
(lchr, pchr): Initializers depended on ETUS instead of etu_per_update.
ETUS is just the default for etu_per_update. Deities don't change
ETUS, they change etu_per_update by editing econfig. This nonsense
dates back at least to chainsaw 3.31, where it was just as broken as
now. Replace ETUS by 60 and simplify.
Ron Koenderink [Tue, 17 Aug 2004 02:31:10 +0000 (02:31 +0000)]
(prod_eff): New, factored out of produce() and prod().
(upd_ship): Oil and food production used special rules that didn't
match ordinary production and didn't make much sense. Made them
follow ordinary production rules. This puts uw and mil to work, and
makes ship tech and efficiency relevant to production. Closes #917461
and #955072.
(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.