Commit graph

65 commits

Author SHA1 Message Date
ed88f3140d (EF_IS_VIEW): New.
(xdump): Use it to deny access to views when denying access to game
state.  Fixes the previous revision.
2006-08-13 07:29:30 +00:00
e42053d928 Break inclusion cycle: prototypes.h and commands.h included each
other.  Ensure headers in include/ can be included in any order
(except for econfig-spec.h, which is special).  New header types.h to
help avoid inclusion cycles.  Sort include directives.  Remove some
superflous includes.
2006-07-10 06:37:23 +00:00
Ron Koenderink
79ee88f7c6 (nxtitemp, trade_getitem, trade_desc, trade_check_item_ok, nxtitem,
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.
2006-07-07 15:15:43 +00:00
3aea20e1de (ichr, pchr, dchr, intrchr): Move initializer to new builtin config
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.
2006-06-04 09:34:39 +00:00
c432e3107d Symbolic names for table entries in conditionals, closes #928376:
(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.
2006-06-01 18:48:42 +00:00
89cd9b7ca0 (EF_NATION_REJECTS, nation_rejects): New.
(empfile): Add it.
(nat_ca): Use it.
2006-05-18 19:42:23 +00:00
99a1450c98 (EFF_CUSTOM): New.
(read_config_table_file): Set it.
(show_custom): Show it.
(vers): Use it.
2006-02-23 08:37:46 +00:00
fd461e7bf5 (empfile, SYMTAB): Reorder so that symbol tables are together. Sort
them alphabetically.  Factor out commonalities into new SYMTAB().  No
functional changes.
2006-02-18 15:02:18 +00:00
bd65a84eb5 New way to read configuration tables:
(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.
2006-02-18 13:57:52 +00:00
Ron Koenderink
f438b74e85 (EF_PAGE_HEADINGS, page_headings_symbols, M_NOTUSED): New.
(empfile): Add it.
(rpt_ca): Use it.
2006-01-29 18:40:11 +00:00
4515b84c59 COPYING duplicates information from README. Remove. Move GPL from
LICENSE to COPYING, because that's where it usually is.  Update all
the references to these files.
2006-01-21 19:48:41 +00:00
Ron Koenderink
4f20f3dd9c (EF_SECTOR_NAVIGATION, sector_navigation): New.
(empfile): Add it.
(dchr_ca): Use it.
(NAV_NONE): New.
2006-01-17 21:42:02 +00:00
9eba732cc3 (EF_COUNTRY, cou_ca): New.
(empfile): Add it.
(xdvisible): Deal with it.
(ef_open_srv, ef_close_srv): Set it up.
(ef_init_view, ef_fina_view): New.
2006-01-14 16:28:33 +00:00
Ron Koenderink
45adbdb00e Move realms from the nation file into a new realms file:
(boundstr, realmstr): Rename, new members ef_type, r_cnum, r_uid,
r_realm, r_timestamp.
(natstr): Remove member nat_b[].
(EF_REALM, realm_ca): New.
(empfile): Add it.
(ef_open_srv, ef_close_srv, main): Deal with new file.
(getrealm, putrealm): New.
(add, new, real, list_realm, sarg_getrange): Use them.
2006-01-13 13:18:56 +00:00
Ron Koenderink
b89de57d51 (EF_BAD, EF_SECTOR, EF_SHIP, EF_PLANE, EF_LAND, EF_NUKE)
(EF_NEWS, EF_TREATY, EF_TRADE, EF_POWER, EF_NATION)
(EF_LOAN, EF_MAP, EF_BMAP, EF_COMM, EF_LOST)
(EF_SECTOR_CHR, EF_SHIP_CHR, EF_PLANE_CHR)
(EF_LAND_CHR, EF_NUKE_CHR, EF_NEWS_CHR)
( EF_TREATY_FLAGS, EF_ITEM, EF_INFRASTRUCTURE)
(EF_PRODUCT, EF_TABLE, EF_SHIP_CHR_FLAGS)
(EF_PLANE_CHR_FLAGS, EF_LAND_CHR_FLAGS)
(EF_NUKE_CHR_FLAGS, EF_META)
(EF_META_TYPE, EF_META_FLAGS, EF_MISSIONS)
(EF_PLANE_FLAGS, EF_RETREAT_FLAGS, EF_NATION_FLAGS)
(EF_NATION_RELATIONS, EF_LEVEL, EF_AGREEMENT_STATUS)
(EF_PLAGUE_STAGES, EF_PACKING, EF_RESOURCES)
(EF_NATION_STATUS, EF_MAX): Turn into enumeration constants.
2006-01-10 19:53:34 +00:00
3e400c018c Update copyright notice. 2006-01-05 13:36:57 +00:00
a5c87a2b54 (EF_NATION_STATUS, nation_status): New.
(empfile): Add it.
(nat_ca): Use it.
2006-01-04 23:15:47 +00:00
c3900f8424 (empfile, fileinit, lnd_init, lnd_postread, lnd_prewrite, nuk_init)
(nuk_postread, nuk_prewrite, pln_init, pln_postread, pln_prewrite)
(sct_postread, sct_prewrite, shp_init, shp_postread, shp_prewrite)
(ef_extend): Use void * for generic pointer parameter.
2005-12-31 12:52:18 +00:00
028a1bf3d8 (EF_RESOURCES, resources): New.
(empfile): Add it.
(pchr_ca): Use it.
2005-12-31 10:29:32 +00:00
fa52e6944d Normalize inclusion guards: use NAME_H for name.h. Some headers
lacked them, others used reserved identifiers.
2005-12-29 10:16:01 +00:00
Ron Koenderink
40c821d28b (ef_init_srv): Add a call ef_verify() to verify game data and game
configuration consistency.

(ef_verify): New.  Verifies game data and game
configuration consistency.
2005-11-30 19:17:58 +00:00
Ron Koenderink
555de3100c (dchr_ca, packing, empfile): Add packing symbol table.
(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.
2005-11-13 12:27:02 +00:00
af824c3ed1 (EF_MISSION_FLAGS, EF_MISSIONS, mission_flags, missions): Rename, as
these are not flags.
2005-11-12 17:29:11 +00:00
Ron Koenderink
d8422caa84 (init_server, ef_load, xundump): Add ability to customize game
configurations.  The custom game configurations are loaded via
text files in the data directory.  Closes #752881.
2005-11-12 16:53:52 +00:00
Ron Koenderink
0a44c4893e (plane_flags, plane_ca): Add plane flags 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.
2005-11-09 22:56:43 +00:00
Ron Koenderink
23f134aa75 (empfile,mission_flags,ship_ca,land_ca,plane_ca): Add mission flags table. 2005-11-06 13:43:09 +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
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
19f2948620 (rpt): Add sentinel.
(EF_NEWS_CHR): New.
(empfile): Add its entry.
2005-10-29 06:27:00 +00:00
Ron Koenderink
b3ab6abf4a (empfile): Add one to the array size for the sentinel row. 2005-10-28 12:56:54 +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
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
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
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
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
ff8c7c249a (empfile): Member itemoffs is unused since file.c rev. 1.15; remove. 2005-09-30 20:02:57 +00:00
03abca9258 Remove leftover declarations that should have been removed along with
the definitions.
2005-09-30 19:40:41 +00:00
326ac671ba (EFF_OWNER): The assertion that EFF_OWNER implies ef_read() sets
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.
2005-05-29 14:14:33 +00:00