Commit graph

2720 commits

Author SHA1 Message Date
17b1e03130 Document restrictions. Warn of common client bugs. 2007-12-09 17:42:12 +00:00
adfab4344e 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.
2007-12-09 17:24:30 +00:00
ed8e0cd552 (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.
2007-12-09 17:06:03 +00:00
158f5f4b2a Add empsched, belatedly. 2007-12-09 16:04:54 +00:00
Ron Koenderink
5d512312d9 Removed EMPTARGET and ARCH from nightlybuilds,
not used with new autoconf. Replace with INSTANCE
for logs, build directory for local patches.

Use the local patches directly from the source tree instead
of all local copy.
2007-12-08 23:48:06 +00:00
Ron Koenderink
da6e711e5c (recv_input): Skip CR when creating command buffer.
This prevents mismatches between command buffer and
the response from the server during the secure check.
2007-12-08 23:09:56 +00:00
Ron Koenderink
9b87ff70be (readv, writev) [_WIN32]: Set errno to ENOMEM when
unable memory.
2007-12-08 23:00:37 +00:00
d3eec3e09d (status, init_nats): Concentrate CAP and MONEY logic in
player_set_nstat().
2007-12-08 20:53:08 +00:00
976c885dfc (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.
2007-12-08 20:47:13 +00:00
1476e59dce (capi, caploss): Leave updating player->nstat to next status(). 2007-12-08 20:11:33 +00:00
f36aa0f89d (player): Remove member broke.
(player_set_nstat): Don't set it.
(status): Check nstat instead of broke and nat_money.
2007-12-08 20:09:35 +00:00
2b5ebf1f3f (player_set_nstat): New, factored out of init_nats().
(init_nats): Use it.  No functional change.

(status): Use it.  This sets player->nstat from scratch, not just
MONEY and CAP.
(brea): Don't bother to update player->nstat, status() will.
2007-12-08 19:27:41 +00:00
96b20c90b2 (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.
2007-12-08 18:05:51 +00:00
707e4fda95 (caploss): Simplify. No functional change. 2007-12-08 17:53:04 +00:00
a46c7656d2 (servercmd): Fix telegram info prompt. Broken in rev. 1.37. 2007-12-08 17:42:16 +00:00
7e61dff2da (caploss): Sacked capital isn't moved since rev. 1.7. Don't tell the
victim it is.
2007-12-08 17:28:38 +00:00
09a842c1a0 Consistently consider a nation bankrupt when its treasury is
negative.  Some places considered $0 as bankrupt, some didn't.  Fix
the ones that did:
(repo_list): report command misreported countries with $0 as broke.
(init_nats): If you had $0, logging out and back in bankrupted you.
(produce_sect, upd_ship): Failed to build sectors and produce stuff
for countries with $0.
2007-12-08 14:46:40 +00:00
a71ec1459d (status): Round money before checking solvency, and consistently treat
$0 as solvent.  Before, you became bankrupt / solvent when your money
went below / above zero before rounding, but not when you hit zero
exactly.
2007-12-08 14:36:54 +00:00
ab368ce23b (servcmd): Fix recognition of empty C_INFORM broken in rev. 1.37. 2007-12-08 14:27:35 +00:00
4b715e9267 (check_market): Fix missing putnat(). Belatedly clean up after the
removal of automatic loans in rev. 1.18.
2007-12-08 14:17:03 +00:00
d475256cf1 (check_trade): Fix bug that made your money evaporate when you didn't
have enough to pay.  This was aggravated by the removal of automatic
loans in rev. 1.15.  Clean up after that revision, belatedly.
2007-12-08 14:14:31 +00:00
30458959e6 (check_trade): Fix the price quoted to the buyer when he deal falls
through because he can't afford it.
2007-12-08 09:11:11 +00:00
c96761ecee (status): Simplify. No functional change. 2007-12-08 07:33:45 +00:00
3d11b5ecfd (army, fleet, wing): Fix printing of new group broken in rev. 1.13. 2007-12-02 18:33:28 +00:00
98dc6dd0ec Belatedly update section BUGS: relations work since 4.3.0, reject
since 4.3.4, and budget priorities are gone since 4.3.6.

Fix markup.
2007-12-02 17:17:46 +00:00
3b906d099c Fix not to show $ signs in route output. These were last seen in
actual source code as of version 1.0.3, dated May 1989.
2007-12-02 17:01:46 +00:00
e0c9a56eb6 Trim .SA. 2007-12-02 16:49:04 +00:00
321a7219f4 Add route to .SA. 2007-12-02 16:47:54 +00:00
8fe6d37e4a Remove claim that ships and units on missions will not fire support.
It's always been wrong for ships, and land units were changed to match
ships in lndsub.c rev. 1.49.
2007-12-02 16:45:27 +00:00
aa38b1f31b Spelling fixes. 2007-12-02 16:22:15 +00:00
c09d449204 Reject unexpected redirections:
(redir_authorized): New parameter expected, reject when zero.
(doredir): Pass !redir_fp, do not close it.  Before, an unexpected
redirection silently replaced the existing one.
(dopipe): Pass !redir_fp.  Before, an unexpected redirection silently
replaced the existing one, leaking its FILE.
(doexecute): Pass 1.
2007-11-29 06:04:30 +00:00
a29a8f43ab Refactor redirection data structure, no functional change:
(redir_is_pipe): New.
(doredir, dopipe): Set it.
(pipe_fp): Remove.  Users changed to use redir_fp and redir_is_pipe.
2007-11-29 05:31:55 +00:00
bde3d0c17d (prompt, servercmd): Move C_PROMPT code from prompt() to the only call
site that passes C_PROMPT.  No functional change.
2007-11-29 05:17:54 +00:00
e6882c1e7f (servercmd, prompt, doexecute): Refactor: collect control of
executing, input_fd and send_eof in servercmd().  No functional
change.
2007-11-28 07:17:20 +00:00
2dbc45eff7 Flaws in the Empire protocol make redirections within execute next to
impossible to implement correctly, and nested execute practically
useless (#116377).  Catch and refuse those:
(executing): New.
(doexecute, prompt): Set and clear it.
(redir_authorized): Reject if set.
(doexecute, play): Don't signal doexecute() failure through input_fd,
because that screws up up when we're executing already.  Increment
send_eof in doexecute() instead.
(send_eof): External linkage.
2007-11-28 07:10:27 +00:00
51846ec38f (play): Increment send_eof instead of setting it, decrement it instead
of clearing it.  Fixes a race condition: when we got EOF on input_fd
and a failed doexecute() in the same iteration of the loop, only one
EOF cookie was sent, leaving the client hung.
2007-11-28 06:34:33 +00:00
0b058415a1 (play): Close input_fd when execute's done. Broken in rev. 1.1. 2007-11-27 19:55:34 +00:00
Ron Koenderink
90a53439b2 (loc_Exit_Handler, empth_init) [_WIN32]: Correct the function declaration
for loc_Exit_Handler().  Remove unnecessary cast.
2007-11-27 03:29:35 +00:00
Ron Koenderink
1fb8b9af73 New. Support for nightlybuild for SuSE. 2007-11-25 17:35:24 +00:00
a34a5fd23c (chat): New, factored out of flash() and wall().
(flash, wall): Use it.
2007-11-25 14:34:50 +00:00
566223c36b (flash, wall): Use player->comtail[] to find the raw message. The old
hack to find worked only when there were no spaces in flash's first
argument.  Closes #941740.
2007-11-25 14:31:09 +00:00
8b0c965a38 (flash, wall): Remove rev 1.11's bogus input filtering. 2007-11-25 14:28:42 +00:00
698322553a (execute): Use player->comtail[1] instead of player->argp[1]. This
makes execute send everything after the command back to the client
verbatim, not just the first argument (with quotes and funny
characters stripped).  The client always expected that, and got
confused when the server sent something else.
2007-11-25 14:06:53 +00:00
90631d56ed Record raw arguments, to be used in the next changesets:
(player): New member comtail.
(parse): New parameter tail.  Reorder parameter list.
(command, execute): Pass player->comtail.
(player_login, emp_config, do_unit_move): Pass NULL.  No functional
change.
2007-11-25 13:55:52 +00:00
Ron Koenderink
3fcee8ddd1 (set_fert): Limit fertility to 100 instead of 120, like the other
resources
2007-11-24 02:08:19 +00:00
Ron Koenderink
270ac2255a (resnoise): Remove the % from the change message for setsect().
Percent does not make sense for most of the values that can be
changed.
2007-11-24 00:25:11 +00:00
57f589e2e4 (M_XLIGHT, M_CHOPPER): Redundant, remove.
(init_mchr): Don't set them.
(carrier_planes): Use m_nxlight, m_nchoppers instead.
2007-11-23 18:50:46 +00:00
b900866ea8 (take_plane_off_land): Fix stupid pasto in assertion. 2007-11-23 18:39:31 +00:00
bba101eda6 (getilist): Use pln_airbase_ok(). This fixes a number of bugs: planes
stuck in foreign bases, on inefficient ships or land units, or land
units loaded on ships or land units could still intercept.
(can_fly): Remove.
2007-11-23 18:38:10 +00:00
b46191aebb (getilist): Remove bogus fuel check. It was inconsistent with the one
in mission_pln_equip(), which is called from ac_intercept().  The
inconsistency appeared in Empire3, and had no ill effect then.  But
rev. 1.42 screwed up the fuel test here: it made interceptors that
don't use fuel (SAMs) require petrol to be present to fly.
2007-11-23 18:23:06 +00:00