Don't let designate check total cost before doing anything
desi() ran the designate code twice, first for adding up the cost,
then for changing designation. However, the checking pass already
changed the sector when that cost nothing. The checking pass also
suppressed messages. There was at least one message that never got
printed because it was suppressed in the checking pass, and the
condition for it was no longer true in the changing pass, due to the
premature sector change: when a deity changed a non-coastal sector to
harbor or bridge head.
The total cost check is of limited value: designate costing money is a
bad idea, and the stock game has no such sectors. Not enough value to
justify keeping and fixing this disgusting mess. Remove it instead.
Fix mobility cost for marines assaulting from non-landing ships
Always charge land units at least as much mobility for assaulting from
non-landing ships as for landing ships. Before, marines lost all
mobility when assaulting from a non-landing ship, which could be less
than what the same assault costs from a landing ship (half an update's
worth).
Actually, this isn't just simplification. When mobility gain per
update was configured to be greater than 128, mobility could go from 1
to less than -127 when assaulting from a landing ship, and thus
overflow. Make it saturate at -127. Note that you can expect plenty
of trouble elsewhere with such a silly configuration.
With -s, LWP initializes thread stacks to track stack use. It did
that after makecontext(), with disastrous results on systems where
makecontext() writes something to the stack that swapcontext() expects
to find there. Makes FreeBSD 6.2 crash in swapcontext().
Factor stack allocation out of lwpNewContext() into lwpNewStack().
Move call of lwpStackCheckInit() into lwpNewStack().
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.
Ron Koenderink [Sat, 16 Feb 2008 17:15:10 +0000 (11:15 -0600)]
Added Remove_Repository to supported command list
This feature was added in commit 70c03561bb90 but was
not added to the list of supported commands at the top
of file. No functional change just a documentation
correction.
Ron Koenderink [Sat, 16 Feb 2008 17:09:19 +0000 (11:09 -0600)]
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.
Ron Koenderink [Sat, 9 Feb 2008 14:03:56 +0000 (08:03 -0600)]
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.
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.
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.
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.
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.
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.
Ron Koenderink [Tue, 5 Feb 2008 02:26:46 +0000 (20:26 -0600)]
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.
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.
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.
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.
Ron Koenderink [Tue, 1 Jan 2008 15:20:08 +0000 (15:20 +0000)]
Rename Autofeed to be Autofish and add information on doing automatic
off-shore drilling like automatic fishing. Fix the formatting to be
more consistent with other info pages.
(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.
Update for current code. Fix description of login commands option
and play. Document protocol's C_EXECUTE flaws. Clarify extent of
redirections. Spelling fixes and such.
(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.
(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.
(recvline): Remove the timeout feature. There are many other places
where the client could wait indefinitely for the server. The user can
always interrupt.
Ron Koenderink [Tue, 11 Dec 2007 22:00:25 +0000 (22:00 +0000)]
(w32_getpw, w32_socket, w32_connect, w32_recv, w32_send,
w32_writev_socket, w32_close_socket, getpass, w32_openfd,
w32_openhandle, w32_readv_handle, w32_close_handle,
sysdep_init, sysdep_stdin_init, w32_select, w32_signal_handler,
sigaction, stdin_read_thread, w32_ring_from_file_to_bounce_buf)
[_WIN32]: New w32 equivalent functions for POSIX functions.
(recvline, sendcmd, tcp_connect, hostconnect, getpass,
main, intr, play, ring_to_file, ring_from_file, doexecute,
doredir) [_WIN32]: Use new WIN32 equivalent functions.
(main) [_WIN32]: Add sysdep_init() to support system dependent
initialization for equivalence functions.
(play) [_WIN32]: Add sysdef_stdin_init() to support system
dependent initialization for reading stdin.
(recv_input, play) [_WIN32]: Replace the calls to ring_to_file()
and select() with WIN32 specific enhanced versions.
Makefile.in: update dependencies with new files.
Make.mk: Add using of getopt.c and getopt.h
from src/lib/w32 directory. Add getopt.c and getopt.h
to tar for client.
Disable nested execute. The execute protocol is flawed and cannot be
implemented correctly by asynchronous clients --- unless a client
waits for a prompt after sending the execute command and its argument,
it is prone to send more input before the C_EXECUTE arrives. That
input overtakes the contents of the script file. This is almost
certain to happen when the execute is in a script file. Disabling
that is probably more useful and certainly less painful than
documenting this mess. The client rejects nested execute since
servcmd.c rev. 1.42.
(EXEC): new.
(player_coms): Require it for execute.
(player_set_nstat): Set it in nstat.
(execute): Clear it in nstat.
(execute): Clients can't reliably detect where a redirection ends
because the server doesn't send C_PROMPT. The client simply rejects
such redirections since servcmd.c rev. 1.42. Before it didn't, but
incorrectly extended the redirection until the end of the script, and
screwed up when there was more than one redirection in the execute.
Make the server reject such redirections as well, because that's
probably more useful and certainly less painful than documenting this
mess.
Ron Koenderink [Sat, 8 Dec 2007 23:09:56 +0000 (23:09 +0000)]
(recv_input): Skip CR when creating command buffer.
This prevents mismatches between command buffer and
the response from the server during the secure check.
(dispatch, explain, status): Use player->nstat instead of
player->ncomstat for command permissions. Side effect: status() no
longer notifies deities when they go broke or become solvent.
(dispatch): Don't distinguish between transiently and permanently
unavailable commands. Didn't really work anyway.
(player): Remove unused member ncomstat.
(xdump): Fix test whether to deny access to game state. Rev. 1.72
added that test to make xdump available before break, and faithfully
denied access exactly when xdump wasn't available before. This denied
access when maximum minutes per day were exceeded. Don't.