Use strict & warnings. Fix several minor bugs uncovered by it.
Semantics of assigning to $[ changed in Perl 5, and its use is `highly
discouraged'. Programs obviously assumed $[ affects all arrays, but
it doesn't in Perl 5. If these programs ever worked, then certainly
not with Perl 5. Remove the assignments and shift indexes
accordingly.
(guerrilla): Give wandering che inexact, somewhat randomized
information on military. Closes #750533. Why? Wandering che pick a
sector with minimal military from the adjacent sectors that can get
che. Ties are broken in favour of the first sector examined. Since
sectors are examined in the order given by by diroff[], che prefer
directions with low index in diroff[]. This tends to channel che
towards the northeast. But the change makes ties very unlikely.
(lnd_sweep, lnd_mar_one_sector): Automatic fortification on excess
mobility may fortify units while they are `at the march prompt'.
That's okay. But action that consumes mobility must zap the
fortification again.
(do_mob_land): Use excess mobility to fortify. Note that units
requiring fuel to gain mobility never get excess mobility. Adapted
patch from from Marc Olzheim. Closes #725457.
(player_new): Proper error checking. Oops, now it may return NULL.
Proper error checking in callers required.
(update_wait, market_update): If player_new() returns null pointer,
skip update.
(player_accept): If player_new() returns null pointer, close
connection.
(io_select, io_init, io_open, io_close, io_output, io_flush, io_write,
io_puts, iom_create, iom_getmask, iom_set, iom_clear, iom_zero):
Portability bug: io_select() passed bit_fdmask to select(). This
breaks the fd_set abstraction, and works only with the traditional
Unix implementation of fd_set. Use fd_set and its operations instead.
Remove unused source files. Note: the offending code is currently
unsued. But it's a time bomb, and fixing it also replaces a bunch of
code by standard library services.
(main): Portability bug: code passed bit_fdmask to select(). This
breaks the fd_set abstraction, and works only with the traditional
Unix implementation of fd_set. Use fd_set and its operations instead.
Remove unused source files.
(player_coms, lstats, lsta): Rename command `lstats' to `lstat' to
match info as well as related commands `sstat' and `pstat'. Rename
lstats() to lsta() to uphold the convention that functions
implementing commands are named like the command or its four character
prefix. Closes #804587.
(player_coms, best): `bestdistpath' and `bestpath' violate the rule
that commands must be unique within the first four letters. best()
implements both. It calls BestDistPath() for the former, and
BestLandPath() for the latter. However, BestDistPath() is just a
wrapper around BestLandPath(); it does exactly the same. Drop
`bestdistpath'.
(bzero, bcopy): Obsolete BSDisms; remove. Remove some calls without
effect. Replace calls by struct assignment where possible. Replace
clear buffer, copy string to buffer by strncpy(). Use assignment to
clear when that's clearer. Replace overlapping copy through bounce
buffer by memmove(). Replace rest by standard memset() and memcpy().
Also use sizeof() instead of literal array sizes for robustness, and
instead of symbolic array sizes for clarity.
(login): Fix reading of country name and, if we lack getpass(),
password. Used to strip \r from country name (superflous), and not to
strip \n from password (required).
(edit, prsect, doland): Fix `editing' sector coordinates (copies
sector). New: edit distribution sector, designation and new
designation. From Ron Koenderink.
Remove pragmas that promote certain serious warnings to errors on
windows. For obvious reasons, such warnings ought to be fixed.
Making compilation abort is the sledgehammer method to force that.
It's a stupid method for us, as we develop on various platforms, and
don't test every single commit under Windows. It gratuitously breaks
programs that work fine. Leave them as warnings, and fix them on
sight.
(edit): Rewrite of undocumented and broken feature: if there are extra
arguments, they are interpreted as key-value pairs, and edit does not
prompt for more. From Ron Koenderink.
(player_coms): Document extended syntax.
(decl): Remove broken and redundant check of declarer's country
number. Check is redundant, because invalid values can come only from
natarg(), and those are checked above. Check is broken because
natarg() returns negative value on error, not 255.
Makefiles worked only if certain directories and generated files were
already present. Source distributions had them, but we didn't commit
them to CVS. Fix Makefiles.