]> git.pond.sub.org Git - empserver/blob - src/lib/subs/show.c
(I_NONE, I_CIVIL, I_MILIT, I_SHELL, I_GUN, I_PETROL, I_IRON, I_DUST,
[empserver] / src / lib / subs / show.c
1 /*
2  *  Empire - A multi-player, client/server Internet based war game.
3  *  Copyright (C) 1986-2004, 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     struct mchrstr *mp;
423     i_type i;
424     int j;
425     int scount;
426     int n;
427     s_char *p;
428
429     pr("%25s cargos & capabilities\n", "");
430
431     make_new_list(tlev, EF_SHIP);
432     for (scount = 0; scount < lookup_list_cnt; scount++) {
433         mp = (struct mchrstr *)lookup_list[scount].l_u.mp;
434         /* Can't show trade ships unless it's turned on */
435         if ((mp->m_flags & M_TRADE) && !opt_TRADESHIPS)
436             continue;
437
438         pr("%-25.25s ", mp->m_name);
439
440         for (i = I_NONE + 1; i <= I_MAX; ++i)
441             if (mp->m_item[i])
442                 pr(" %d%c", mp->m_item[i], ichr[i].i_mnem);
443         pr(" ");
444         for (j = n = 0; j < 32; j++) {
445             if (!(mp->m_flags & bit(j)))
446                 continue;
447             if (NULL != (p = lookup(bit(j), ship_flags))) {
448                 if (n++ > 0)
449                     pr(" ");
450                 pr(p);
451             }
452         }
453         pr("\n");
454     }
455 }
456
457 void
458 show_plane_stats(int tlev)
459 {
460     register struct plchrstr *pp;
461     int pcount;
462
463     pr("%25s acc load att def ran fuel stlth\n", "");
464     make_new_list(tlev, EF_PLANE);
465     for (pcount = 0; pcount < lookup_list_cnt; pcount++) {
466         pp = (struct plchrstr *)lookup_list[pcount].l_u.pp;
467         pr("%-25.25s %3d %4d %3d %3d %3d %4d ",
468            pp->pl_name,
469            (int)PLN_ACC(pp->pl_acc, (int)(tlev - pp->pl_tech)),
470            (int)PLN_LOAD(pp->pl_load, (int)(tlev - pp->pl_tech)),
471            (int)PLN_ATTDEF(pp->pl_att, (int)(tlev - pp->pl_tech)),
472            (int)PLN_ATTDEF(pp->pl_def, (int)(tlev - pp->pl_tech)),
473            (int)PLN_RAN(pp->pl_range, (int)(tlev - pp->pl_tech)),
474            pp->pl_fuel);
475         pr("%4d%% ", pp->pl_stealth);
476         pr("\n");
477     }
478 }
479
480 void
481 show_plane_capab(int tlev)
482 {
483     register struct plchrstr *pp;
484     register int i;
485     int pcount;
486     int n;
487     s_char *p;
488
489     pr("%25s capabilities\n", "");
490     make_new_list(tlev, EF_PLANE);
491     for (pcount = 0; pcount < lookup_list_cnt; pcount++) {
492         pp = (struct plchrstr *)lookup_list[pcount].l_u.pp;
493         pr("%-25.25s  ", pp->pl_name);
494
495         for (i = n = 0; i < 32; i++) {
496             if (!(pp->pl_flags & bit(i)))
497                 continue;
498             if (NULL != (p = lookup(bit(i), plane_flags))) {
499                 if (n++ > 0)
500                     pr(" ");
501                 pr(p);
502             }
503         }
504         pr("\n");
505     }
506 }
507
508 void
509 show_plane_build(int tlev)
510 {
511     register struct plchrstr *pp;
512     register int pcount;
513
514     pr("%25s lcm hcm crew avail tech $\n", "");
515     make_new_list(tlev, EF_PLANE);
516     for (pcount = 0; pcount < lookup_list_cnt; pcount++) {
517         pp = (struct plchrstr *)lookup_list[pcount].l_u.pp;
518         pr("%-25.25s %3d %3d %4d %5d %4d $%d\n",
519            pp->pl_name, pp->pl_lcm,
520            pp->pl_hcm, pp->pl_crew,
521            PLN_BLD_WORK(pp->pl_lcm, pp->pl_hcm), pp->pl_tech, pp->pl_cost);
522     }
523 }
524
525 void
526 show_land_build(int tlev)
527 {
528     register struct lchrstr *lp;
529     register int n;
530
531     pr("%25s lcm hcm guns avail tech $\n", "");
532     make_new_list(tlev, EF_LAND);
533     for (n = 0; n < lookup_list_cnt; n++) {
534         lp = (struct lchrstr *)lookup_list[n].l_u.lp;
535         if ((lp->l_flags & L_SPY) && !opt_LANDSPIES)
536             continue;
537         pr("%-25.25s %3d %3d %4d %5d %4d $%d\n",
538            lp->l_name, lp->l_lcm,
539            lp->l_hcm,
540            lp->l_gun,
541            LND_BLD_WORK(lp->l_lcm, lp->l_hcm), lp->l_tech, lp->l_cost);
542     }
543 }
544
545 void
546 show_land_capab(int tlev)
547 {
548     struct lchrstr *lcp;
549     int lcount;
550     i_type i;
551     int j, n;
552     s_char *p;
553
554     pr("%25s capabilities\n", "");
555
556     make_new_list(tlev, EF_LAND);
557     for (lcount = 0; lcount < lookup_list_cnt; lcount++) {
558         lcp = (struct lchrstr *)lookup_list[lcount].l_u.lp;
559         if ((lcp->l_flags & L_SPY) && !opt_LANDSPIES)
560             continue;
561
562         pr("%-25s ", lcp->l_name);
563
564         for (i = I_NONE + 1; i <= I_MAX; ++i)
565             if (lcp->l_item[i])
566                 pr(" %d%c", lcp->l_item[i], ichr[i].i_mnem);
567         pr(" ");
568         for (j = n = 0; j < 32; j++) {
569             if (!(lcp->l_flags & bit(j)))
570                 continue;
571             if (NULL != (p = lookup(bit(j), land_flags))) {
572                 if (n++ > 0)
573                     pr(" ");
574                 pr(p);
575             }
576         }
577         pr("\n");
578     }
579 }
580
581 void
582 show_land_stats(int tlev)
583 {
584     struct lchrstr *lcp;
585     int lcount;
586     int ourtlev;
587
588     pr("%25s              s  v  s  r  r  a  f  a  a        x  l\n", "");
589     pr("%25s              p  i  p  a  n  c  i  m  a  f  f  p  n\n", "");
590     pr("%25s att def vul  d  s  y  d  g  c  r  m  f  c  u  l  d\n", "");
591
592     make_new_list(tlev, EF_LAND);
593     for (lcount = 0; lcount < lookup_list_cnt; lcount++) {
594         lcp = (struct lchrstr *)lookup_list[lcount].l_u.lp;
595         if ((lcp->l_flags & L_SPY) && !opt_LANDSPIES)
596             continue;
597
598         ourtlev = (int)(tlev - lcp->l_tech);
599         pr("%-25s %1.1f %1.1f %3d ",
600            lcp->l_name, (float)LND_ATTDEF(lcp->l_att, ourtlev),
601            (float)LND_ATTDEF(lcp->l_def, ourtlev),
602            (int)LND_VUL(lcp->l_vul, ourtlev));
603         pr("%2d %2d %2d %2d ",
604            (int)LND_SPD(lcp->l_spd, ourtlev),
605            (int)LND_VIS(lcp->l_vis, ourtlev),
606            (int)LND_SPY(lcp->l_spy, ourtlev),
607            (int)LND_RAD(lcp->l_rad, ourtlev));
608         pr("%2d %2d %2d %2d %2d ",
609            (int)LND_FRG(lcp->l_frg, ourtlev),
610            (int)LND_ACC(lcp->l_acc, ourtlev),
611            (int)LND_DAM(lcp->l_dam, ourtlev),
612            (int)LND_AMM(lcp->l_ammo, lcp->l_dam, ourtlev),
613            (int)LND_AAF(lcp->l_aaf, ourtlev));
614         pr("%2d %2d %2d %2d ",
615            (int)LND_FC(lcp->l_fuelc, ourtlev),
616            (int)LND_FU(lcp->l_fuelu, ourtlev),
617            (int)LND_XPL(lcp->l_nxlight, ourtlev),
618            (int)LND_MXL(lcp->l_mxland, ourtlev));
619
620         pr("\n");
621     }
622 }
623
624 void
625 show_sect_build(int foo)
626 {
627     register int x, first = 1;
628
629     for (x = 0; x <= SCT_MAXDEF; x++) {
630         if (dchr[x].d_mnem == 0)
631             continue;
632         if ((dchr[x].d_cost > 0) || (dchr[x].d_build != 1) ||
633             (dchr[x].d_lcms > 0) || (dchr[x].d_hcms > 0)) {
634             if (first) {
635                 pr("sector type    cost to des    cost for 1%% eff   lcms for 1%%    hcms for 1%%\n");
636                 first = 0;
637             }
638             pr("%-14c %-14d %-17d %-14d %d\n",
639                dchr[x].d_mnem, dchr[x].d_cost, dchr[x].d_build,
640                dchr[x].d_lcms, dchr[x].d_hcms);
641         }
642     }
643     pr("\n");
644     pr("Infrastructure building - adding 1 point of efficiency costs:\n");
645     pr("       type          lcms    hcms    mobility    $$$$\n");
646     for (x = 0; intrchr[x].in_name; x++) {
647         pr("%-20s %4d    %4d    %8d    %4d\n", intrchr[x].in_name,
648            intrchr[x].in_lcms, intrchr[x].in_hcms,
649            intrchr[x].in_mcost, intrchr[x].in_dcost);
650     }
651 }
652
653 void
654 show_sect_stats(int foo)
655 {
656     register int x, first = 1;
657     struct sctstr sect;
658     struct natstr *natp;
659
660     natp = getnatp(player->cnum);
661     /* We fake this */
662     sect.sct_effic = 100;
663     for (x = 0; x <= SCT_MAXDEF; x++) {
664         if (dchr[x].d_mnem == 0)
665             continue;
666         if (first) {
667             pr("                        base     max   max   --  packing bonus  --   max\n");
668             pr("  sector type           mcost    off   def   mil  uw civ bar other   pop\n");
669             first = 0;
670         }
671         sect.sct_type = x;
672         pr("%c %-23s %3d  %5.2f %5.2f   %3d %3d %3d %3d %5d %5d\n",
673            dchr[x].d_mnem, dchr[x].d_name,
674            dchr[x].d_mcst, dchr[x].d_ostr,
675            dchr[x].d_dstr,
676            ichr[I_MILIT].i_pkg[dchr[x].d_pkg],
677            ichr[I_UW].i_pkg[dchr[x].d_pkg],
678            ichr[I_CIVIL].i_pkg[dchr[x].d_pkg],
679            ichr[I_BAR].i_pkg[dchr[x].d_pkg],
680            ichr[I_LCM].i_pkg[dchr[x].d_pkg],
681            max_pop(natp->nat_level[NAT_RLEV], &sect));
682     }
683 }
684
685 void
686 show_sect_capab(int foo)
687 {
688     register int x, first = 1, i, j;
689     char *tmpstr;
690
691     for (x = 0; x <= SCT_MAXDEF; x++) {
692         if ((dchr[x].d_mnem == 0) || (dchr[x].d_prd == 0))
693             continue;
694         if (first) {
695             pr("                                                 --- level ---          reso \n");
696             pr("  sector type             product use1 use2 use3 level min lag eff%% $$$ dep c\n");
697             first = 0;
698         }
699
700         j = dchr[x].d_prd;
701
702         pr("%c %-23s %-7s ", dchr[x].d_mnem, dchr[x].d_name,
703            pchr[j].p_sname);
704         (void)CANT_HAPPEN(MAXPRCON > 3); /* output has only three columns */
705         for (i = 0; i < 3; i++) {
706             if (i < MAXPRCON
707                 && pchr[j].p_camt[i]
708                 && pchr[j].p_ctype[i] > I_NONE
709                 && pchr[j].p_ctype[i] <= I_MAX) {
710                 pr("%2d %c ", pchr[j].p_camt[i],
711                    ichr[pchr[j].p_ctype[i]].i_name[0]);
712             } else {
713                 pr("     ");
714             }
715         }
716         switch (pchr[j].p_nlndx) {
717         case NAT_TLEV:
718             tmpstr = "tech";
719             break;
720         case NAT_ELEV:
721             tmpstr = "edu";
722             break;
723         case NAT_RLEV:
724             tmpstr = "res";
725             break;
726         case NAT_HLEV:
727             tmpstr = "hap";
728             break;
729         default:
730             tmpstr = " ";
731             break;
732         }
733         pr("%-5s %3d %3d %4d %3d %3d %c",
734            tmpstr,
735            pchr[j].p_nlmin,
736            pchr[j].p_nllag,
737            pchr[j].p_effic, pchr[j].p_cost, pchr[j].p_nrdep,
738            pchr[j].p_type ? ichr[pchr[j].p_type].i_mnem : ' ');
739
740         pr("\n");
741     }
742 }