Commit graph

1419 commits

Author SHA1 Message Date
4cb1f13347 (ichr): Define without array size, like the other characteristics
tables.
2005-10-30 16:51:21 +00:00
05c8377e35 Doc fix. 2005-10-30 16:50:32 +00:00
ae251d0a58 (diroff, dirch, routech): Declare with array size. Define without.
This requires moving routech[] declaration from map.h to path.h.  Get
rid of s_char.
2005-10-30 16:46:46 +00:00
e59f9a43d1 (ep): Global variable pointing to sector cache. Gross. Remove.
(bp_neighbors, bp_lbcost, pathcost): Replace pointer arithmetic by
array subscript.
2005-10-30 16:22:29 +00:00
e694cc20f8 C_EXECUTE security. 2005-10-30 15:03:02 +00:00
4c06f31f16 (coun): Last access used to report last login time.
Counter-intuitive.  Report last connection time range instead.
Unfortunately, this requires a change in output format.

(coun): Report on all countries even to mortals.  This used to be
done, and was most probably changed because it gave away too much
information.  Carefully limit the information given to mortals, as
follows.  Limit last access information to whether deities or allies
are logged on right now, no longer report connection time for deities
that are not logged on.  Remove column time for mortals, rename it to
BTU for deities.  Report status, but with less detail if HIDDEN is
enabled.
2005-10-30 14:59:39 +00:00
ada0ed8e61 (buy, check_market, trad, check_trade): Remove the following virtually
undocumented feature: When a buyer didn't have enough money at the
time of the trade, the seller *automatically* granted a high-interest,
medium term loan for up to 90% of the price.  This is just a silly
trap for unwary sellers and buyers alike.
(N_FIN_TROUBLE, N_CREDIT_JUNK): Unused, remove.
(rpt): Update accordingly.
2005-10-30 14:33:44 +00:00
b2ae3257ca (empfile): Rename member ef_uid to uid for consistency with other
members.

(empfile): Reorder members for clearer documentation.

(EFF_IMMUTABLE): New.
(EFF_OPEN): Remove, use ~EFF_IMMUTABLE.

(empfile): Don't initialize member size to a useless value for EF_MAP
and EF_BMAP.  ef_init() writes the real value.
2005-10-30 12:50:13 +00:00
Ron Koenderink
bb79c64b92 (ef_init_chr): Add a NULL check to sentinel check. 2005-10-29 20:38:59 +00:00
6c849f0334 (ef_init): Fix check for sentinel. 2005-10-29 16:50:07 +00:00
d6581717f2 (xdump): Use xditem() for all empfile tables.
(xdchr, xdmeta): Specialize for meta-tables, rename.
2005-10-29 16:44:53 +00:00
9f038ff7a5 (meta_flags, meta_type): Change sentinel name to NULL to match the
other symbol tables.
2005-10-29 16:40:17 +00:00
ae81dade53 (ef_init, ef_init_srv): Rename old ef_init() ef_init_srv(), call new
ef_init().  Move initialization of map sizes to ef_init().
(main): Don't initialize map sizes by hand, call ef_init().

(fileinit): Internal linkage.
2005-10-29 15:16:50 +00:00
b96b9baced (rpt, page_headings): Declare with array size. Define without.
(empfile): Correctly initialize members cids, csize, fids for all
EFF_STATIC tables except EF_SHIP_CHR, EF_PLANE_CHR, EF_LAND_CHR,
EF_NUKE_CHR, EF_META and the symbol tables.
2005-10-29 14:48:32 +00:00
ef48271974 (EF_TREATY_CHR, EF_TREATY_FLAGS): Rename for consistency with other flags.
(treaty_ca): Add missing EF_TREATY_FLAGS to selectors acond, bcond.
2005-10-29 14:36:10 +00:00
e612db5cb6 (tchrstr, tchr_ca): Remove, use struct symbol and symbol_ca. Users
changed.
(tchr, treaty_flags): Rename for consistency with other flags.
2005-10-29 14:10:23 +00:00
02ec5df820 (lookup, symbol): Rename. Rename members to match selectors and
better reflect their purpose.  Users changed.
(lookup_ca, symbol_ca): Rename.
2005-10-29 07:46:42 +00:00
747d1333cc (intmatch): Assumes that struct size is a multiple of sizeof(int), out
of laziness.  The assumption is true on any sane machine, due to
alignment constraints.  But the function doesn't provide enough value
to make me fix or document this.  Remove it.
(lookup): Replace it.
2005-10-29 07:15:14 +00:00
b8e2f4a92a (dchr): Remove second sentinel. 2005-10-29 06:34:21 +00:00
19f2948620 (rpt): Add sentinel.
(EF_NEWS_CHR): New.
(empfile): Add its entry.
2005-10-29 06:27:00 +00:00
6be5ba5d40 (ef_byname): Old version didn't work when a table name was followed by
one of its prefixes.  src/lib/global/file.c rev. 1.18 added such table
entries, and file.h rev. 1.34 made them visible to ef_byname().
Simply use stmtch().  This also rejects ambiguous abbreviations: "s"
used to return EF_SECTOR, it now returns M_NOTUNIQUE.
2005-10-29 06:18:41 +00:00
Ron Koenderink
7c93f70ee4 (nchr): Move the array size to nuke.h. Add rows for configurable units.
(lchr,plchr,mchr): Add array size to land.h/plane.h/ship.h.  Add rows for
configurable units.
(ichr,pchr,dchr,intrchr): Add array size to item.h/product.h/sect.h.
2005-10-28 13:23:08 +00:00
Ron Koenderink
b3ab6abf4a (empfile): Add one to the array size for the sentinel row. 2005-10-28 12:56:54 +00:00
Ron Koenderink
445dfec9bc (NSC_CONST,castr,meta_flags): Add new flag NSC_CONST to castr.
(ichr_ca,pchr_ca,intrchr_ca): Use it.
2005-10-28 12:35:36 +00:00
01c248cb59 (EF_IS_GAME_STATE): New.
(xdump, main): Use it.

(EF_MAX): Change to largest table ID + 1.  This is now possible
because the changes above get rid of the assumption that
empfile[0..EF_MAX-1] is only game state.  Code can now work on any
table using the advertized empfile interface, not just on game state.
(my_ef_byname): Remove, use ef_byname().
2005-10-28 07:03:31 +00:00
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
e311ba1648 One more SNEAK_ATTACK leftover. 2005-10-26 16:19:17 +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
62c80be94c Comments. 2005-10-24 23:30:22 +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