oprange, show_mission, nameofitem, build_mission_list_type,
unit_map, xdvisible, trdswitchown, ontradingblock, trad, check_trade,
unit_type_name, start_stop_unit, scut, scra, mission, multifire,
perform_mission, fuel, NSC_GENITEM): Replace struct genitem with
struct empobj. Remove genitem.h and create a new file empobj.h.
Replace multiple instances of unions of ef_type structures with
one standard union empobj_storage which is a superset of the individual
instances.
files item.config, product.config, sect.config, infra.config.
(empfile): Declare the new config files. Reorder table entries so
that read_builtin_tables() reads the config files in the right order.
(bigcity_dchr, opt_BIG_CITY, init_dchr): Remove. Deities can edit
sect.config instead.
(ef_elt_byname): New.
(nstr_match_val): Use it to generalize to arbitrary table with
uniquely named elements. Use ca_type to find table, remove parameter
type. Callers changed.
(nstr_mkselval): Adapt sanity check accordingly.
(NSC_TYPEID): No longer needed, remove, users changed to use
appropriate integer type instead. This fixes signedness of sector
selectors des and newdes.
(meta_type): Remove entry for NSC_TYPEID.
(nstr_coerce_val): Can't detect typeid - integer mismatch anymore.
Was nice to have; perhaps revive it later.
(config_tables): New econfig key.
(read_config_tables): New, implements config_tables.
(main): Call it. Need to call ef_init() and chdir(configdir) first.
(ef_init_srv): Don't call ef_init(), since main() did it already.
Remove old way to do the same:
(ef_load): Remove, along with calls.
(empfile): Set configuration tables' member file back to NULL.
(sect_ca, ship_ca, land_ca, plague_stages, empfile):
Add plague stages symbol table.
(treaty_ca, loan_ca, agreement_statuses, empfile):
Add agreement status symbol table.
Combine treatystatuses (TS_FREE, TS_SIGNED and TS_PENDING)
and loan statuses (LS_FREE, LS_SIGNED and LS_PENDING)
into a single agreement status.
(pchr_ca, level, empfile): Add packing symbol table.
(retreat_flags, ship_ca, land_ca, plane_ca): Add retreat flags table.
(nation_flags, nation_relations, nat_ca): Add nation flags and
nation relations tables.
(empfile_ca): Remove flags and file name fields.
They are internal and not needed by the client.
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.
(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().
(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.
(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.
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.
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.
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.
player->owner is no longer used. Use it to indicate that owner can be
accessed through struct genitem, similar to EFF_XY and EFF_GROUP.
(xdump): Fix ownership checking. Old version worked only when
nxtitem() set player->owner.
(empfile): Set EFF_OWNER for EF_LOST. This fixes `xdump lost'
disclosing other countries' losses.
(loststr): Document implications of EFF_OWNER.
(empfile): Set EFF_OWNER for EF_NATION.
(natstr): Rearrange members for EFF_OWNER, document.
(nat_ca): Unused so far. Clean it up, add most missing selectors.
(fileinit): Use it. This implements `xdump nation'.
(fileinit): Simplify setting map file size.