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