]> git.pond.sub.org Git - empserver/log
empserver
14 years agoUpdate change log for 4.3.22 v4.3.22
Markus Armbruster [Sat, 25 Apr 2009 08:12:56 +0000 (10:12 +0200)]
Update change log for 4.3.22

14 years agoFix autoconfiguration of libraries
Markus Armbruster [Sat, 25 Apr 2009 10:18:32 +0000 (12:18 +0200)]
Fix autoconfiguration of libraries

configure checked for library functions with LIBS instead of
LIBS_server, which could break detection of getaddrinfo() on systems
where LIB_SOCKET isn't empty.

GNUmakefile put @PTHREAD_LIBS@ only in LDLIBS, which breaks linking of
server and possibly client on systems where it is not empty.

Broken in commit 8b778634.

14 years agoRename m4/my_termlib.m4 to m4/my_terminfo.m4
Markus Armbruster [Sat, 25 Apr 2009 08:27:01 +0000 (10:27 +0200)]
Rename m4/my_termlib.m4 to m4/my_terminfo.m4

14 years agoRemove useless memset() before free()
Markus Armbruster [Sat, 25 Apr 2009 08:00:06 +0000 (10:00 +0200)]
Remove useless memset() before free()

14 years agoFix misuse of CreateThread() in Windows client
Markus Armbruster [Sat, 25 Apr 2009 07:59:36 +0000 (09:59 +0200)]
Fix misuse of CreateThread() in Windows client

We use the C run-time, so we better use its _beginthread(), too.
CreateThread() can lead to deadlocks, at least with some versions of
the C run-time.  Broken in commit f082ef9f, v4.3.11.

14 years agoFix Windows client's stdin read thread's error handling
Markus Armbruster [Sat, 25 Apr 2009 07:43:48 +0000 (09:43 +0200)]
Fix Windows client's stdin read thread's error handling

stdin_read_thread() zeroed bounce_status on failure, effectifely
treating it like EOF.  Fix by setting to -1.

It treated main thread termination like failure, and set bounce_error
to a bogus value.  Can't happen, because the program terminates when
the main thread terminates, and the only user of bounce_error is the
main thread anyway.  Regardless, handle the case by terminating,
because that's more obviously correct.

Broken in commit f082ef9f, v4.3.11.

14 years agoFix generation of src/client/aclocal.m4
Markus Armbruster [Sat, 25 Apr 2009 06:52:47 +0000 (08:52 +0200)]
Fix generation of src/client/aclocal.m4

Revert commit c3d2786f, because the resulting aclocal.m4 includes
stuff from outside the standalone build.  Generate with cat instead.

14 years agoFix ersatz_getpass() to use its parameter
Markus Armbruster [Sat, 25 Apr 2009 06:30:10 +0000 (08:30 +0200)]
Fix ersatz_getpass() to use its parameter

It used its only actual argument instead.

15 years agoMake Windows client read password without echo again
Markus Armbruster [Thu, 23 Apr 2009 18:38:15 +0000 (20:38 +0200)]
Make Windows client read password without echo again

Commit 8c3b8d10 replaced the getpass() for Windows by a generic
ersatz_getpass().  This lost the "switch off echo" feature, with the
excuse that it doesn't work for me (MinGW & Wine).  Turns out it works
under real Windows.  Restore the feature.

15 years agoMake savecore put $PWD in the mail subject
Markus Armbruster [Thu, 23 Apr 2009 18:32:42 +0000 (20:32 +0200)]
Make savecore put $PWD in the mail subject

Useful when you monitor multiple games.

15 years agoAdd includes to make headers self-contained
Markus Armbruster [Tue, 21 Apr 2009 17:30:42 +0000 (19:30 +0200)]
Add includes to make headers self-contained

15 years agoMake configure print a configuration summary
Markus Armbruster [Sun, 19 Apr 2009 13:47:40 +0000 (15:47 +0200)]
Make configure print a configuration summary

15 years agoAutoconfigure use of terminfo
Markus Armbruster [Sun, 19 Apr 2009 13:42:19 +0000 (15:42 +0200)]
Autoconfigure use of terminfo

New configure --with-terminfo.  Before, terminfo was assumed to be
available everywhere but on Windows.

15 years agoDeclare getsose() & friends in one place
Markus Armbruster [Sat, 18 Apr 2009 21:47:02 +0000 (23:47 +0200)]
Declare getsose() & friends in one place

15 years agoRebase strptime.c to fix license incompatibility
Markus Armbruster [Sat, 18 Apr 2009 20:03:39 +0000 (22:03 +0200)]
Rebase strptime.c to fix license incompatibility

The old upstream version carries the original BSD license, which is
incompatible with the GPL.  Fix by rebasing to a version that is
licensed under the 2-clause BSD license.

15 years agoTrim a bogus make dependency in standalone client build
Markus Armbruster [Sat, 18 Apr 2009 17:08:03 +0000 (19:08 +0200)]
Trim a bogus make dependency in standalone client build

It got added in commit f082ef9f.

15 years agoReally, really fix bomb not to wipe out plane updates
Markus Armbruster [Sat, 18 Apr 2009 12:41:24 +0000 (14:41 +0200)]
Really, really fix bomb not to wipe out plane updates

Commit 82b5e3c2 missed escorts.

15 years agoFix tend land not to wipe out concurrent updates
Markus Armbruster [Sat, 18 Apr 2009 06:41:28 +0000 (08:41 +0200)]
Fix tend land not to wipe out concurrent updates

Fix tend_land() to bail out if the tender changed while tend_land()
slept for the last argument (receiving ship).

15 years agoFix return value of s_commod() when it can't draw enough
Markus Armbruster [Thu, 16 Apr 2009 11:06:32 +0000 (13:06 +0200)]
Fix return value of s_commod() when it can't draw enough

s_commod() could incorrectly claim success when the sink ended up with
at least as many supplies than were missing initially.  This caused a
number of problems:

* shp_torp() let a ship with two shells fire a torpedo, resulting in
  -1 shells, which then made item_prewrite() oops.  Affected missions
  and return fire, but not the torpedo command.

* shp_missile_defense() let a ship with one shell use missile defense,
  resulting in -1 shells, and the same item_prewrite() oops.

* Land units were considered in supply even when they had not quite
  enough supplies.  Such land units could defend without penalty,
  attack and react.  Commands load and lload weren't affected, because
  they use lnd_in_supply(), which doesn't use s_commod().

Broken in 98f24d5c, v4.3.20.

15 years agoFix update to take dead units off carriers
Markus Armbruster [Wed, 15 Apr 2009 21:06:54 +0000 (23:06 +0200)]
Fix update to take dead units off carriers

upd_plane() upd_land() and left planes and land units lost to lack of
maintenance on their carriers.  Cargo lists were fine anyway, because
unit_cargo_init() ignored dead units.  But when the dead unit got
reused for building a new one, pln_prewrite() / lnd_prewrite() got
confused and attempted to take it off its carrier, which made
clink_rem() oops, because the unit wasn't on the cargo list.  No real
harm done, as oops recovery was fine.

Fix upd_plane() and upd_land() to clear the carrier.  Make
unit_cargo_init() oops when it finds dead units on carriers.

15 years agoRun git describe in nightlybuild.sh to identify what's built
Markus Armbruster [Wed, 15 Apr 2009 20:12:44 +0000 (22:12 +0200)]
Run git describe in nightlybuild.sh to identify what's built

15 years agoClean up autoconfiguration of libraries
Markus Armbruster [Sun, 12 Apr 2009 17:11:58 +0000 (19:11 +0200)]
Clean up autoconfiguration of libraries

Make configure compute three sets of libraries: LIBS_client for the
client, LIBS_server for the server, and LIBS for the rest.  This
replaces termlibs.

Unfortunately, LIBS doesn't work with Windows, because
src/lib/w32/posixio.c pulls in socket stuff.  Temporary workaround:
use LIBS_server instead.

15 years agoStandalone client build for Windows made empire without .exe
Markus Armbruster [Sun, 12 Apr 2009 17:10:29 +0000 (19:10 +0200)]
Standalone client build for Windows made empire without .exe

15 years agoDefine WIN32_LEAN_AND_MEAN for Windows
Markus Armbruster [Sun, 12 Apr 2009 17:07:30 +0000 (19:07 +0200)]
Define WIN32_LEAN_AND_MEAN for Windows

15 years agoSimplify autoconfiguration for Windows
Markus Armbruster [Sun, 12 Apr 2009 17:00:55 +0000 (19:00 +0200)]
Simplify autoconfiguration for Windows

Checking Windows libraries with autoconf is cumbersome, because
linking often fails unless you include the header, and AC_SEARCH_LIBS
doesn't permit that.

Just detect the Windows API instead, with new MY_WINDOWS_API.

15 years agoRemake src/client/aclocal.m4 with aclocal instead of cp
Markus Armbruster [Sun, 12 Apr 2009 16:32:24 +0000 (18:32 +0200)]
Remake src/client/aclocal.m4 with aclocal instead of cp

15 years agoFix client to abort script execution on SIGINT
Markus Armbruster [Sat, 11 Apr 2009 20:52:52 +0000 (22:52 +0200)]
Fix client to abort script execution on SIGINT

15 years agoFix Windows client for EOF on stdin
Markus Armbruster [Sat, 11 Apr 2009 15:56:21 +0000 (17:56 +0200)]
Fix Windows client for EOF on stdin

stdin_read_thread() went into a tight loop on EOF.  Observed with
Wine.  Broken in commit f082ef9f, v4.3.11.

15 years agoInclude stdlib.h unconditionally, for simplicity
Markus Armbruster [Fri, 10 Apr 2009 13:08:40 +0000 (15:08 +0200)]
Include stdlib.h unconditionally, for simplicity

15 years agoUse sys/select.h for select()
Markus Armbruster [Fri, 10 Apr 2009 13:07:19 +0000 (15:07 +0200)]
Use sys/select.h for select()

Should be more portable to modern systems and could be less portable
to obsolete systems than the traditional sys/time.h sys/types.h
unistd.h incantation.

15 years agoReplace missing getpass()
Markus Armbruster [Fri, 10 Apr 2009 12:57:13 +0000 (14:57 +0200)]
Replace missing getpass()

getpass() is traditional Unix, but has been withdrawn from POSIX.  As
such, it may be missing.  Check for that, and provide ersatz.  It's
not a real replacement, because it doesn't do the special magic
getpass() is supposed to do: read from /dev/tty without echo.

This bypasses our existing getpass() for Windows.  In contrast to the
portable getpass(), the Windows one tries to turn off echo, but that
doesn't work for me (MinGW & Wine).  Remove it.

15 years agoBelatedly update make dependencies for standalone client build
Markus Armbruster [Fri, 10 Apr 2009 08:17:17 +0000 (10:17 +0200)]
Belatedly update make dependencies for standalone client build

expect.$O was out of date since commit c9c9305c.

ringbuf.$O and sysdep_w32.$O were out of date since commit f082ef9f.

15 years agoFix documentation not to refer to client as emp_client
Markus Armbruster [Sun, 5 Apr 2009 09:34:57 +0000 (11:34 +0200)]
Fix documentation not to refer to client as emp_client

15 years agoFix client not to hang when EOF on stdin overtakes C_EXECUTE
Markus Armbruster [Sun, 5 Apr 2009 08:58:30 +0000 (10:58 +0200)]
Fix client not to hang when EOF on stdin overtakes C_EXECUTE

Player input may overtake batch file contents (well-known protocol
flaw, see doc/clients-howto for details).  This includes EOF.  When
that happens, the client closes standard input, sends an EOF cookie,
and continues reading output until the server closes the connection.
When it gets C_EXECUTE, it redirects input to the batch file.  But it
then failed to read the batch file.  The server waited forever for the
execute's EOF cookie, the client waited forever for the server closing
the connection.

Fix by stopping only reading from standard input.  Broken in 8b7d0b91,
v4.3.11.

Note that the EOF cookie still overtakes the batch file contents,
which makes the server interpret the input between the execute command
and the EOF as batch file, and the batch file contents as ordinary
input.

15 years agoBelatedly document batch file restrictions
Markus Armbruster [Sun, 5 Apr 2009 08:55:46 +0000 (10:55 +0200)]
Belatedly document batch file restrictions

The server rejects redirections in batch files since commit ed8e0cd5,
and execute commands since commit adfab434, both v4.3.11.

15 years agoRemove dead EASY_BRIDGES code from bridgefall()
Markus Armbruster [Sun, 29 Mar 2009 17:18:10 +0000 (19:18 +0200)]
Remove dead EASY_BRIDGES code from bridgefall()

Dead since commit 40eb78eb, v4.3.12.

15 years agoSimplify build_tower() a bit
Markus Armbruster [Sun, 29 Mar 2009 15:48:06 +0000 (17:48 +0200)]
Simplify build_tower() a bit

No functional change.

15 years agoFix info build, mine, navigate, sweep on mines
Markus Armbruster [Sun, 29 Mar 2009 15:20:41 +0000 (17:20 +0200)]
Fix info build, mine, navigate, sweep on mines

15 years agoChange mine command not to work under bridges for now
Markus Armbruster [Sun, 29 Mar 2009 15:16:48 +0000 (17:16 +0200)]
Change mine command not to work under bridges for now

This is for consistency with aerial mining.  Seamines don't work under
bridges anyway (they did a long time ago, until Empire 2).

Making seamines work under bridges again wouldn't be hard, but it
would make the 'X' in bmaps ambiguous.

15 years agoSimplify retreat_ship1() and retreat_land1() slightly
Markus Armbruster [Sun, 29 Mar 2009 13:25:17 +0000 (15:25 +0200)]
Simplify retreat_ship1() and retreat_land1() slightly

No functional change.

15 years agoFix confusion of landmines with seamines
Markus Armbruster [Sun, 29 Mar 2009 13:03:44 +0000 (15:03 +0200)]
Fix confusion of landmines with seamines

Seamines and landmines share storage.  Sea and bridge span sectors can
hold only sea mines, other sector types only landmines.  Sector type
checks were missing or incorrect in several places:

* Seamines under bridge spans were mistaken for landmines in several
  places:

  - ground combat mine defense bonus, in get_mine_dsupport() and
    stre(),

  - land units retreating from bombs, in retreat_land1(),

  - non-land unit ground movement (commands explore, move, transport,
    and INTERDICT_ATT of military), in check_lmines(),

  Fix them to check the sector type with new SCT_MINES_ARE_SEAMINES(),
  SCT_LANDMINES().

* plane_sweep() mistook landmines for seamines in harbors.  Bug could
  not bite, because it's only called for sea sectors.  Drop the bogus
  check for harbor.

* Collapsing a bridge tower magically converted landmines into
  seamines.  Make knockdown() clear landmines.

Also use SCT_MINES_ARE_SEAMINES() and SCT_LANDMINES() in mine(),
landmine(), lnd_sweep() and lnd_check_mines().  No functional change
there.

Keep checking only for sea in pln_mine(), plane_sweep(),
retreat_ship1(), shp_sweep() and shp_check_one_mines().  This means
seamines continue not to work under bridges.  Making them work there
is tempting, but as long as finding seamines clobbers the sector
designation in the bmap, it's better to have them in sea sectors only.

Historical notes:

Mines started out simple enough: you could mine sea and bridge spans,
and ships hit and swept mines in foreign sectors.

Chainsaw 2 introduced aerial mining and sweeping.  Unlike ships,
planes could not mine bridge spans.  plane_sweep() could sweep
harbors, which was wrong, but it was never called there, so the bug
could not bite.

Chainsaw 3 introduced landmines.  The idea was to permit only seamines
in some sector types, and only landmines in the others, so they can
share storage.  To figure out whether a sector has a particular kind
of mines, you need to check the sector type.  Such checks already
existed in mine, drop and sweep, and they were kept unchanged.  The
new lmine command also got the check.  Everything else did not.
Ground movement and combat could hit and sweep seamines in bridge
spans.  Ships could hit and sweep landmines in harbors.

Empire 2 fixed land unit movement (march, INTERDICT_ATT) not to
mistake seamines for landmines on bridge spans.  It fixed ships not to
mistake landmines for seamines.  The fix also neutered seamines under
bridge spans: ships could neither hit nor sweep them anymore.  Both
fixes missed retreat.

Commit 5663713b (v4.3.1) made ship retreat consistent with other ship
movement.

15 years agoClean up useless declarations
Markus Armbruster [Sat, 28 Mar 2009 12:03:57 +0000 (13:03 +0100)]
Clean up useless declarations

Commit fbf9f15b removed SO, SE, but left their declarations behind.
Ditto commit 3aea20e1 for bigcity_dchr, and commit 08b94556 for
player_kill_idle.

Commit afa65c8f accidentally added a declaration for xedit().

15 years agoDon't use 0 as null pointer constant, part 3
Markus Armbruster [Mon, 23 Mar 2009 21:58:54 +0000 (22:58 +0100)]
Don't use 0 as null pointer constant, part 3

This part replaces E == 0 by !E, where E has pointer type.

15 years agoDon't use 0 as null pointer constant, part 2
Markus Armbruster [Mon, 23 Mar 2009 19:17:44 +0000 (20:17 +0100)]
Don't use 0 as null pointer constant, part 2

This part replaces E != 0 by E, where E has pointer type.

15 years agoDon't use 0 as null pointer constant, part 1
Markus Armbruster [Sun, 22 Mar 2009 17:50:43 +0000 (18:50 +0100)]
Don't use 0 as null pointer constant, part 1

Use NULL instead of 0, for clarity.  Except in pointer comparisons;
leave that to the next two commits.

15 years agoClean up more unreadable assignments within if conditionals
Markus Armbruster [Mon, 23 Mar 2009 21:43:52 +0000 (22:43 +0100)]
Clean up more unreadable assignments within if conditionals

15 years agoSimplify explain()
Markus Armbruster [Mon, 23 Mar 2009 19:15:31 +0000 (20:15 +0100)]
Simplify explain()

No functional change.

15 years agoClean up non-ANSI definition of ef_verify()
Markus Armbruster [Sun, 22 Mar 2009 17:02:57 +0000 (18:02 +0100)]
Clean up non-ANSI definition of ef_verify()

Harmless, because declaration is fine.

15 years agoGive fairland's variables internal linkage
Markus Armbruster [Sun, 22 Mar 2009 16:55:00 +0000 (17:55 +0100)]
Give fairland's variables internal linkage

15 years agoMake non-static function definitions match static declarations
Markus Armbruster [Sun, 22 Mar 2009 16:47:14 +0000 (17:47 +0100)]
Make non-static function definitions match static declarations

Just to avoid confusion.

15 years agoDon't advertize ^D as means to end a telegram
Markus Armbruster [Sun, 22 Mar 2009 08:52:06 +0000 (09:52 +0100)]
Don't advertize ^D as means to end a telegram

getele() aborts the telegram on EOF since commit bc8a4432 (v4.2.21).
Besides, ^D may not work with some clients.

15 years agoDon't log out player when he interrupts a command
Markus Armbruster [Sun, 22 Mar 2009 07:58:10 +0000 (08:58 +0100)]
Don't log out player when he interrupts a command

Broken in commit 3da4030a, v4.3.19.

15 years agoClean up unreadable assignments within if conditionals
Markus Armbruster [Sat, 21 Mar 2009 08:24:45 +0000 (09:24 +0100)]
Clean up unreadable assignments within if conditionals

Pinpointed assignments within if conditionals with spatch -sp_file
tests/bad_assign.cocci (from coccinelle-0.1.4).  Cherry-picked diff
hunks affecting conditionals split over multiple lines, and cleaned
them up.

15 years agoFix assault not to send bogus telex to country 0
Markus Armbruster [Tue, 10 Mar 2009 19:50:47 +0000 (20:50 +0100)]
Fix assault not to send bogus telex to country 0

Happened when a spy got caught sneaking ashore and shot.

15 years agoBump version to 4.3.22
Markus Armbruster [Tue, 10 Mar 2009 19:50:01 +0000 (20:50 +0100)]
Bump version to 4.3.22

15 years agoFix distclean to remove generated files distributed in client tarball v4.3.21
Markus Armbruster [Tue, 10 Mar 2009 12:08:15 +0000 (13:08 +0100)]
Fix distclean to remove generated files distributed in client tarball

15 years agoReally fix bomb not to wipe out plane updates
Markus Armbruster [Tue, 10 Mar 2009 11:51:44 +0000 (12:51 +0100)]
Really fix bomb not to wipe out plane updates

Commit f07e6901 didn't fix it completely.

15 years agoUpdate change log again for 4.3.21
Markus Armbruster [Mon, 9 Mar 2009 21:35:18 +0000 (22:35 +0100)]
Update change log again for 4.3.21

15 years agoFix swapsector not to wipe out concurrent updates.
Markus Armbruster [Mon, 9 Mar 2009 21:31:49 +0000 (22:31 +0100)]
Fix swapsector not to wipe out concurrent updates.

Make swaps() bail out if any of the sectors changed while edit() slept
for input.

15 years agoUpdate change log again for 4.3.21
Markus Armbruster [Mon, 9 Mar 2009 20:33:30 +0000 (21:33 +0100)]
Update change log again for 4.3.21

15 years agoFix outdated comment
Markus Armbruster [Mon, 9 Mar 2009 20:33:23 +0000 (21:33 +0100)]
Fix outdated comment

15 years agoFix crash dump not to mess up streams
Markus Armbruster [Mon, 9 Mar 2009 20:10:44 +0000 (21:10 +0100)]
Fix crash dump not to mess up streams

Crash dump forks a child to call abort().  abort() may flush or close
streams.  This is unwelcome, because it can mess up streams in the
parent.  Observed with the journal.  Could theoretically also affect
commands info, read, turn, and wire; announcement expiry, and reading
of econfig and schedule.

Fix by using SIGABRT instead.

Note that flushing streams before fork() is not a sufficient fix,
because closing a stream can still move the file descriptor's file
position.  Do it anyway, to ensure any buffered output is visible to
post_crash_dump_hook.

15 years agoUpdate change log again for 4.3.21
Markus Armbruster [Sun, 8 Mar 2009 17:24:32 +0000 (18:24 +0100)]
Update change log again for 4.3.21

15 years agoFix bomb not to wipe out plane updates while asking for targets
Markus Armbruster [Sun, 8 Mar 2009 17:19:25 +0000 (18:19 +0100)]
Fix bomb not to wipe out plane updates while asking for targets

The commands to fly planes read the planes into a plane list, and
write them back when they land.  If a plane changes in the file while
it is in that plane list, the changes get wiped out when the plane
lands, triggering a seqno oops.

This is not an issue as long as the complete sortie runs
uninterrupted, because that code takes care to update flying planes
only through the appropriate plane list.

However, the bomb command suspends the planes on a pinpoint bombing
run mid-air over the target sector to let the player choose targets.
This lets code run that *can* update flying planes, for instance the
edit command.

Fix by aborting changed planes, taking care not to clobber the
changes.

15 years agoFix bombing of submarines with mixed force
Markus Armbruster [Sun, 8 Mar 2009 16:36:37 +0000 (17:36 +0100)]
Fix bombing of submarines with mixed force

When bombing ships with a force containing both planes with and
without capability ASW, pin_bomb() could fail to report presence of
submarines, and could refuse to bomb ships when there were only
submarines.  The culprit is pin_bomb()'s check for capability ASW: it
checked whether the first plane in the plane list was capable instead
of checking whether any plane in the list was capable.

15 years agoRename plane_caps() to pln_caps() and give it external linkage
Markus Armbruster [Sun, 8 Mar 2009 16:14:59 +0000 (17:14 +0100)]
Rename plane_caps() to pln_caps() and give it external linkage

15 years agoUpdate change log for 4.3.21
Markus Armbruster [Sun, 8 Mar 2009 13:33:00 +0000 (14:33 +0100)]
Update change log for 4.3.21

15 years agoFix a bug in attack that could wipe out land unit updates
Markus Armbruster [Sun, 8 Mar 2009 10:54:04 +0000 (11:54 +0100)]
Fix a bug in attack that could wipe out land unit updates

A victorious attacker can move attacking land units into the newly
conquered sector or leave them behind.  Normally, the player is asked
what to do, but when the land unit's army has already been told to
stay behind, or the command has been aborted, the land unit stays
behind without asking.  In that case, a copy of the land unit made
right after the victory was written back.  Any updates since the
victory were wiped out, triggering a seqno mismatch oops.

Fix by moving the re-read of the land unit in ask_move_in() out of the
prompt conditional.

15 years agoFactor obj_changed() out of check_sect_ok() & friends
Markus Armbruster [Sun, 1 Mar 2009 17:11:49 +0000 (18:11 +0100)]
Factor obj_changed() out of check_sect_ok() & friends

15 years agoIgnore timestamps in check_loan_ok() & friends
Markus Armbruster [Sun, 1 Mar 2009 17:10:45 +0000 (18:10 +0100)]
Ignore timestamps in check_loan_ok() & friends

check_loan_ok(), check_comm_ok() and check_trade_ok() should have been
changed to ignore timestamps when timestamps were added to their files
in commit a680c811, v4.3.12.

15 years agoDon't log out player when update aborts a command with pthreads
Markus Armbruster [Sun, 1 Mar 2009 10:34:50 +0000 (11:34 +0100)]
Don't log out player when update aborts a command with pthreads

pthread.c's empth_select() returned -1 when empth_wakeup() interrupted
select().  The failure then got propagated all the way up, and the
player got logged out.  Fix by returning 0 in that case.  While there,
retry on EINTR, to match LWP.  Also clarify comments.

15 years agoRemove unused empth_terminate()
Markus Armbruster [Sun, 1 Mar 2009 09:49:48 +0000 (10:49 +0100)]
Remove unused empth_terminate()

Unused since 4.3.10.  Can be used safely only in very special
circumstances.

Removal allows simplifying pthread.c and ntthread.c some.  liblwp left
alone.

15 years agoDon't log out player when update aborts a command
Markus Armbruster [Wed, 25 Feb 2009 21:52:39 +0000 (22:52 +0100)]
Don't log out player when update aborts a command

recvclient() confused command abortion with an idle timeout.  Broken
in commit 08b94556, v4.3.20.

15 years agoBump version to 4.3.21
Markus Armbruster [Sat, 21 Feb 2009 14:18:55 +0000 (15:18 +0100)]
Bump version to 4.3.21

15 years agoUpdate change log again for 4.3.20 v4.3.20
Markus Armbruster [Fri, 20 Feb 2009 18:15:01 +0000 (19:15 +0100)]
Update change log again for 4.3.20

15 years agoDisable LOANS and enable RAILWAYS by default
Markus Armbruster [Thu, 19 Feb 2009 21:06:41 +0000 (22:06 +0100)]
Disable LOANS and enable RAILWAYS by default

15 years agoUpdate known contributors comments
Markus Armbruster [Wed, 18 Feb 2009 20:11:33 +0000 (21:11 +0100)]
Update known contributors comments

15 years agoFix make dist in a separate build directory without git, really
Markus Armbruster [Tue, 17 Feb 2009 22:00:07 +0000 (23:00 +0100)]
Fix make dist in a separate build directory without git, really

Make didn't remake sources.mk even though it was a phony target.  I
don't understand why.  But we can just as well create it in its only
user, dist-source.

15 years agoUpdate change log for 4.3.20
Markus Armbruster [Tue, 17 Feb 2009 18:59:43 +0000 (19:59 +0100)]
Update change log for 4.3.20

15 years agoFix a few inaccuracies in info supply
Markus Armbruster [Sun, 15 Feb 2009 16:41:58 +0000 (17:41 +0100)]
Fix a few inaccuracies in info supply

15 years agoTake care not to supply from self
Markus Armbruster [Sun, 15 Feb 2009 07:47:43 +0000 (08:47 +0100)]
Take care not to supply from self

Change s_commod() not to use the supply sink as source.  As explained
in the message of the commit before the previous one, using the sink
as source makes it impossible for callers to safely keep a copy of the
sink across a supply call.  All current users do that.  Some were safe
anyway, some were not:

* fort_fire() was safe, because a fort draws shells only when it has
  none.

* shp_fire() was unsafe for ships with capability supply and ammo use
  greater than 1.  No such ship exists in the stock game.

* shp_dchrg() was unsafe for ships with both capabilities dchrg and
  supply.  Same for shp_torp() and capability torp, and
  shp_missile_defense() and capability anti-missile.  No such ship
  exists in the stock game.

* lnd_fire(), supp() and get_dlist() were safe, because they draw
  shells only when they have less than their ammo need, and then they
  don't supply any.

* mission_pln_equip() was unsafe when equipping planes with shells in
  supply sources.

* landmine() was unsafe for land units with both capability engineer
  and supply.  No such land units exist in the stock game.

* load() and lload() were unsafe for loadable supply units, but the
  supply use there was disabled in commit 65410d16 because of another
  bug.

* ask_olist() and att_reacting_units() were safe, because
  lnd_can_attack() excludes supply units.

In the stock game, planes flying interception or support missions,
abms intercepting ballistic missiles, launch of missiles or anti-sats
could conjure up shells, triggering a seqno mismatch oops.

In games with unusual customizations, this could also happen with
supply ships firing guns or torpedoes, dropping depth charges, or
shooting down marine missiles, and in the lmine command.

15 years agoRedesign s_commod()
Markus Armbruster [Sat, 14 Feb 2009 22:30:15 +0000 (23:30 +0100)]
Redesign s_commod()

To implement the supply from self avoidance described in the previous
commit's message, s_commod() needs to be redesigned along the same
principles: take the sink as argument, update and put it.  Also take
an item limit argument, and return whether supply request was fully
met.

Update sct_supply(), shp_supply(), lnd_supply() and
lnd_could_be_supplied().  The former three become straighforward
wrappers.

supply_commod() and try_supply_commod() are now unused, remove them.

15 years agoRedesign automatic supply interface
Markus Armbruster [Sat, 14 Feb 2009 18:00:01 +0000 (19:00 +0100)]
Redesign automatic supply interface

The automatic supply interface has design flaws that make it hard to
use correctly.  Its current uses are in fact all wrong (until commit
0179fd86, the update had a few uses that might have been correct).
Some of the bugs can only bite with land unit capability combinations
that don't exist in the stock game, though.

Automatic supply draws supplies from supply sources in range.  Since
that can update any supply source in range, all copies of potential
supply sources a caller may keep can get invalidated.  Writing back
such an invalid copy wipes out the deduction of supplies and mobility
from a source, triggering a seqno mismatch oops.

This commit redesigns the interface so that callers can safely keep a
copy of the object drawing the supplies (the "supply sink").  The idea
is to pass the sink to the supply code, so it can avoid using it as
source.  The actual avoiding will be implemented in a later commit.

Copies other than the supply sink still need to be eliminated.  See
commit 65410d16 for an example.

Other improvements to help avoid common errors:

* Supply functions are commonly used to ensure the sink has a certain
  amount of supplies.  A common error is to fetch that amount
  regardless of how many the sink already has.  It's more convenient
  for such users to pass how many they need to have instead of how
  many to get.

* A common use of supply functions is to get supplies for immediate
  use.  If that use turns out not to be possible after all, the
  supplies need to be added somewhere, which is all too easy to
  forget.  Many bugs of this kind have been fixed over time, and there
  are still some left.  This class of bugs can be avoided by adding
  the supplies to the sink automatically.

In fact, this commit fixes precisely such bugs in mission_pln_equip()
and shp_missile_defense(): plane interception and support missions,
missile interception (abms), launch of ballistic missiles and
anti-sats could all lose shells, or supply more than needed.

Replace supply_commod() by new sct_supply(), shp_supply(),
lnd_supply(), and resupply_all() by new lnd_supply_all().  Simplify
users accordingly.

There's just one use of resupply_commod() left, in landmine().  Use
lnd_supply_all() there, and remove resupply_commod().

15 years agoDon't let automatic supply starve the sector containing the sink
Markus Armbruster [Sun, 15 Feb 2009 13:38:09 +0000 (14:38 +0100)]
Don't let automatic supply starve the sector containing the sink

Automatic supply always leaves enough food to avoid starvation in
supply sources, except for one case: when drawing supplies from the
sector containing the sink.

This behavior contradicted info supply.  However, do_feed() used to
rely on it (it would have wiped out food without it).  Supply use
there was removed in commit 7da69c92, so we can now fix this.

Affected by this is the automatic food supply of land units in combat,
and the food supply in commands supply, load and lload.  Except supply
is disabled due to bugs in the last two.

15 years agoFix mobility cost of automatic supply from remote sector
Markus Armbruster [Sun, 15 Feb 2009 13:20:12 +0000 (14:20 +0100)]
Fix mobility cost of automatic supply from remote sector

When a supply request got served completely from a remote sector after
some other source had already provided some of it, the sector was
charged mobility for the complete amount instead of just the part it
actually provided.

15 years agoDisable recursive supply of land units
Markus Armbruster [Sun, 15 Feb 2009 08:15:53 +0000 (09:15 +0100)]
Disable recursive supply of land units

Its implementation in s_commod() increases lnd_seqno even when
!actually_doit, which can cause spurious seqno oopses in callers of
lnd_could_be_supplied().  I can't be bothered to clean up this mess
right now, because recursive resupply is too dumb to be really useful
anyway: each step uses the first source it finds, without
consideration of mobility cost.

15 years agoFix automatic supply of defending and reacting units
Markus Armbruster [Sat, 14 Feb 2009 17:37:34 +0000 (18:37 +0100)]
Fix automatic supply of defending and reacting units

Being in supply is relevant for defending and reacting units.  The
code used has_supply() to check that.

Contrary to its name, has_supply() does not check whether the land
unit has enough supplies to be in supply, but whether it has or could
draw enough.  So, defending and reacting units did not actually draw
any missing supplies.

Fix that in get_dlist() and att_reacting_units() by calling
resupply_all(), then checking with new lnd_in_supply() instead of
has_supply().  The fix of att_reacting_units() is complicated by the
fact that it is also used in the strength command, and should keep not
drawing supplies there.

Rename has_supply() to lnd_could_be_supplied().  Replace its uses
immediately after resupply_all() by lnd_in_supply().

15 years agoDon't resupply supply unit after use as supply source
Markus Armbruster [Sun, 15 Feb 2009 06:30:23 +0000 (07:30 +0100)]
Don't resupply supply unit after use as supply source

Running supply recursively here is problematic, because it can draw
supplies from the outer supply's destination, which can then end up
with less than it asked for.

Serving as supply source never puts a unit that is in supply out of
supply.  So, the recursive supply here denies the sink its supplies to
put a supply unit somewhere else back in supply.  That's robbing Peter
to pay Paul.  Drop it.

15 years agoRemove special case supply of land units from ships carrying them
Markus Armbruster [Sun, 15 Feb 2009 06:48:12 +0000 (07:48 +0100)]
Remove special case supply of land units from ships carrying them

The common supply code does not supply a land unit from the ship
carrying it, only resupply_all() does that, since 4.3.14.  It would be
nice to fix the inconsistency by always supplying land units that way,
but that's relatively costly now, because of the supply code's design.
Just drop it for now.

Affects load and lload (except resupply is disabled there because it's
buggy), supply, assault and board.

15 years agoDon't suggest only supply ships can tend in info tend and ltend
Markus Armbruster [Sat, 14 Feb 2009 14:45:55 +0000 (15:45 +0100)]
Don't suggest only supply ships can tend in info tend and ltend

15 years agoDon't lie about shell supply in info fire
Markus Armbruster [Sat, 14 Feb 2009 14:45:05 +0000 (15:45 +0100)]
Don't lie about shell supply in info fire

It claimed ships and land units don't need shells if they can draw
them from a supply source.  That was never true for ships, I believe,
and became wrong for land units in commit f6c87d21.

15 years agoClean up info lmine a bit
Markus Armbruster [Sun, 15 Feb 2009 16:29:00 +0000 (17:29 +0100)]
Clean up info lmine a bit

15 years agoFix lmine for engineers that don't use ammo
Markus Armbruster [Sat, 14 Feb 2009 09:02:47 +0000 (10:02 +0100)]
Fix lmine for engineers that don't use ammo

landmine() used resupply_commod() to get shells, but that doesn't get
any unless the engineer uses ammo.  Use supply_commod() instead.

15 years agoDon't permit landmine laying in foreign sectors
Markus Armbruster [Sat, 14 Feb 2009 14:11:26 +0000 (15:11 +0100)]
Don't permit landmine laying in foreign sectors

15 years agoFix lmine's "out of" messages
Markus Armbruster [Sat, 14 Feb 2009 08:58:44 +0000 (09:58 +0100)]
Fix lmine's "out of" messages

Don't claim "now out of supply" when actually out of mobility.

Don't claim "out of supply" when actually out of shells.  A land unit
is out of supply when out of shells, but not necessarily the other way
round.

15 years agoMake sure lmine can't lay seamines even when sector changes
Markus Armbruster [Sat, 14 Feb 2009 08:18:34 +0000 (09:18 +0100)]
Make sure lmine can't lay seamines even when sector changes

Reading the sector again invalidates the sector type check.  Bug can
currently bite only when the deity redesignates the sector.  Call
check_sect_ok() instead.

15 years agoMake lmine report lack of mobility more nicely
Markus Armbruster [Sat, 14 Feb 2009 08:08:06 +0000 (09:08 +0100)]
Make lmine report lack of mobility more nicely

15 years agoDon't let engineer mine while it is on a ship or land unit
Markus Armbruster [Sat, 14 Feb 2009 08:06:51 +0000 (09:06 +0100)]
Don't let engineer mine while it is on a ship or land unit

15 years agoDon't use automatic supply to avoid starvation at the update
Markus Armbruster [Thu, 12 Feb 2009 06:39:46 +0000 (07:39 +0100)]
Don't use automatic supply to avoid starvation at the update

Food supply during update adds complexity to the update.  How much
good it does to players is highly doubtful; certainly nobody can rely
on it.  It isn't covered by the starvation command.  Starving ships or
land units can steal enough food from their sector to make it starve,
too.  Finally, the supply code is notoriously hard to use correctly.
We don't know of issues with the update's use, but we haven't
convinced ourselves that there aren't any either.

15 years agoSectors and ships no longer need shells to fire flak
Markus Armbruster [Wed, 11 Feb 2009 19:46:27 +0000 (20:46 +0100)]
Sectors and ships no longer need shells to fire flak

4.0.9 changed flak not to use up shells, but they still had to be
present.  Drop that, because it doesn't really provide any value.
Moreover, this gets rid of the buggy flak shell supply code (seqno
mismatch oopses, lost supplies).