Commit graph

2881 commits

Author SHA1 Message Date
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
Ron Koenderink
8e430ae2e3 (setsector): Limit fertility to 100 instead of 120, like the other
resources
2007-11-23 13:24:18 +00:00
836833e321 (carrier_planes): New parameter msl.
(carriersatxy, pln_onewaymission): Pass zero.  No functional change.
(pln_airbase_ok): Pass whether the plane is a missile.  This fixes
non-x-light missiles on ships without capability M_FLY.  Broken in
rev. 1.76.  Launch and interdict weren't affected.  Air defense was,
but the stock game has only x-light SAMs.
2007-11-22 19:33:14 +00:00
Ron Koenderink
e143bb585c (nav_ship): Move the special autofeed code to a separate
function nav_load_ship_at_sea().
(nav_load_ship_at_sea): New code. Generalize the autofeed to
support ships with M_OIL.
2007-11-22 12:57:00 +00:00
Ron Koenderink
6597f8a7d6 (nav_ship): Await fish only in water, not just any unowned sector. 2007-11-22 03:46:23 +00:00
Ron Koenderink
87eab4e63a (pln_sel): Remove unused local variables. 2007-11-22 03:21:27 +00:00
a98bac5146 (sendmessage): Internal linkage. 2007-11-18 11:58:30 +00:00
8064ecdb42 Explain briefly why clients may not support execute. 2007-11-18 11:57:34 +00:00
2ba645308e (play): Continue after input read error, treating it like EOF. This
fixes error handling when a script can be opened but not read: it
switches back to standard input.  And it handles errors on standard
input more gracefully: orderly shutdown, buffered output is still
written out.
2007-11-18 09:51:16 +00:00
02a9af06a0 Fix redirections with execute. Redirection consumed the remembered
input, and execute couldn't find it and mistakenly raised the
tampering deity alarm.  Closes #804644:
(saved_bytes): New.
(save_input): Set it.
(forget_input): New.
(seen_input): Don't discard, return a value for forget_input().
(save_input): Return a value for forget_input(), just because it makes
sense.
(input_to_forget, redir_authorized, prompt): Save value of
seen_input() to new input_to_forget in redir_authorized(), pass it to
forget_input() in prompt().
2007-11-18 09:41:59 +00:00
72b01c8ba1 (redir_authorized): New, factored out of users in prepraration of next
changeset.
(doredir, dopipe, doexecute): Use it.
2007-11-18 09:32:16 +00:00
24048a7f12 (save_input, seen_input): Assert argument ends with a newline. 2007-11-18 09:17:49 +00:00
8e77e66338 Remove extraneous declaration that crept into the previous revision. 2007-11-18 08:18:55 +00:00
70a800d648 (ring_discard): Tighten assertion. 2007-11-18 08:17:33 +00:00
aef5b18c1e (doexecute): Fix to set input_fd on failure, so that play() terminates
the execute correctly.  Closes #723756.
2007-11-17 18:57:06 +00:00
Ron Koenderink
94cf6d1ad8 (path): Fix to print every step of the path not every second step of the path.
Broken in rev. 1.10.
2007-11-17 17:05:48 +00:00
588a0f0898 Doc fix. 2007-11-17 16:52:07 +00:00
5017bb5daa (parse): Simplify. No functional change. 2007-11-17 16:48:01 +00:00
0e506556c2 (doredir): Open the file with mode 0666 instead of 0600, for
consistency with redirections in pipes.  Users should use umask to
restrict permissions.
2007-11-17 14:36:03 +00:00
8b7d0b915d Rewrite much of client's playing phase code:
(EOF_COOKIE, INTR_COOKIE, input_fd, send_intr, recv_output)
(recv_input, intr, play): New playing phase code.  No native Windows
support yet.  Sends just one EOF cookie on EOF on standard input
instead of up to three.  Old servers (before recvclient.c rev. 1.16)
fail to terminate the session when they receive an EOF cookie at an
argument prompt.  The session then hangs; use SIGINT to get out.  No
longer blocks on sending input, which could deadlock the session.
Closes #827090.  Fixes error handling for select().  Fixes race
condition that could cause server output to be discarded on EOF on
standard input.
(main): Replace old playing phase code by a call to play().
(intr, sock, interrupt, handleintr): Replaced by play(), remove.
[_WIN32] (hStdIn): Ditto.
(auxfp): New.
(servercmd, prompt, doexecute): Remove parameter auxfi, use auxfp.
(eight_bit_clean): Move to servcmd.c.
(servercmd): Work on a single non-C_DATA line instead of getting lines
from an ioqueue.
(servercmd, output, screen, outch): Deal with all ids in servercmd()
rather than some there and some in output().  Don't treat C_NOECHO,
C_ABORT, C_CMDERR, C_BADCMD specially.  Fix C_FLASH and C_EXIT to
ignore redirections; they used to ignore them only for some parts.
Replace output() by outch(), fold screen into outch().
(servercmd): Truncate long prompts and telegram infos to prevent
buffer overflow.
(prompt): Use new parameters code, prompt, teles instead of global
variables mode, the_prompt, num_teles.
(num_teles, the_prompt, mode, nbtu, nmin): Remove.
(prompt): Don't write an empty line before argument prompts to auxfp.
(servercmd): Don't strip newline from redirections and execute,
doredir(), dopipe() and doexecute() need it now.
(doredir, dopipe, doexecute): Use new seen_input() instead of gettag().
(doexecute): Set input_fd and leave reading the script file to play().
(serverio, termio, sendeof): Replaced by play(), remove.
(LBUF_LEN_MAX, lbuf, lbuf_init, lbuf_len, lbuf_full, lbuf_line)
(lbuf_putc): New.
(RING_SIZE, ring, ring_init, ring_len, ring_space, ring_peek)
(ring_getc, ring_putc, ring_putm, ring_discard, ring_search)
(ring_from_file, ring_to_file): New.
(clear_recent_input, save_input, seen_input): New.
(MAX): New.
(ioqueue, io, ioq_init, ioq_dequeue, ioq_read, ioq_write, ioq_qsize)
(ioq_drain, ioq_gets, ioqtobuf, enqueuecc, dequeuecc): Unused, remove.
(QEMPTY, qelem, insque, remque, initque): Unused, remove.
(tagstruct, taglist, io_init, gettag): Unused, remove.
2007-11-17 14:17:38 +00:00
2444a5c63a (main): Don't bother to close socket before exit(). 2007-11-17 10:17:00 +00:00
43d66c7d87 (doexecute): Use fname(). Simplify convoluted logic. Fix check for
empty argument.  Improve error messages.
2007-11-17 09:41:16 +00:00
a81aaba83c (main): Fix rev. 1.43. 2007-11-17 09:38:06 +00:00
2456a71acf (dopipe): Check whether argument starts with '|'. Simplify convoluted
logic.  Improve error messages.
2007-11-17 09:10:29 +00:00
17d6997d4e (fname): New.
(doredir): Use it.  Check whether argument starts with '>'.  Simplify
convoluted logic.  Improve error messages.  Check value of fdopen().
2007-11-17 09:08:57 +00:00
d01aa85577 (main) [_WIN32]: Don't call WSAStartup() until after option
processing, so that we can version and help even when it fails.  Fix
program exit status on failure.
2007-11-17 08:07:30 +00:00
0414ee66a2 Belatedly update standalone build for last night's changeset:
(main): Rewrite argument parsing to use getopt().  New options -h and
-v.
(print_usage): New.
2007-11-17 07:04:36 +00:00
46c0410e9c (main): Rewrite argument parsing to use getopt(). New options -h and
-v.
(print_usage): New.
2007-11-16 20:33:08 +00:00
b631cf944f (saveargv): Lame attempt at protecting users who foolishly specify
passwords on the command line.  Antisocially zaps the complete command
line, not just the password.  Remove, at least for now.
(main): Update accordingly.
2007-11-16 20:27:09 +00:00
f757843ca5 (install): Be a bit more verbose about the update of econfig.
(uninstall): Point to the unremoved configuration directory, not just
to econfig.
2007-11-16 19:23:30 +00:00
0649fbbb25 (journal_entry): Flush journal if debug is on. 2007-11-15 19:46:04 +00:00
b843490799 (lnd_count): Remove unused local variable. 2007-11-15 19:43:41 +00:00
0e275b8507 (load_plane_ship, load_land_ship, load_plane_land, load_land_land):
isdigit() can return anything, not just 0 or 1, and you can't combine
its values with &=!  The bug could make loading operations fail
noisily instead of silently, depending on the system's implementation
of isdigit().
2007-11-15 19:42:28 +00:00
dab28b9780 (pinflak_planedamage): Printed extra '%' since rev. 1.40, fix. 2007-11-15 19:31:00 +00:00
79407e68fd Shut down session on receipt of "ctld\n" even when reading arguments:
(player): New member eof.
(recvclient): Return -1 without receiving input when it is set.  Set
it on receipt of "ctld\n".
(execute): Clear it after receiving the script.
2007-11-15 19:10:04 +00:00
bd0d5c10b6 (execute): Prompted for a missing argument, but then passed a null
pointer to prexec() instead.  Some systems (GNU, Windows) deal
gracefully with printing null strings, others crash.
2007-11-15 19:03:27 +00:00
a877480082 If the directory already exists, the failing script cleans it up.
Oops.  Create it before setting the cleanup trap.
2007-11-15 07:15:05 +00:00
535c8a06a7 (tarball): Fix missing -e required by shell script. 2007-11-15 07:11:15 +00:00
Ron Koenderink
acfc17b05a Fix the test scripts for the players for the new world -R 1 for fairland
and for -R 1 for the server.  Cleanup the shell selection for the current builds
and the push the shell fixes to the config files.  Add PATCH and
CVSROOT environment variables to add flexibility.  Add the changes for
the new autoconf build and remove build.conf and makedepend.
Swiitch All patch to use the source code All patches.
Fix the spelling of sandbox.
2007-11-12 20:08:15 +00:00
6992bcfe9a (carriersatxy): Remove parameters wantflags, nowantflags, and use
carrier_planes() instead, ignoring carriers that can only operate
x-light planes.  No functional change.
(carrier_planes): External linkage.
2007-11-04 16:05:06 +00:00