Commit graph

3711 commits

Author SHA1 Message Date
c2c0d1ff77 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.
2009-04-15 23:06:54 +02:00
627eb9bc1a Run git describe in nightlybuild.sh to identify what's built 2009-04-15 22:12:44 +02:00
8b7786340e 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.
2009-04-13 12:55:15 +02:00
55d0d975a5 Standalone client build for Windows made empire without .exe 2009-04-13 12:55:15 +02:00
c1dbf14f8f Define WIN32_LEAN_AND_MEAN for Windows 2009-04-13 12:55:15 +02:00
c02468fd69 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.
2009-04-13 12:51:24 +02:00
c3d2786f1a Remake src/client/aclocal.m4 with aclocal instead of cp 2009-04-12 18:32:24 +02:00
04a8ed4a20 Fix client to abort script execution on SIGINT 2009-04-11 22:52:52 +02:00
e3cee85f7c 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.
2009-04-11 17:57:36 +02:00
041066ab76 Include stdlib.h unconditionally, for simplicity 2009-04-10 19:09:58 +02:00
56e717859b 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.
2009-04-10 19:09:58 +02:00
8c3b8d107d 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.
2009-04-10 19:09:57 +02:00
b65395d6f4 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.
2009-04-10 19:09:57 +02:00
f30ecd3da7 Fix documentation not to refer to client as emp_client 2009-04-05 11:34:57 +02:00
2196ffd55c 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.
2009-04-05 10:58:30 +02:00
92ce7cf665 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.
2009-04-05 10:55:46 +02:00
df62b8604d Remove dead EASY_BRIDGES code from bridgefall()
Dead since commit 40eb78eb, v4.3.12.
2009-03-31 23:03:42 +02:00
2adb88202f Simplify build_tower() a bit
No functional change.
2009-03-31 23:03:41 +02:00
ff28200d91 Fix info build, mine, navigate, sweep on mines 2009-03-31 23:03:41 +02:00
d1b39676e2 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.
2009-03-31 23:03:41 +02:00
3ea4e1ac60 Simplify retreat_ship1() and retreat_land1() slightly
No functional change.
2009-03-31 23:03:41 +02:00
3722bafaf7 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.
2009-03-31 22:52:03 +02:00
8cbcfefda1 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().
2009-03-28 13:04:48 +01:00
6ae4eca045 Don't use 0 as null pointer constant, part 3
This part replaces E == 0 by !E, where E has pointer type.
2009-03-24 21:46:01 +01:00
90f8f2b099 Don't use 0 as null pointer constant, part 2
This part replaces E != 0 by E, where E has pointer type.
2009-03-24 21:46:01 +01:00
615681ce16 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.
2009-03-24 21:45:44 +01:00
a2ed975ec2 Clean up more unreadable assignments within if conditionals 2009-03-23 23:11:14 +01:00
6459cfce7b Simplify explain()
No functional change.
2009-03-23 23:09:03 +01:00
696dea759c Clean up non-ANSI definition of ef_verify()
Harmless, because declaration is fine.
2009-03-22 18:02:57 +01:00
ebdd9620f5 Give fairland's variables internal linkage 2009-03-22 17:55:00 +01:00
d1b801b90b Make non-static function definitions match static declarations
Just to avoid confusion.
2009-03-22 17:47:14 +01:00
5dcd748f9d 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.
2009-03-22 09:52:06 +01:00
475f518be1 Don't log out player when he interrupts a command
Broken in commit 3da4030a, v4.3.19.
2009-03-22 09:01:57 +01:00
57717b5bc1 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.
2009-03-21 09:24:45 +01:00
7c6e56bd02 Fix assault not to send bogus telex to country 0
Happened when a spy got caught sneaking ashore and shot.
2009-03-10 20:50:47 +01:00
c16ed9c405 Bump version to 4.3.22 2009-03-10 20:50:01 +01:00
2fb427b676 Fix distclean to remove generated files distributed in client tarball 2009-03-10 13:08:15 +01:00
82b5e3c29a Really fix bomb not to wipe out plane updates
Commit f07e6901 didn't fix it completely.
2009-03-10 12:51:44 +01:00
009fc1403c Update change log again for 4.3.21 2009-03-09 22:35:18 +01:00
d0db465382 Fix swapsector not to wipe out concurrent updates.
Make swaps() bail out if any of the sectors changed while edit() slept
for input.
2009-03-09 22:32:10 +01:00
8df262bada Update change log again for 4.3.21 2009-03-09 21:33:30 +01:00
aa734fa7b1 Fix outdated comment 2009-03-09 21:33:23 +01:00
b510ee5345 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.
2009-03-09 21:25:46 +01:00
84008cf870 Update change log again for 4.3.21 2009-03-08 18:24:32 +01:00
f07e6901cb 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.
2009-03-08 18:19:25 +01:00
f10af4dea0 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.
2009-03-08 17:36:37 +01:00
f760150d8f Rename plane_caps() to pln_caps() and give it external linkage 2009-03-08 17:14:59 +01:00
fa03ba9aad Update change log for 4.3.21 2009-03-08 14:44:29 +01:00
e03eaeae23 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.
2009-03-08 11:54:04 +01:00
6b75c21e3c Factor obj_changed() out of check_sect_ok() & friends 2009-03-08 09:01:56 +01:00