Commit graph

2666 commits

Author SHA1 Message Date
40eb78eb74 Fix confused and buggy bridge splashing code
A bridge (span or tower) must be splashed when it gets damaged below
SCT_MINEFF.  Likewise when its last supporting sector (bridge head or
tower) gets damaged below SCT_MINEFF, unless EASY_BRIDGES is enabled.
We need to check this whenever a bridge head, span or tower gets
damaged.  This is done in three places, and all of them screw up:

* checksect() ignores damage to bridge heads.  It also leaves writing
  back the sector it checks to the caller, which never happens when
  it's called from sct_postread().

  Note that checksect() drowns all planes on bridges it splashes.
  Functions that need to exempt flying planes from such a fate have to
  splash bridges themselves.

* sect_damage() ignores damage to bridge towers, and damage to bridge
  spans unless EASY_BRIDGES is enabled.  It then runs checksect(),
  which compensates for these omissions, but happily drowns the planes
  sect_damage() attempts to protect.

* eff_bomb() ignores damage to bridge heads.  Collateral damage makes
  sect_damage() run, which compensates for the omission.

This causes the following bugs:

* Efficiency damage going through sect_damage() can drown planes it
  shouldn't.  This affects pinpoint bombing when collateral damage
  splashes a bridge, and strategic bombing.  The drowned planes then
  crash and burn when they attempt to land at their (just splashed)
  base.

* Efficiency damage to bridge heads not going through sect_damage()
  fails to collapse unsupported bridges.  This affects pin-bombing
  efficiency without collateral damage, and ground combat.  Also deity
  commands edit, setsector and add, but that could be regarded as a
  feature.

* If the sector file somehow ends up with an inefficient bridge span,
  it collapses on every read again and again, until it collapses on a
  write.  Related problems exist with other actions of checksect(),
  and they're not addressed here.

* If the sector file somehow ends up with adjacent inefficient bridge
  towers, checksect() on any of them recurses infinitely:

  - checksect() inefficient tower T1
    - knockdown() T1, but don't write that back to the sector file
    - bridgefall() T1; this reads all adjacent sectors, including
      inefficient towert T2
      - checksect() T2
        - knockdown() T2, but don't write that back to the sector file
	- bridgefall() T1; this reads adjacent sectors including T1
	  - checksect() T1
	    ...

This commit creates a new function bridge_damaged() to splash any
bridges that became inefficient or unsupported after damage to a
sector.  To avoid the inifinite recursion, we call it in
sct_prewrite() instead of checksect().

No uses knockdown() outside bridgefall.c remain, so give it internal
linkage.
2008-02-16 20:57:38 +01:00
Ron Koenderink
13cca55a9d Added Remove_Repository to supported command list
This feature was added in commit 70c03561bb but was
not added to the list of supported commands at the top
of file.  No functional change just a documentation
correction.
2008-02-16 11:15:10 -06:00
Ron Koenderink
ffee7cd10d Apply the patches using git apply instead of patch
Need to be in the empserver directory before applying
the "git apply" command, move the "cd empserver" to the
clone step. This change also fixes a bug when using
with an existing repository not being the correct
directory when executing the "git pull" command.
Fixes commit acd768e5e2 as it used git diff format.
2008-02-16 11:09:19 -06:00
Ron Koenderink
5461c86994 Remove unused local variables 2008-02-10 12:56:56 +01:00
Ron Koenderink
acd768e5e2 Update nightly build for recent changes to path.c.in
The three previous commits touching path.c.in broke mingw.patch: the
relative vs absolute paths changes moved the initializers to be
patched to new variables, and the telfil removal messed up the
context.
2008-02-10 12:56:49 +01:00
Ron Koenderink
83f7839d22 Remove the initialization for builtindir, not required
Fixes commit 4bb23dd1.
2008-02-10 11:48:25 +01:00
400df7be82 Clean up initialization of nat_ca[]
Factor it out of ef_init_srv() and put it into new nsc_init(), next to
nat_ca[].
2008-02-10 11:40:57 +01:00
55ff4f8e3a Clean up initialization of empfile[]
Split ef_init() into two functions: empfile_init() for initialization,
and empfile_fixup() to fix it up for configuration.  Put them next to
empfile[].  Move the call to empfile_init() from behind emp_config()
to before it.
2008-02-10 11:40:57 +01:00
3290e87576 Get rid of the need to fix up lchr[].
Mil are not required for building units since 4.0.0.  l_mil was still
initialized to l_item[I_MILIT], and used instead of that in a couple
of places.  Fix those, and remove the initialization.
2008-02-07 08:01:54 +01:00
91eefc3f3a Fix initialization of configdir
Windows code leaked memory (result of _fullpath()).

POSIX code passed a null buffer to getcwd(), which is not portable,
and failed to check for errors.
2008-02-07 08:01:54 +01:00
b76e5a5eed Make conftab.c independent of the current directory
read_builtin_tables() wanted to run in builtindir, and
read_custom_tables() wanted to run in configdir.  Bothersome.  Use new
fopenat() to relax those requirements.

The chdir() satisfying them are now superflous, remove them.
2008-02-07 08:01:54 +01:00
4bb23dd1a6 Make econfig keys data and info work for relative names
File names in econfig need to be interpreted relative to configdir.
This wasn't the case everywhere for keys data and info.

Fix this by changing variables gamedir and infodir to hold absolute
names.  Change builtindir likewise, for consistency.  Store the values
from econfig in gamedir_conf, infodir_conf and builtindir_conf.

Uses new fnameat() to derive absolute names from possibly relative
ones.
2008-02-07 08:01:54 +01:00
a38fad4229 Make utility programs abort on internal error
Until now, they tried to recover and continue (debug off).  That's
appropriate only for the server.  The server could be told to abort
instead (debug on, selected by option -d), but not the utility
programs.

Change debug to be on by default, and switch it off early in the
server's main().  No functional change for the server.
2008-02-07 08:01:53 +01:00
Ron Koenderink
70c03561bb Switch nightlybuilds to git
Create a local git repository on the SuSE nightly build machine.
Update local git repository from the Markus's public repository
at the beginnning of the nightlybuilds for SuSE and WIN32.
For the SuSE and WIN32 nightlybuilds drawn from the local
git repository on SuSE machine.
2008-02-04 20:26:46 -06:00
77e95bd788 Clean up library dependencies
Move stuff to untangle the ugly cyclic dependencies between the
archives built for selected subdirectories of src/lib/:

* Move common/io.c to empthread/ because it requires empthread stuff

* Move parts of subs/nstr.c to common/nstreval.c to satisfy
  common/ef_verify.o

* Move getstarg.c getstring.c onearg.c from gen/ to subs/ because they
  require stuff from there

* Move bridgefall.c check.c damage.c empobj.c journal.c maps.c
  sectdamage.c from common/ to subs/ because they require stuff from
  there

* Move cnumb.c from subs/ to common/ to satisfy common/type.o

* Move log.c fsize.c from common/ to gen/ because they really belong
  there

* Move emp_config.c mapdist.c from gen/ to common/ because they really
  belong there, and require stuff from libglobal.a

Also package as/ as libas.a to satisfy common/path.o.

Remaining dependencies:

    lib             needs
    --------------------------------------------
    libas.a         libglobal.a
    libcommon.a     libas.a libglobal.a libgen.a
    libgen.a
    libglobal.a
    liblwp.a        libgen.a
    libw32.a[*]     libgen.a

    [*] Except for service.o, which can only be linked into the server

Link order now: liblwp.a libcommon.a libas.a libgen.a libglobal.a
libw32.a.  The position of libw32.a is not quite right, but works
anyway.
2008-02-03 08:11:13 +01:00
1cbb37d4fb Get rid of src/lib/gen/copy.c
The function that gave its name to this file is long gone, the file's
description is bogus, and it contains just one definition.  Move that
to ../subs/border.c, and delete the file.
2008-02-03 07:44:20 +01:00
3d2518a724 Get rid of src/lib/common/land.c
There are several files with land unit subroutines.  This one is in an
awkward place: it depends on stuff from ../subs, which contributes to
libcommon.a's ugly dependencies.  Move its contents to logical places
(use internal linkage where possible), and remove it.
2008-02-03 07:37:16 +01:00
b58bc70d07 Remove telfil, use teldir instead. 2008-02-02 09:22:10 +01:00
f80af5c7da Belatedly update c_form of of show command
It lacked item and news since 4.3.0.
2008-02-02 07:56:49 +01:00
4fb5f76326 Remove unused non-terminal <VAR> from output of list command
It's been unused since commit 5dec30d6, and its explanation was bogus
before.
2008-02-02 07:50:26 +01:00
Ron Koenderink
eb473a6a24 Add missing expansion island
The number of islands was off by one.  The last island was
created, but not actually placed on the map.
2008-01-27 14:20:51 +01:00
db02dda32f Update copyright notice 2008-01-19 10:15:37 +01:00
bcdcbab19c Replace .cvsignore files by .gitignore files 2008-01-13 11:22:33 +01:00
35db407da0 Convert the build process from CVS to git
Detect .git instead of CVS.  Use git-ls-files with git, else
$(srcdir)/sources.mk.  info/findsubj.pl now gets the info files as
arguments rather than from sources.mk.

Remaking info subjects doesn't quite work, but it was broken similarly
before.
2008-01-13 11:17:26 +01:00
e424baab8b (player_coms): Clean up c_form of announce, break, bye and list. 2008-01-01 19:09:38 +00:00
Ron Koenderink
dabee52bc9 Remove quit as it sometimes confuses the client.
Known problem with 4.3.11, depend on the EOF.
2007-12-25 17:26:50 +00:00
Ron Koenderink
d4227f9ff8 Remove the symbolic link to empire and use the empire executable
directly.  Symbolic link fails for WIN32 empire because empire has
exe extension.
2007-12-23 22:16:37 +00:00
Ron Koenderink
84399281fe Scheduled task script file for win32 nightly build 2007-12-23 16:08:34 +00:00
Ron Koenderink
6872002d66 Configuration file for win32 nightly build 2007-12-23 16:06:59 +00:00
ff4ada21b9 (sect_ca): New selector elev. It's set by fairland, but has no effect
on the game.  It can be useful for deities to customize a world
created by fairland.
2007-12-22 08:11:21 +00:00
Ron Koenderink
9988c79cb6 Add sysdep_w32.o to the list of objects for the client.
Used for WIN32 clients.
2007-12-18 02:42:15 +00:00
Ron Koenderink
402e6a1cf7 (w32_socket) [_WIN32]: Correct the return type to SOCKET
for the select() call.
2007-12-17 13:18:19 +00:00
Ron Koenderink
c55abd60bd (w32_socket) [_WIN32]: Change result to be unsigned to
match the WIN32 return value from socket().
2007-12-16 21:31:51 +00:00
Ron Koenderink
81d87bae17 Move the patch level to above the empserver level. 2007-12-16 20:14:31 +00:00
Ron Koenderink
d1e3e9ddfc Add mingw specific patch for nightly build for win32.i386. 2007-12-16 15:45:09 +00:00
Ron Koenderink
97de159045 (sysdep_stdin_init) [_WIN32]: Add missing void for the parameter list. 2007-12-16 04:02:16 +00:00
Ron Koenderink
e2f795044f (w32_openfd) [_WIN32]: Correct extern reference. 2007-12-16 04:00:19 +00:00
c87f824253 (parseid): Switch id encoding from base 16 to base 36. This gives us
another 20 single digit ids before we have to risk breaking clients by
going to multiple digits.
2007-12-15 06:52:50 +00:00
265e71efa8 Remove superfluous parenthesis. 2007-12-14 07:49:58 +00:00
45b9d65129 (retreat_ship1, retreat_land1): Simplify slightly. 2007-12-14 07:48:50 +00:00
cd41560fbc (play): Failed to initialized sa.sa_mask. 2007-12-14 07:45:46 +00:00
2b312fd943 (expect): Simplify, no functional change. 2007-12-14 07:44:46 +00:00
225f0f5132 (parseid): New, factored out of recvline() and recv_output().
(recvline, recv_output): Use it.
2007-12-14 07:44:12 +00:00
c9c9305c2f (recvline): Cope with multiple-digit ids. Server doesn't send such
ids at this time.
2007-12-14 07:36:27 +00:00
8cdf2532d4 (recvline): Rewrite the loop to receive a line from a socket. The new
version silently truncates long lines.  The old one split them up and
got quite confused.  It got also confused when the line didn't arrive
in one piece.  Icing on the cake: it wrote beyond the end of the
buffer.  The new version is less efficient, but that doesn't matter
here.
2007-12-14 07:26:30 +00:00
3807cffe52 (recvline): Remove the timeout feature. There are many other places
where the client could wait indefinitely for the server.  The user can
always interrupt.

[_WIN32] (alarm): Unused, remove.
2007-12-14 06:59:09 +00:00
43cceac785 (sendcmd): Cope gracefully with short writes and EINTR. Don't just
continue after real errors.
2007-12-14 06:42:57 +00:00
92a14cca4d (sendcmd): Don't overflow buf[]. The bug was fairly harmless, because
the overflowing data comes from the local user.
2007-12-14 06:01:13 +00:00
bac5345914 (redir_authorized, doexecute): Change diagnostics to talk about batch
files instead of script files, to match info execute.
2007-12-13 21:36:25 +00:00
e357e05115 Remove senseless casts. 2007-12-13 21:34:27 +00:00