Commit graph

3537 commits

Author SHA1 Message Date
1f60baf818 New SCT_BUDG_MAX 2009-07-19 13:58:47 -04:00
48ff09664b Overhaul show sect b
Print sector type mnemonic and name, like show sect s and c.  Print
"can't" instead of negative number for sectors players can't designate
(this was not an issue before the previous commit).  Show build cost
per 100%, like show ship, land, plane and nuke.  Size the columns more
sensibly.
2009-07-19 13:58:40 -04:00
be6d7ca913 Fix show sect b not to omit undesignatable sectors
show sect b needs to explain any sector players can build.
show_sect_build() omitted sectors players can't designate.  That's
wrong, because players can certainly own and thus build sectors they
can't designate.  Test for infinite mobility cost instead, like
show_sect_stats().
2009-07-19 13:52:55 -04:00
9ff6314a0e Clean up automatic supply leftovers in ship update
Commit 7da69c92 (v4.3.20) removed use of automatic supply from
prod_ship().  It removed bp_enable_cachepath(), but left behind the
final bp_disable_cachepath(); bp_clear_cachepath().  Clean that up.
2009-05-23 10:08:55 +02:00
e0a2b4ca4c Fix mine production resource limit for peffic != 100%
With etu_per_update large and resource depletion quick, a sector can
produce more work than is required to fully deplete a mine.  In that
case, produce() and prod() limit production to what is actually in the
ground.  Except produce() got it wrong for sector types with
production efficiency other than 100%.

This affects mountains in the stock game, but only with impractically
large etu_per_update.
2009-05-21 18:57:55 +02:00
a61e673a07 Clean up poorly chosen loop control variable names
Calling a counting loop's control variable q or x is tasteless
bordering on actively misleading.
2009-05-21 09:30:05 +02:00
a2557a1dec Bump version to 4.3.23 2009-04-30 21:16:56 +02:00
e250301140 Update change log for 4.3.22 2009-04-25 13:57:45 +02:00
70a9a44bbc 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.
2009-04-25 13:57:45 +02:00
a977bd08f6 Rename m4/my_termlib.m4 to m4/my_terminfo.m4 2009-04-25 13:57:45 +02:00
5e132e3874 Remove useless memset() before free() 2009-04-25 10:16:27 +02:00
20eb6afd15 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.
2009-04-25 10:16:27 +02:00
d0cf7a3119 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.
2009-04-25 10:16:27 +02:00
cf4cb6c907 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.
2009-04-25 10:14:42 +02:00
ad0f967fd6 Fix ersatz_getpass() to use its parameter
It used its only actual argument instead.
2009-04-25 10:02:47 +02:00
eb1041f130 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.
2009-04-23 20:38:15 +02:00
b1e6004148 Make savecore put $PWD in the mail subject
Useful when you monitor multiple games.
2009-04-23 20:32:42 +02:00
a9fd8d349b Add includes to make headers self-contained 2009-04-21 19:30:42 +02:00
a78476fcb9 Make configure print a configuration summary 2009-04-19 15:47:40 +02:00
dfb6620203 Autoconfigure use of terminfo
New configure --with-terminfo.  Before, terminfo was assumed to be
available everywhere but on Windows.
2009-04-19 15:42:19 +02:00
e049ad6a56 Declare getsose() & friends in one place 2009-04-19 15:25:45 +02:00
9fb9653ed7 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.
2009-04-18 22:03:39 +02:00
568a288cce Trim a bogus make dependency in standalone client build
It got added in commit f082ef9f.
2009-04-18 19:08:03 +02:00
ce7fab3868 Really, really fix bomb not to wipe out plane updates
Commit 82b5e3c2 missed escorts.
2009-04-18 14:41:24 +02:00
1ee02194c5 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).
2009-04-18 08:41:28 +02:00
1329c0e544 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.
2009-04-16 13:06:32 +02:00
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