Commit graph

72 commits

Author SHA1 Message Date
f7233ff841 Allow xdump before break; partial solution for #1417871:
(player_coms): Set xdump's c_permit to VIS.
(xdump): Deny countries that couldn't run xdump before access to game
state.
2006-08-13 07:13:37 +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
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
93b6a54356 (nat_ca, cou_ca, ef_init_srv, xdvisible): Plug major information leak:
nat_ca[] was designed for visibility to the owner only, while cou_ca[]
was designed for the public.  xdvisible() implemented that for xdump.
But selectors don't care for that!  Since nat_ca[] applies to
EF_NATION, it must be for public visibility.  Broken in 4.2.21.  Fix
by exchanging contents of nat_ca[] and and cou_ca[].  This breaks
clients relying on xdump.
2006-05-22 20:59:11 +00:00
8f998de170 Remove dead code. 2006-04-30 08:43:28 +00:00
071bf4da06 (xdvisible): Add case EF_REALM. Should have been added along with
EF_REALM (file.h rev. 1.52).  This made xdump leak everybody's realms.
2006-04-23 12:33:33 +00:00
6fee3f4535 (CANT_REACH): New. Use it instead of CANT_HAPPEN() where possible.
(oops): Cope with NULL argument passed by CANT_REACH().
2006-04-17 17:36:07 +00:00
4c6fb12377 Code formatting. No functional changes. 2006-03-26 13:52:23 +00:00
c52a9a2822 New doc/xdump. 2006-03-06 18:27:37 +00:00
433bcb0d19 (xdump): Nicer prompts. 2006-02-26 18:16:10 +00:00
2ddc989e09 Fit for the general public, not just for GUINEA_PIGS. Closes #928396. 2006-02-19 18:47:50 +00:00
58f67c8e19 Change xdump nat to show only own country, and xdump cou to show to
deities what xdump nat used to show:
(cou_ca): Remove initializer.
(ef_init_srv): Initialize cou_ca[] from nat_ca[].
(xdvisible): Change case EF_NATION to return true only for owner
even for deities.
2006-02-17 18:38:50 +00:00
09773ca8cc (xdvisible): Fix case EF_NATION for deities not to return true for
STAT_UNUSED.
2006-02-16 21:49:27 +00:00
Ron Koenderink
b7d0b66161 (buil, drnuke_const, opt_DRNUKE, show, show_nuke_build)
(show_nuke_capab, vers, xdvisible, build.t, Options.t):
Remove opt_DRNUKE and replace with the following check
drnuke_const > MIN_DRNUKE_CONST.
Set MIN_DRNUKE_CONST to 0.001 to prevent issues with tiny values.
Change the default drnuke_const to 0.0 because in the stock game
opt_DRNUKE was disabled.
2006-02-16 02:14:08 +00:00
c50c2d2518 (xdeval): Passed uninitialized val->val_as.sym.len to nstr_exec_val(),
which broke NSC_STRINGY.  Initialize from new parameter len.  Callers
changed.
2006-02-11 07:25:28 +00:00
5d50b2accf Doc update. 2006-02-09 19:48:21 +00:00
Ron Koenderink
aaea73a595 Update comment to indicate page_headings[] is done. 2006-01-29 19:29:10 +00:00
b4a76e04a3 (xdver): Dump version string. 2006-01-28 17:26:05 +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
847bf6901c (xdvisible): Fix the nuke-chr case to work for deities. 2006-01-21 17:35:13 +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
3e400c018c Update copyright notice. 2006-01-05 13:36:57 +00:00
8b16c31223 Change nation status from bits to a simple enum:
(nat_status, STAT_UNUSED, STAT_VIS, STAT_ACTIVE): New.
(STAT_NEW, STAT_SANCT, STAT_GOD): Change into nat_status members.
(STAT_INUSE, STAT_NORM): Remove.
(natstr): Use new nat_status for nat_stat.
    New value       Old value
    STAT_UNUSED     0
    STAT_NEW        STAT_INUSE | STAT_NEW
    STAT_VIS        STAT_INUSE
    STAT_SANCT      STAT_INUSE | STAT_SANCT
    STAT_ACTIVE     STAT_INUSE | STAT_NORM
    STAT_GOD        STAT_INUSE | STAT_NORM | STAT_GOD
Users changed.
2006-01-04 22:49:42 +00:00
9101fe2bd9 Fix the previous revision. 2006-01-03 19:07:53 +00:00
de8aea7a0f (xdvisible): New.
(xditem): Use it.  This plugs all known information leaks.  It also
avoids dumping of unused records.
2006-01-03 17:07:41 +00:00
3aebb68ee7 Include config.h. 2005-12-27 18:04:19 +00:00
ade510f787 Turn options into ordinary econfig keys:
(configkeys): Add options.
(KM_OPTION): New.
(vers): Find options in configkeys[] instead of Options[].
(xdump): Remove xdump opt syntax.
(xdopt): Remove.
(emp_config, print_config): Remove option special case.
(option_list, Options, setoption): Remove.
2005-12-25 10:32:50 +00:00
Ron Koenderink
0b15696223 (xdump): Add EF_MAX check for table selection by number.
Fixes a crash when selecting a table over EF_MAX.
2005-11-12 13:38:01 +00:00
610b1cded4 (xdopt, xdver): Simplify the previous rev.
(xdump): Support selecting a dump by table number in addition to name.
2005-11-06 11:05:48 +00:00
Ron Koenderink
a16b3266ff (xdhdr,xdhdr1,xditem,xdmeta,xdopt,xdver,xdfldnam):
Remove the column header.
Not need as the xdump meta is functional.
2005-11-05 17:46:17 +00:00
Ron Koenderink
ba5b1b0a79 (xdopt,xdver,xdump): Add meta data for opt and ver. 2005-11-05 01:49:47 +00:00
Ron Koenderink
0d0800f4ac (xdmeta): Fix the printing of the number of rows dumped.
Incorrectly included the skipped rows.
2005-11-04 23:32:05 +00:00
a4fcd52cd0 (xdmeta): Don't dump meta data for stuff that is not dumped by
xdflds().
2005-11-04 19:56:47 +00:00
b30f4e7591 (xdmeta): Fix rev. 1.36. 2005-11-04 12:44:33 +00:00
f2eaedfe75 (xdopt, xdver): Fix missing footer. 2005-11-03 09:24:52 +00:00
Ron Koenderink
66f61616cb (xdmeta): Add NULL ca check.
Fixes a crash for xdump meta pow.
2005-11-03 00:03:55 +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
19f2948620 (rpt): Add sentinel.
(EF_NEWS_CHR): New.
(empfile): Add its entry.
2005-10-29 06:27:00 +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
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
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
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
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
Ron Koenderink
953e5f6dc7 (xdprval): Only use of prnf() that is not for telegram text.
Replace by pr() in preparation of output conversion of telegram text
for the UTF-8 option.
2005-03-26 17:21:23 +00:00
345ad3dfe0 Update copyright notice. 2005-03-16 22:03:16 +00:00
58512e4813 First step towards generalizing NSC_TYPEID to arbitrary dictionaries.
(nsc_cat) New category NSC_ID.
(nstr_comp): Resolve identifiers instead of relying on nstr_comp_val()
and nstr_coerce_val().
(valstr, nstr_coerce_val): Remove valstr member val_as_type.
(nstr_parse_val, nstr_match_ca, nstr_match_val, nstr_resolve_id)
(nstr_resolve_sel, nstr_mkselval): New.
(nstr_comp_val): Rewrite using the above.
2005-02-24 16:14:53 +00:00
afa65c8f27 Break inclusion cycles. To simplify the change, move a few
declarations to other, no less sensible places.
2005-02-12 19:26:59 +00:00
858839f063 (dchr_ca): New selector maxpop. 2005-02-12 17:06:21 +00:00