Commit graph

1181 commits

Author SHA1 Message Date
0f6c4296b1 (set): Fix the previous revision. 2005-10-27 23:23:42 +00:00
2fc1e74a72 (ef_byname_from): New.
(set, mission, multifire, fuel, cons_choose, cede): Use it instead of
ef_byname().  Remove the hacks to map unwanted results to wanted
results.  The hacks in set() were broken: bad input made the code cast
arbitrary items to union trdgenstr, with potentially disastrous
consequences.  Closes #906483 and #906486.

(set): Less cryptic prompt and diagnostics.
2005-10-27 21:33:17 +00:00
Ron Koenderink
2df98825e9 (xdftr): Change footer to / instead of dumped. 2005-10-27 21:22:33 +00:00
Ron Koenderink
f9ac7a1f8c (xdump,xdchr,xdhdr,xdhdr1): Add meta data dump to xdump. 2005-10-27 19:37:19 +00:00
71908018ec (ef_open): Implement EFF_STATIC.
(ef_open): Simplify dynamic buffer allocation.
2005-10-26 16:49:52 +00:00
e6145fa515 (empth_start, empth_init) [_EMPTH_POSIX]: Do not handle SIGALRM. We
don't raise it, and the signal handler is fishy.
(empth_alarm): Unused, remove.
2005-10-26 16:30:00 +00:00
cae225a94a (info): Remove dead code. 2005-10-26 16:22:32 +00:00
a6a87af6ed (disassoc): Rewrite for POSIX, return status. Caller changed.
Problems with the old code:
* Insufficient error checking.
* It used TIOCNOTTY (obsolete BSDism) to get rid of the controlling
  tty, except for hpux || Rel4, where it attempted to use the POSIX
  way, but screwed up.
* It left file descriptors 0, 1, 2 in a somewhat weird state.
2005-10-25 18:42:03 +00:00
Ron Koenderink
551263cb07 (empfile,mdchr_ca,meta_type,meta_flags):
Add meta table and associated symbol tables.
2005-10-25 00:37:59 +00:00
527117207b (main): Don't close EF_NATION twice. 2005-10-24 23:39:45 +00:00
babf467e15 (EFF_STATIC): New.
(empfile): Use it.
(ef_open): Oops on it (not implemented).
(ef_close): Implement it (trivial).
2005-10-24 23:35:18 +00:00
889dfebaad (ef_nameof, ef_ensure_space): Oops on bad argument.
(ef_check): Use CANT_HAPPEN().
2005-10-24 23:27:18 +00:00
12b1427693 (ef_zapcache): Clearing the cache doesn't make sense. No harm done if
the next user can't use the cache, it gets automatically zapped then.
Remove.
2005-10-24 23:23:53 +00:00
ecab7c4f2f (ef_read): Catch null cache.
(ef_read): Used to get the file size again some circumstances; doesn't
make sense, as no other process may be writing this file.

(ef_write): Don't refuse to write beyond record 65536.  This module
can cope with that.  Some users have trouble long before that (short
record numbers), but that should be handled there.

(ef_write): Catch table not file-backed.
2005-10-24 23:16:13 +00:00
880a3e399b (ef_extend): Use do_write() & simplify. Catch table not file-backed.
Catch negative count; used to have no effect with EFF_MEM, and
confusion otherwise.  Try to recover from partially successful
extension.  Need help from ef_write() to do a better job; to be done.
2005-10-24 22:47:16 +00:00
62264f8ada (ef_extend): Fix rev. 1.25. 2005-10-24 22:44:29 +00:00
e29369fadb Clean up rev. 1.30. 2005-10-24 21:57:20 +00:00
f2e6d6b232 (ef_ptr): Change return type to void *.
(ef_ptr): Use CANT_HAPPEN() to ensure EFF_MEM; check it before less
serious index out of range failure.
2005-10-24 21:43:47 +00:00
5030d124a1 (ef_open): Fix fatal typo. 2005-10-24 20:42:27 +00:00
8b6549519b (ef_open): Portability fix: malloc(0) may return null, which is not a
failure.  fillcache() chokes on null cache, so don't call it for empty
files.
2005-10-24 20:36:17 +00:00
3eb3607f0d (ef_open): Failed to reset empfile member fd on failure, and leaked
file descriptors.

(ef_flush, ef_close): Rely on negative fd instead of null cache to
detect unopened file.  This is more logical and consistent with the
use of cache by the new tables that are not file-backed (rev. 1.22).
Use CANT_HAPPEN().

(ef_close): Failed to report cash flush failure.

(ef_close): Clear all EFF_OPEN flags.  Should have been done in
rev. 1.27.
2005-10-24 20:18:04 +00:00
1c4fb67911 (do_write): New.
(ef_flush, ef_write): Use it.  Old code couldn't cope with interrupted
or short writes (mostly harmless, as disk reads commonly complete).

(ef_write): Use CANT_HAPPEN() for catching unimplemented table
extensions.
2005-10-24 19:17:05 +00:00
ab03d83ce1 (fillcache): Rewrite. Old version failed to check success of lseek(),
couldn't cope with interrupted or short reads (mostly harmless, as
disk reads commonly complete), and left an empty cache after a failed
read.
(ef_open): Use fillcache() instead of read().
(ef_read): Fail if fillcache() fails to read at least one element.
Old version copied garbage to its caller and claimed success.
2005-10-24 19:02:39 +00:00
3ea02e2519 (ef_open): Fail if file size is not a multiple of record size. 2005-10-24 18:40:13 +00:00
64d8f6babe (ef_open, EFF_RDONLY, EFF_CREATE, EFF_OPEN): Replace mode parameter
(really open flags, not mode) by new flags EFF_RDONLY, EFF_CREATE.
Open flags were needlessly general.  Callers changed.
(empfile): Member mode now unused, remove.
2005-10-24 18:18:59 +00:00
Marc Olzheim
6b525c1841 Update for src/lib/commands/new.c:1.24 and include/prototypes.h:1.92 2005-10-24 15:35:35 +00:00
dab1f0bc7d (START_UNITS, start_unit_type, deity_build_land, new): Remove
undocumented compile-time option START_UNITS.  It hasn't been used in
ages; writing a quick build script is easier than recompiling the
server.
2005-10-23 20:52:46 +00:00
7dbe2d5687 Clean up the previous revision. 2005-10-23 15:03:12 +00:00
ba84b71f8d (draw_map): Parameter bmap abused EF_MAP and EF_BMAP, and required the
silly EF_NMAP.  Use characters instead: 'b' for bmap (was EF_BMAP),
't' for true bmap (was EF_MAP), 'r' for revert (was EF_MAP+EF_BMAP,
more sillness), and 'n' for nmap (was EF_NMAP).  Callers changed.
(EF_NMAP): Remove.
2005-10-23 08:58:23 +00:00
a2ae5ebe5e [NOSTRDUP]: Drop support for systems without strdup(). First commit
was incomplete.
2005-10-23 08:37:38 +00:00
f5a1430bcf (map, draw_map): Remove undocumented feature that lets deities run map
as another country.  It appeared around Chainsaw 3.0 and never fully
worked.  See also #1335316.
2005-10-23 08:32:49 +00:00
01c80490b9 (map): Fix rev. 1.4: it treated nmap as a bmap command. 2005-10-23 07:41:24 +00:00
bfd14661c5 (ef_close): Reset member fd.
(ef_open): Catch attempt to open open file.
2005-10-23 06:24:08 +00:00
a3dd70f8c0 (EFF_OPEN): New.
(ef_open): Restrict HOW to EFF_OPEN.
2005-10-23 06:17:14 +00:00
Ron Koenderink
dbff0608e5 (ship_ca,land_ca,plane_ca): Add missing EF_BAD for radius row in
NSC_GENITEM.
2005-10-22 23:53:46 +00:00
290e759998 (ef_open): Remove code killed by the previous revision. 2005-10-22 19:59:56 +00:00
01570d0923 [aix]: Remove special case include, I doubt it's necessary. 2005-10-22 19:31:44 +00:00
Ron Koenderink
a5952bab1e [_NTSDK]: Remove _NTSDK not needed. 2005-10-22 19:19:16 +00:00
2802ce1863 (ef_open): Don't assume blksize() is the same for all files.
(ef_open): Ensure the cache has at least one slot.
2005-10-22 19:12:27 +00:00
Ron Koenderink
898aaf3d3d (empfile, empfile_ca): New struct empfile member ef_uid. 2005-10-22 19:10:22 +00:00
2027ec8046 (blksize) [aix, sgi]: Drop special case; I bet these systems support
st_blksize by now.
2005-10-22 19:09:12 +00:00
b0f44690e5 (wripglob): No need to include misc.h since rev. 1.16. 2005-10-22 18:55:30 +00:00
7041932ae2 (ioq_destroy) [aix, NeXT]: Remove special case, which leaked memory,
because freeing it didn't work at some time.  Well, it either works
now, or we'll find out what's wrong.
2005-10-22 18:28:11 +00:00
Ron Koenderink
fcf5c59513 (castr,empfile,ship_chr,plane_chr,land_chr,nuke_chr):
Add table index to castr to create a reference to the symbol table.
Add "ship chr flags" table to empfile.
Add "plane chr flags" table to empfile.
Add "land chr flags" table to empfile.
Add "nuke chr flags" table to empfile.
Add EF_SHIP_CHR_FLAGS reference to ship_chr.
Add EF_PLANE_CHR_FLAGS reference to plane_chr.
Add EF_LAND_CHR_FLAGS reference to land_chr.
Add EF_NUKE_CHR_FLAGS reference to nuke_chr.

(show_ship_capab,show_plane_capab,show_land_capab,
show_nuke_capab,ship_flags,land_flags,plane_flags,nuke_flags):
Move ship_flags nsc.c from show.c
Rename ship_flags to ship_chr_flags.
Move plane_flags nsc.c from show.c
Rename plane_flags to plane_chr_flags.
Move land_flags nsc.c from show.c
Rename land_flags to land_chr_flags.
Move nuke_flags nsc.c from show.c
Rename nuke_flags to nuke_chr_flags.
This is to accomodate future symbol table for EF_PLANE table.
2005-10-22 16:39:45 +00:00
Ron Koenderink
cf4faac293 (ef_init): Remove cadef member from fileinit,
insert directly into the empfile structure.
Add ef_type member to fileinit to identify rows with data.
Remove unused rows of fileinit.
2005-10-22 13:55:04 +00:00
Ron Koenderink
29d21997b9 (empfile[]) Add table of tables to empfile[]. 2005-10-22 12:38:58 +00:00
c4c46190bf (player_init): Fix initialization of sin. Some systems have a member
sin_zero and choke when it's not zeroed.  INADDR_ANY wasn't converted
to network byte order, but since it's zero, the bug couldn't bite.
2005-10-22 10:23:20 +00:00
e24ade039f (io_open, io_noblocking): FNDELAY is long obsolete, use O_NONBLOCK. 2005-10-22 10:18:07 +00:00
118d63ff7e (new): Fix initialization of realms for players_at_00. 2005-10-22 10:12:18 +00:00
0ab9260151 (empfile, chr_camap): Merge chr_camap[] into empfile[]. No existing
user sees the new elements of empfile[].
(EF_SECTOR_CHR, EF_SHIP_CHR, EF_PLANE_CHR, EF_LAND_CHR, EF_NUKE_CHR)
(EF_TREATY_CHR, EF_ITEM, EF_INFRASTRUCTURE, EF_PRODUCT): New.  Not yet
used.
(my_ef_byname): Replacement for ef_byname() that sees the new
elements.
(xdchr): Work with empfile[] instead of chr_camap[].
(xdump): Use my_ef_byname() instead of ef_byname() and
chridx_by_name().
(camap, chr_camap, chridx_by_name): Remove.
2005-10-21 19:38:37 +00:00