]> git.pond.sub.org Git - empserver/blob - src/lib/subs/show.c
402a6542369461dab9f3e38a718ae5f38603fec5
[empserver] / src / lib / subs / show.c
1 /*
2  *  Empire - A multi-player, client/server Internet based war game.
3  *  Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
4  *                           Ken Stevens, Steve McClure
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  *  ---
21  *
22  *  See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
23  *  related information and legal notices. It is expected that any future
24  *  projects/authors will amend these files as needed.
25  *
26  *  ---
27  *
28  *  show.c: General show routines
29  * 
30  *  Known contributors to this file:
31  *     Julian Onions, 1988
32  *     Jeff Bailey, 1990
33  *     Steve McClure, 1996
34  */
35
36 /*
37  * general routines that are callable to give info on things.
38  * currently, planes, ships, nukes and bridges. Tanks & regiments one day?
39  *
40  * Added nuke_flags to be consistent. Jeff Bailey 12/15/90
41  *                                    (bailey@mcs.kent.edu)
42  */
43
44 #include <math.h>
45 #include "misc.h"
46 #include "player.h"
47 #include "nuke.h"
48 #include "var.h"
49 #include "ship.h"
50 #include "land.h"
51 #include "item.h"
52 #include "plane.h"
53 #include "sect.h"
54 #include "optlist.h"
55 #include "file.h"
56 #include "nat.h"
57 #include "prototypes.h"
58
59
60 /*
61  * This cruft really belongs in the empglb.c file.
62  * Yuck.
63  */
64
65 struct lookup {
66     int key;
67     s_char *value;
68 };
69
70 struct lookup ship_flags[] = {
71     {M_FOOD, "fish"},
72     {M_TORP, "torp"},
73     {M_DCH, "dchrg"},
74     {M_FLY, "plane"},
75     {M_MSL, "miss"},
76     {M_OIL, "oil"},
77     {M_SONAR, "sonar"},
78     {M_MINE, "mine"},
79     {M_SWEEP, "sweep"},
80     {M_SUB, "sub"},
81     {M_SPY, "spy"},
82     {M_LAND, "land"},
83     {M_SUBT, "sub-torp"},
84     {M_TRADE, "trade"},
85     {M_SEMILAND, "semi-land"},
86     {M_OILER, "oiler"},
87     {M_SUPPLY, "supply"},
88     {M_ANTIMISSILE, "anti-missile"},
89     {0, 0}
90 };
91
92 struct lookup land_flags[] = {
93     {L_XLIGHT, "xlight"},
94     {L_ENGINEER, "engineer"},
95     {L_SUPPLY, "supply"},
96     {L_SECURITY, "security"},
97     {L_LIGHT, "light"},
98     {L_MARINE, "marine"},
99     {L_RECON, "recon"},
100     {L_RADAR, "radar"},
101     {L_ASSAULT, "assault"},
102     {L_FLAK, "flak"},
103     {L_SPY, "spy"},
104     {L_TRAIN, "train"},
105     {L_HEAVY, "heavy"},
106     {0, 0}
107 };
108
109
110 struct lookup plane_flags[] = {
111     {P_T, "tactical"},
112     {P_B, "bomber"},
113     {P_F, "intercept"},
114     {P_C, "cargo"},
115     {P_V, "VTOL"},
116     {P_M, "missile"},
117     {P_L, "light"},
118     {P_S, "spy"},
119     {P_I, "image"},
120     {P_O, "satellite"},
121     {P_X, "stealth"},
122     {P_N, "SDI"},
123     {P_H, "half-stealth"},
124     {P_E, "x-light"},
125     {P_K, "helo"},
126     {P_A, "ASW"},
127     {P_P, "para"},
128     {P_ESC, "escort"},
129     {P_MINE, "mine"},
130     {P_SWEEP, "sweep"},
131     {P_MAR, "marine"},
132     {0, 0}
133 };
134
135 struct lookup nuke_flags[] = {
136     {N_NEUT, "neutron"},
137     {0, 0}
138 };
139
140 struct look_list {
141     union {
142         struct lchrstr *lp;
143         struct plchrstr *pp;
144         struct mchrstr *mp;
145     } l_u;
146     int tech;
147 } lookup_list[200];             /* Change this if there are ever more than 200 planes, ships
148                                    or land units. */
149 static int lookup_list_cnt = 0;
150
151 static void
152 sort_lookup_list(void)
153 {
154     struct natstr *np = getnatp(player->cnum);
155     struct look_list tmp;
156     int i;
157     int j;
158
159     if (!(np->nat_flags & NF_TECHLISTS))
160         return;
161     for (i = 0; i < lookup_list_cnt; i++) {
162         for (j = i; j < lookup_list_cnt; j++) {
163             if (lookup_list[j].tech < lookup_list[i].tech) {
164                 tmp = lookup_list[j];
165                 lookup_list[j] = lookup_list[i];
166                 lookup_list[i] = tmp;
167             }
168         }
169     }
170 }
171
172 static void
173 make_new_list(int tlev, int type)
174 {
175     struct plchrstr *pp;
176     struct lchrstr *lp;
177     struct mchrstr *mp;
178     int count;
179
180     lookup_list_cnt = 0;
181     if (type == EF_PLANE) {
182         for (pp = plchr, count = 0; count < pln_maxno; count++, pp++) {
183             if (pp->pl_tech > tlev)
184                 continue;
185             if (pp->pl_name == 0 || pp->pl_name[0] == '\0')
186                 continue;
187             lookup_list[lookup_list_cnt].l_u.pp = pp;
188             lookup_list[lookup_list_cnt].tech = pp->pl_tech;
189             lookup_list_cnt++;
190         }
191     } else if (type == EF_SHIP) {
192         for (mp = mchr, count = 0; count < shp_maxno; count++, mp++) {
193             if (mp->m_tech > tlev)
194                 continue;
195             if (mp->m_name == 0 || mp->m_name[0] == '\0')
196                 continue;
197             lookup_list[lookup_list_cnt].l_u.mp = mp;
198             lookup_list[lookup_list_cnt].tech = mp->m_tech;
199             lookup_list_cnt++;
200         }
201     } else if (type == EF_LAND) {
202         for (lp = lchr, count = 0; count < lnd_maxno; count++, lp++) {
203             if (lp->l_tech > tlev)
204                 continue;
205             if (lp->l_name == 0 || lp->l_name[0] == '\0')
206                 continue;
207             lookup_list[lookup_list_cnt].l_u.lp = lp;
208             lookup_list[lookup_list_cnt].tech = lp->l_tech;
209             lookup_list_cnt++;
210         }
211     } else
212         return;
213
214     sort_lookup_list();
215 }
216
217 static s_char *
218 lookup(int key, struct lookup *table)
219 {
220     int match;
221
222     if ((match = intmatch(key, &table->key, sizeof(*table))) < 0)
223         return 0;
224     return table[match].value;
225 }
226
227 void
228 show_bridge(int tlev)
229 {
230     if (tlev < buil_bt)
231         return;
232     pr("Bridges require %g tech,", buil_bt);
233     if (!opt_NO_HCMS)
234         pr(" %d hcm,", buil_bh);
235     else if (!opt_NO_LCMS)
236         pr(" %d lcm,", buil_bh);
237     pr(" %d workers,\n", 0);
238     pr("%d available workforce, and cost $%g\n",
239        (SCT_BLD_WORK(0, buil_bh) * SCT_MINEFF + 99) / 100,
240        buil_bc);
241 }
242
243 void
244 show_tower(int tlev)
245 {
246     if (tlev < buil_tower_bt)
247         return;
248     pr("Bridge Towers require %g tech,", buil_tower_bt);
249     if (!opt_NO_HCMS)
250         pr(" %d hcm,", buil_tower_bh);
251     else if (!opt_NO_LCMS)
252         pr(" %d lcm,", buil_tower_bh);
253     pr(" %d workers,\n", 0);
254     pr("%d available workforce, and cost $%g\n",
255        (SCT_BLD_WORK(0, buil_tower_bh) * SCT_MINEFF + 99) / 100,
256        buil_tower_bc);
257 }
258
259 void
260 show_nuke_stats(int tlev)
261 {
262     show_nuke_capab(tlev);
263 }
264
265 void
266 show_nuke_build(int tlev)
267 {
268     register struct nchrstr *np;
269     register int n;
270     register int avail;
271
272     if (opt_DRNUKE)
273         pr("%13s lcm hcm  oil  rad avail tech res $\n", "");
274     else
275         pr("%13s lcm hcm  oil  rad avail tech $\n", "");
276
277     if (opt_NONUKES)
278         return;
279     for (np = nchr, n = 0; n < N_MAXNUKE; np++, n++) {
280         avail = NUK_BLD_WORK(np->n_lcm, np->n_hcm, np->n_oil, np->n_rad);
281         if (np->n_tech > tlev)
282             continue;
283         if (np->n_name == 0 || np->n_name[0] == '\0')
284             continue;
285         if (opt_NEUTRON == 0 && (np->n_flags & N_NEUT))
286             continue;
287         if (opt_DRNUKE)
288             pr("%-13.13s %3d %3d %4d %4d %5d %4d %3d $%6d\n",
289                np->n_name, np->n_lcm, np->n_hcm, np->n_oil,
290                np->n_rad, avail, np->n_tech,
291                (int)(np->n_tech * drnuke_const) + 1, np->n_cost);
292         else                    /* not DRNUKE */
293             pr("%-13.13s %3d %3d %4d %4d %5d %4d $%6d\n",
294                np->n_name, np->n_lcm, np->n_hcm, np->n_oil,
295                np->n_rad, avail, np->n_tech, np->n_cost);
296     }
297 }
298
299 void
300 show_nuke_capab(int tlev)
301 {
302     register struct nchrstr *np;
303     register int i, j, n;
304     s_char *p;
305
306     if (opt_DRNUKE)
307         pr("%13s blst dam lbs tech res $%7s abilities\n", "", "");
308     else
309         pr("%13s blst dam lbs tech $%7s abilities\n", "", "");
310
311     if (opt_NONUKES)
312         return;
313     for (np = nchr, n = 0; n < N_MAXNUKE; np++, n++) {
314         if (np->n_tech > tlev)
315             continue;
316         if (opt_NEUTRON == 0 && (np->n_flags & N_NEUT))
317             continue;
318         if (np->n_name == 0 || np->n_name[0] == '\0')
319             continue;
320         if (opt_DRNUKE)
321             pr("%-13.13s %4d %3d %3d %4d %3d $%7d ",
322                np->n_name, np->n_blast, np->n_dam,
323                np->n_weight, np->n_tech,
324                (int)(np->n_tech * drnuke_const) + 1, np->n_cost);
325         else                    /* not DRNUKE */
326             pr("%-13.13s %4d %3d %3d %4d $%7d ",
327                np->n_name, np->n_blast, np->n_dam,
328                np->n_weight, np->n_tech, np->n_cost);
329
330         for (i = j = 0; i < 32; i++) {
331             if (!(np->n_flags & bit(i)))
332                 continue;
333             if (NULL != (p = lookup(bit(i), nuke_flags))) {
334                 if (j++ > 0)
335                     pr(" ");
336                 pr(p);
337             }
338         }
339         pr("\n");
340     }
341 }
342
343 void
344 show_ship_build(int tlev)
345 {
346     register struct mchrstr *mp;
347     register int n;
348
349     pr("%25s lcm hcm avail tech $\n", "");
350     make_new_list(tlev, EF_SHIP);
351     for (n = 0; n < lookup_list_cnt; n++) {
352         mp = (struct mchrstr *)lookup_list[n].l_u.mp;
353         /* Can't show trade ships unless it's turned on */
354         if ((mp->m_flags & M_TRADE) && !opt_TRADESHIPS)
355             continue;
356
357         pr("%-25.25s %3d %3d %5d %4d $%d\n",
358            mp->m_name, mp->m_lcm, mp->m_hcm,
359            SHP_BLD_WORK(mp->m_lcm, mp->m_hcm), mp->m_tech, mp->m_cost);
360     }
361 }
362
363 void
364 show_ship_stats(int tlev)
365 {
366     register struct mchrstr *mp;
367     int scount;
368     int techdiff;
369
370     pr("%25s      s  v  s  r  f  l  p", "");
371     pr("  h");
372     pr("  x");
373     if (opt_FUEL)
374         pr("  fuel");
375     pr("\n");
376
377     pr("%25s      p  i  p  n  i  n  l", "");
378     pr("  e");
379     pr("  p");
380     if (opt_FUEL)
381         pr("   c/u");
382     pr("\n");
383
384     pr("%25s def  d  s  y  g  r  d  n", "");
385     pr("  l");
386     pr("  l");
387     if (opt_FUEL)
388         pr("      ");
389     pr("\n");
390
391
392     make_new_list(tlev, EF_SHIP);
393     for (scount = 0; scount < lookup_list_cnt; scount++) {
394         mp = (struct mchrstr *)lookup_list[scount].l_u.mp;
395         /* Can't show trade ships unless it's turned on */
396         if ((mp->m_flags & M_TRADE) && !opt_TRADESHIPS)
397             continue;
398
399         techdiff = (int)(tlev - mp->m_tech);
400         pr("%-25.25s %3d %2d %2d %2d %2d %2d ",
401            mp->m_name,
402            (short)SHP_DEF(mp->m_armor, techdiff),
403            (short)SHP_SPD(mp->m_speed, techdiff),
404            (short)SHP_VIS(mp->m_visib, techdiff),
405            mp->m_vrnge,
406            (short)SHP_RNG(mp->m_frnge, techdiff),
407            (short)SHP_FIR(mp->m_glim, techdiff));
408
409         pr("%2d ", mp->m_nland);
410         pr("%2d ", mp->m_nplanes);
411         pr("%2d ", mp->m_nchoppers);
412         pr("%2d ", mp->m_nxlight);
413         if (opt_FUEL)
414             pr("%3d/%1d ", mp->m_fuelc, mp->m_fuelu);
415         pr("\n");
416     }
417 }
418
419 void
420 show_ship_capab(int tlev)
421 {
422     register struct mchrstr *mp;
423     register u_short *ap;
424     register u_char *type;
425     register int i;
426     register int it;
427     int scount;
428     int n;
429     s_char c;
430     s_char *p;
431
432     pr("%25s cargos & capabilities\n", "");
433
434     make_new_list(tlev, EF_SHIP);
435     for (scount = 0; scount < lookup_list_cnt; scount++) {
436         mp = (struct mchrstr *)lookup_list[scount].l_u.mp;
437         /* Can't show trade ships unless it's turned on */
438         if ((mp->m_flags & M_TRADE) && !opt_TRADESHIPS)
439             continue;
440
441         pr("%-25.25s ", mp->m_name);
442
443         /*
444          * should use vector stuff
445          */
446         for (ap = mp->m_vamt, type = mp->m_vtype, i = 0;
447              i < mp->m_nv; i++, ap++, type++) {
448             it = unitem((int)*type);
449             if (it > 0 && it <= I_MAX && ichr[it].i_name != 0)
450                 c = ichr[it].i_name[0];
451             else
452                 c = '?';
453             pr(" %d%c", *ap, c);
454         }
455         pr(" ");
456         for (i = n = 0; i < 32; i++) {
457             if (!(mp->m_flags & bit(i)))
458                 continue;
459             if (NULL != (p = lookup(bit(i), ship_flags))) {
460                 if (n++ > 0)
461                     pr(" ");
462                 pr(p);
463             }
464         }
465         pr("\n");
466     }
467 }
468
469 void
470 show_plane_stats(int tlev)
471 {
472     register struct plchrstr *pp;
473     int pcount;
474
475     pr("%25s acc load att def ran fuel stlth\n", "");
476     make_new_list(tlev, EF_PLANE);
477     for (pcount = 0; pcount < lookup_list_cnt; pcount++) {
478         pp = (struct plchrstr *)lookup_list[pcount].l_u.pp;
479         pr("%-25.25s %3d %4d %3d %3d %3d %4d ",
480            pp->pl_name,
481            (int)PLN_ACC(pp->pl_acc, (int)(tlev - pp->pl_tech)),
482            (int)PLN_LOAD(pp->pl_load, (int)(tlev - pp->pl_tech)),
483            (int)PLN_ATTDEF(pp->pl_att, (int)(tlev - pp->pl_tech)),
484            (int)PLN_ATTDEF(pp->pl_def, (int)(tlev - pp->pl_tech)),
485            (int)PLN_RAN(pp->pl_range, (int)(tlev - pp->pl_tech)),
486            pp->pl_fuel);
487         pr("%4d%% ", pp->pl_stealth);
488         pr("\n");
489     }
490 }
491
492 void
493 show_plane_capab(int tlev)
494 {
495     register struct plchrstr *pp;
496     register int i;
497     int pcount;
498     int n;
499     s_char *p;
500
501     pr("%25s capabilities\n", "");
502     make_new_list(tlev, EF_PLANE);
503     for (pcount = 0; pcount < lookup_list_cnt; pcount++) {
504         pp = (struct plchrstr *)lookup_list[pcount].l_u.pp;
505         pr("%-25.25s  ", pp->pl_name);
506
507         for (i = n = 0; i < 32; i++) {
508             if (!(pp->pl_flags & bit(i)))
509                 continue;
510             if (NULL != (p = lookup(bit(i), plane_flags))) {
511                 if (n++ > 0)
512                     pr(" ");
513                 pr(p);
514             }
515         }
516         pr("\n");
517     }
518 }
519
520 void
521 show_plane_build(int tlev)
522 {
523     register struct plchrstr *pp;
524     register int pcount;
525
526     pr("%25s lcm hcm crew avail tech  $\n", "");
527     make_new_list(tlev, EF_PLANE);
528     for (pcount = 0; pcount < lookup_list_cnt; pcount++) {
529         pp = (struct plchrstr *)lookup_list[pcount].l_u.pp;
530         pr("%-25.25s %3d %3d %3d %5d %4d $%d\n",
531            pp->pl_name, pp->pl_lcm,
532            pp->pl_hcm, pp->pl_crew,
533            PLN_BLD_WORK(pp->pl_lcm, pp->pl_hcm), pp->pl_tech, pp->pl_cost);
534     }
535 }
536
537 void
538 show_land_build(int tlev)
539 {
540     register struct lchrstr *lp;
541     register int n;
542
543     pr("%25s lcm hcm guns avail tech  $\n", "");
544     make_new_list(tlev, EF_LAND);
545     for (n = 0; n < lookup_list_cnt; n++) {
546         lp = (struct lchrstr *)lookup_list[n].l_u.lp;
547         if ((lp->l_flags & L_SPY) && !opt_LANDSPIES)
548             continue;
549         pr("%-25.25s %3d %3d %4d %5d %4d  $%d\n",
550            lp->l_name, lp->l_lcm,
551            lp->l_hcm,
552            lp->l_gun,
553            LND_BLD_WORK(lp->l_lcm, lp->l_hcm), lp->l_tech, lp->l_cost);
554     }
555 }
556
557 void
558 show_land_capab(int tlev)
559 {
560     struct lchrstr *lcp;
561     int lcount;
562     register u_short *ap;
563     register u_char *type;
564     register int i, n;
565     register int it;
566     register s_char *p, c;
567
568     pr("%25s capabilities\n", "");
569
570     make_new_list(tlev, EF_LAND);
571     for (lcount = 0; lcount < lookup_list_cnt; lcount++) {
572         lcp = (struct lchrstr *)lookup_list[lcount].l_u.lp;
573         if ((lcp->l_flags & L_SPY) && !opt_LANDSPIES)
574             continue;
575
576         pr("%-25s ", lcp->l_name);
577
578         /*
579          * should use vector stuff
580          */
581         for (ap = lcp->l_vamt, type = lcp->l_vtype, i = 0;
582              i < lcp->l_nv; i++, ap++, type++) {
583             it = unitem((int)*type);
584             if (it > 0 && it <= I_MAX && ichr[it].i_name != 0)
585                 c = ichr[it].i_name[0];
586             else
587                 c = '?';
588             pr(" %d%c", *ap, c);
589         }
590         pr(" ");
591         for (i = n = 0; i < 32; i++) {
592             if (!(lcp->l_flags & bit(i)))
593                 continue;
594             if (NULL != (p = lookup(bit(i), land_flags))) {
595                 if (n++ > 0)
596                     pr(" ");
597                 pr(p);
598             }
599         }
600         pr("\n");
601     }
602 }
603
604 void
605 show_land_stats(int tlev)
606 {
607     struct lchrstr *lcp;
608     int lcount;
609     int ourtlev;
610
611     pr("%25s              s  v  s  r  r  a  f  a  a        x  l\n", "");
612     pr("%25s              p  i  p  a  n  c  i  m  a  f  f  p  n\n", "");
613     pr("%25s att def vul  d  s  y  d  g  c  r  m  f  c  u  l  d\n", "");
614
615     make_new_list(tlev, EF_LAND);
616     for (lcount = 0; lcount < lookup_list_cnt; lcount++) {
617         lcp = (struct lchrstr *)lookup_list[lcount].l_u.lp;
618         if ((lcp->l_flags & L_SPY) && !opt_LANDSPIES)
619             continue;
620
621         ourtlev = (int)(tlev - lcp->l_tech);
622         pr("%-25s %1.1f %1.1f %3d ",
623            lcp->l_name, (float)LND_ATTDEF(lcp->l_att, ourtlev),
624            (float)LND_ATTDEF(lcp->l_def, ourtlev),
625            (int)LND_VUL(lcp->l_vul, ourtlev));
626         pr("%2d %2d %2d %2d ",
627            (int)LND_SPD(lcp->l_spd, ourtlev),
628            (int)LND_VIS(lcp->l_vis, ourtlev),
629            (int)LND_SPY(lcp->l_spy, ourtlev),
630            (int)LND_RAD(lcp->l_rad, ourtlev));
631         pr("%2d %2d %2d %2d %2d ",
632            (int)LND_FRG(lcp->l_frg, ourtlev),
633            (int)LND_ACC(lcp->l_acc, ourtlev),
634            (int)LND_DAM(lcp->l_dam, ourtlev),
635            (int)LND_AMM(lcp->l_ammo, lcp->l_dam, ourtlev),
636            (int)LND_AAF(lcp->l_aaf, ourtlev));
637         pr("%2d %2d %2d %2d ",
638            (int)LND_FC(lcp->l_fuelc, ourtlev),
639            (int)LND_FU(lcp->l_fuelu, ourtlev),
640            (int)LND_XPL(lcp->l_nxlight, ourtlev),
641            (int)LND_MXL(lcp->l_mxland, ourtlev));
642
643         pr("\n");
644     }
645 }
646
647 void
648 show_sect_build(int foo)
649 {
650     register int x, first = 1;
651
652     for (x = 5; x < SCT_MAXDEF + 2; x++) {
653         if (dchr[x].d_mnem == 0)
654             continue;
655         if ((dchr[x].d_cost > 0) || (dchr[x].d_build != 1) ||
656             (dchr[x].d_lcms > 0) || (dchr[x].d_hcms > 0)) {
657             if (first) {
658                 pr("sector type    cost to des    cost for 1%% eff   lcms for 1%%    hcms for 1%%\n");
659                 first = 0;
660             }
661             pr("%-14c %-14d %-17d %-14d %d\n",
662                dchr[x].d_mnem, dchr[x].d_cost, dchr[x].d_build,
663                dchr[x].d_lcms, dchr[x].d_hcms);
664         }
665     }
666     pr("\n");
667     pr("Infrastructure building - adding 1 point of efficiency costs:\n");
668     pr("       type          lcms    hcms    mobility    $$$$\n");
669     for (x = 0; intrchr[x].in_name; x++) {
670         pr("%-20s %4d    %4d    %8d    %4d\n", intrchr[x].in_name,
671            intrchr[x].in_lcms, intrchr[x].in_hcms,
672            intrchr[x].in_mcost, intrchr[x].in_dcost);
673     }
674 }
675
676 void
677 show_sect_stats(int foo)
678 {
679     register int x, first = 1;
680     struct sctstr sect;
681     struct natstr *natp;
682
683     natp = getnatp(player->cnum);
684     /* We fake this */
685     sect.sct_effic = 100;
686     for (x = 0; x < SCT_MAXDEF + 2; x++) {
687         if (dchr[x].d_mnem == 0)
688             continue;
689         if (first) {
690             pr("                        base     max   max   --  packing bonus  --   max\n");
691             pr("  sector type           mcost    off   def   mil  uw civ bar other   pop\n");
692             first = 0;
693         }
694         sect.sct_type = x;
695         pr("%c %-23s %3d  %5.2f %5.2f   %3d %3d %3d %3d %5d %5d\n",
696            dchr[x].d_mnem, dchr[x].d_name,
697            dchr[x].d_mcst, dchr[x].d_ostr,
698            dchr[x].d_dstr,
699            ichr[I_MILIT].i_pkg[dchr[x].d_pkg],
700            ichr[I_UW].i_pkg[dchr[x].d_pkg],
701            ichr[I_CIVIL].i_pkg[dchr[x].d_pkg],
702            ichr[I_BAR].i_pkg[dchr[x].d_pkg],
703            ichr[I_LCM].i_pkg[dchr[x].d_pkg],
704            max_pop(natp->nat_level[NAT_RLEV], &sect));
705     }
706 }
707
708 void
709 show_sect_capab(int foo)
710 {
711     register int x, first = 1, i, j;
712     char *tmpstr;
713     char c;
714     char *outputs = " cmsgpidbfolhur";
715
716     for (x = 0; x < SCT_MAXDEF + 2; x++) {
717         if ((dchr[x].d_mnem == 0) || (dchr[x].d_prd == 0))
718             continue;
719         if (first) {
720             pr("                                                 --- level ---          reso \n");
721             pr("  sector type             product use1 use2 use3 level min lag eff%% $$$ dep c\n");
722             first = 0;
723         }
724
725         j = dchr[x].d_prd;
726
727         pr("%c %-23s %-7s ", dchr[x].d_mnem, dchr[x].d_name,
728            pchr[j].p_sname);
729         /*for(i=0;i<MAXCHRNV;i++) */
730         /* XXX currently no more than 3 items actually used */
731         for (i = 0; i < 3; i++) {
732             if ((i < pchr[j].p_nv) && (pchr[j].p_vamt[i] > 0)) {
733                 pr("%2d %c ", pchr[j].p_vamt[i],
734                    ichr[pchr[j].p_vtype[i] & (~VT_ITEM)].i_name[0]);
735             } else {
736                 pr("     ");
737             }
738         }
739         switch (pchr[j].p_nlndx) {
740         case NAT_TLEV:
741             tmpstr = "tech";
742             break;
743         case NAT_ELEV:
744             tmpstr = "edu";
745             break;
746         case NAT_RLEV:
747             tmpstr = "res";
748             break;
749         case NAT_HLEV:
750             tmpstr = "hap";
751             break;
752         default:
753             tmpstr = " ";
754             break;
755         }
756         if (pchr[j].p_type)
757             c = outputs[pchr[j].p_type - VT_ITEM];
758         else
759             c = ' ';
760         pr("%-5s %3d %3d %4d %3d %3d %c",
761            tmpstr,
762            pchr[j].p_nlmin,
763            pchr[j].p_nllag,
764            pchr[j].p_effic, pchr[j].p_cost, pchr[j].p_nrdep, c);
765
766         pr("\n");
767     }
768 }