From fee6c50b1a133ed4adfaca922894748b6cfebdc1 Mon Sep 17 00:00:00 2001 From: Ron Koenderink Date: Sun, 22 Jan 2006 18:57:14 +0000 Subject: [PATCH] (show, show_item): Resurrect show item. --- include/prototypes.h | 1 + info/show.t | 9 +++++---- src/lib/commands/show.c | 5 ++++- src/lib/subs/show.c | 17 +++++++++++++++++ 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/include/prototypes.h b/include/prototypes.h index 6e8294b1..f93cdd70 100644 --- a/include/prototypes.h +++ b/include/prototypes.h @@ -677,6 +677,7 @@ extern void show_land_stats(int); extern void show_sect_build(int); extern void show_sect_stats(int); extern void show_sect_capab(int); +extern void show_item(int); /* shpsub.c */ extern void shp_sel(struct nstr_item *, struct emp_qelem *); extern void shp_nav(struct emp_qelem *, double *, double *, int *, natid); diff --git a/info/show.t b/info/show.t index bcdfe3a2..369969b5 100644 --- a/info/show.t +++ b/info/show.t @@ -1,15 +1,16 @@ .TH Command SHOW -.NA show "Characteristics of bridges, ships, planes, land units or sectors" +.NA show "Characteristics of bridges, units, products or sectors" .LV Basic -.SY "show [b|s|c] [tech]" +.SY "show [b|s|c] [tech]" +.SY "show " The show command describes the characteristics of bridge spans, bridge -towers, planes, ships, land units, nukes, and sectors for a +towers, planes, ships, land units, nukes, items and sectors for a given technology level. .s1 The format of each output is more fully described in separate info pages (Ship-types, Nuke-types, etc.). .s1 -Except for bridge (bridge span) and tower (bridge tower), a +Except for bridge (bridge span), items and tower (bridge tower), a further parameter is required to indicate whether you wish information about building (b), statistics (s) or capabilities (c) of the selected type. diff --git a/src/lib/commands/show.c b/src/lib/commands/show.c index 36f87a76..a643ba89 100644 --- a/src/lib/commands/show.c +++ b/src/lib/commands/show.c @@ -55,7 +55,7 @@ show(void) int rlev; if (!(p = getstarg(player->argp[1], - "Describe what (plane, nuke, bridge, ship, sect, land unit, tower)? ", + "Describe what (plane, nuke, bridge, ship, sect, land unit, tower, item)? ", buf)) || !*p) return RET_SYN; @@ -82,6 +82,9 @@ show(void) case 't': show_tower(99999); return RET_OK; + case 'i': + show_item(99999); + return RET_OK; case 'n': if (opt_DRNUKE) tlev = ((rlev / drnuke_const) > tlev ? tlev : diff --git a/src/lib/subs/show.c b/src/lib/subs/show.c index c14282c2..84dd29bd 100644 --- a/src/lib/subs/show.c +++ b/src/lib/subs/show.c @@ -608,3 +608,20 @@ show_sect_capab(int foo) pr("\n"); } } + +void +show_item(int tlev) +{ + struct ichrstr *ip; + + pr("item value sell lbs packing melt item\n"); + pr("mnem in rg wh ur bk deno name\n"); + + for (ip = ichr; ip->i_name; ip++) { + pr(" %c %5d %4s %3d %2d %2d %2d %2d %2d %4d %s\n", + ip->i_mnem, ip->i_value, ip->i_sell ? "yes" : "no", ip->i_lbs, + ip->i_pkg[IPKG], ip->i_pkg[NPKG], ip->i_pkg[WPKG], + ip->i_pkg[UPKG], ip->i_pkg[BPKG], + ip->i_melt_denom, ip->i_name); + } +}