Commit graph

313 commits

Author SHA1 Message Date
Ron Koenderink
8d03e1ce8e (NSC_BITS): Remove the trailing comma as it is last row. 2005-11-05 20:25:16 +00:00
ae1f461058 (NSC_BITS): New.
(meta_flags): Update for it.
(ship_ca, mchr_ca, plane_ca, plchr_ca, land_ca, lchr_ca, nchr_ca)
treaty_ca, nat_ca, empfile_ca, mdchr_ca): Use it.

(symbol_ca): Move value selector to beginning of array.

(meta_flags): Downcase names.
2005-11-04 19:11:30 +00:00
Ron Koenderink
1b74e7ac42 (mission_short_name): Remove mission_short_name, not used. 2005-11-04 18:27:28 +00:00
bbc1ee8eb1 (trtstr): New members ef_type and trt_uid.
(do_treaty): Initialize them.
(treaty_ca): New selector uid.
2005-11-01 12:53:43 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
898aaf3d3d (empfile, empfile_ca): New struct empfile member ef_uid. 2005-10-22 19:10:22 +00:00
220ce8f00f Ultrix is no longer supported, remove special case. 2005-10-22 18:24:01 +00:00
5270cc57f2 [NOSTRDUP]: Drop support for systems without strdup(). 2005-10-22 18:12:22 +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
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
c1ab03dd5e Update for 4.2.23. 2005-10-21 05:58:30 +00:00
Ron Koenderink
542709fae3 (ichr_ca,pchr_ca,dchr_ca,mchr_ca,plchr_ca,lchr_ca,nchr_ca,
tchr_ca,rpt_ca,intrchr_ca ) Move from src/lib/commands/xdump.c
to src/lib/global/nsc.c; external linkage.  They were created in
xdump.c to minimize initial impact on the source, but they
really belong to nsc.c, where other code can use them as well.
2005-10-18 12:14:10 +00:00
1fa602b279 Update for 4.2.22. 2005-10-04 07:27:56 +00:00
61d1afdde9 Document. 2005-10-03 14:40:05 +00:00
f94f81ee16 (add): Initialize nat_last_login and nat_last_logout to zero rather
than current time.  Nation addition time is irrelevant.
(natstr): Document zero nat_last_login, nat_last_login mean never
logged in/out.
(player_main): Test nat_last_login zero instead of nat_hostaddr empty.

(player_main): Assign nat_userid, nat_hostname, nat_hostaddr straight
from player.  The last connection's host is now shown as dotted quads
instead of nowhere when the name isn't known.
(natstr): Document that nat_userid, nat_hostname may be empty.

(player_main): Simplify printing last connection address: nat_hostaddr
can't be empty here; don't bother to substitute "nobody" for empty
user.
2005-10-03 13:25:54 +00:00
717b8e96be (lndstr, natstr, shpstr): Fix string types from s_char[] to char[].
They were declared NSC_STRINGY in their selector descriptors, and
NSC_STRINGY is specified to represent char[].
(player): Get rid of s_char.
2005-10-03 10:35:44 +00:00
4f1ebae4b7 (natstr): Member nat_connected is inappropriate, because it is
transient server state, not persistent game state.  Remove.
(player_main, edit): Remove uses.
(coun): Use getplayer() instead of nat_connected.  Delete the message
on command being out of order.
2005-10-02 17:01:15 +00:00
ed5ba9fe3e (player_find_other): Replace by getplayer. player_find_other()
searches for a player other than US for country CNUM, which is in
state PS_PLAYING.  Since there can be at most one player in state
PS_PLAYING, and no caller pass that player as US, they can simply use
getplayer() instead.
2005-10-02 16:30:43 +00:00
687cacd887 (SNEAK_ATTACK, opt_SNEAK_ATTACK, Options, do_sneak, att_abort)
(att_fight): Remove option SNEAK_ATTACK.
2005-10-02 14:35:18 +00:00
caac6e41ca (get_assembly_point): New.
(bomb, drop, fly, para, reco): Use it.
2005-10-01 14:07:35 +00:00