]> git.pond.sub.org Git - empserver/blob - src/lib/subs/show.c
(show_land_build, show_plane_build): Adjust the position of the $ column to match
[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 int i;
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 = 0; 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 (i = n = 0; i < 32; i++) {
444             if (!(mp->m_flags & bit(i)))
445                 continue;
446             if (NULL != (p = lookup(bit(i), 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     register 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     register struct plchrstr *pp;
483     register 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     register struct plchrstr *pp;
511     register 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     register struct lchrstr *lp;
528     register 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     register int i, n;
550     register s_char *p;
551
552     pr("%25s capabilities\n", "");
553
554     make_new_list(tlev, EF_LAND);
555     for (lcount = 0; lcount < lookup_list_cnt; lcount++) {
556         lcp = (struct lchrstr *)lookup_list[lcount].l_u.lp;
557         if ((lcp->l_flags & L_SPY) && !opt_LANDSPIES)
558             continue;
559
560         pr("%-25s ", lcp->l_name);
561
562         for (i = 0; i <= I_MAX; ++i)
563             if (lcp->l_item[i])
564                 pr(" %d%c", lcp->l_item[i], ichr[i].i_mnem);
565         pr(" ");
566         for (i = n = 0; i < 32; i++) {
567             if (!(lcp->l_flags & bit(i)))
568                 continue;
569             if (NULL != (p = lookup(bit(i), land_flags))) {
570                 if (n++ > 0)
571                     pr(" ");
572                 pr(p);
573             }
574         }
575         pr("\n");
576     }
577 }
578
579 void
580 show_land_stats(int tlev)
581 {
582     struct lchrstr *lcp;
583     int lcount;
584     int ourtlev;
585
586     pr("%25s              s  v  s  r  r  a  f  a  a        x  l\n", "");
587     pr("%25s              p  i  p  a  n  c  i  m  a  f  f  p  n\n", "");
588     pr("%25s att def vul  d  s  y  d  g  c  r  m  f  c  u  l  d\n", "");
589
590     make_new_list(tlev, EF_LAND);
591     for (lcount = 0; lcount < lookup_list_cnt; lcount++) {
592         lcp = (struct lchrstr *)lookup_list[lcount].l_u.lp;
593         if ((lcp->l_flags & L_SPY) && !opt_LANDSPIES)
594             continue;
595
596         ourtlev = (int)(tlev - lcp->l_tech);
597         pr("%-25s %1.1f %1.1f %3d ",
598            lcp->l_name, (float)LND_ATTDEF(lcp->l_att, ourtlev),
599            (float)LND_ATTDEF(lcp->l_def, ourtlev),
600            (int)LND_VUL(lcp->l_vul, ourtlev));
601         pr("%2d %2d %2d %2d ",
602            (int)LND_SPD(lcp->l_spd, ourtlev),
603            (int)LND_VIS(lcp->l_vis, ourtlev),
604            (int)LND_SPY(lcp->l_spy, ourtlev),
605            (int)LND_RAD(lcp->l_rad, ourtlev));
606         pr("%2d %2d %2d %2d %2d ",
607            (int)LND_FRG(lcp->l_frg, ourtlev),
608            (int)LND_ACC(lcp->l_acc, ourtlev),
609            (int)LND_DAM(lcp->l_dam, ourtlev),
610            (int)LND_AMM(lcp->l_ammo, lcp->l_dam, ourtlev),
611            (int)LND_AAF(lcp->l_aaf, ourtlev));
612         pr("%2d %2d %2d %2d ",
613            (int)LND_FC(lcp->l_fuelc, ourtlev),
614            (int)LND_FU(lcp->l_fuelu, ourtlev),
615            (int)LND_XPL(lcp->l_nxlight, ourtlev),
616            (int)LND_MXL(lcp->l_mxland, ourtlev));
617
618         pr("\n");
619     }
620 }
621
622 void
623 show_sect_build(int foo)
624 {
625     register int x, first = 1;
626
627     for (x = 0; x <= SCT_MAXDEF; x++) {
628         if (dchr[x].d_mnem == 0)
629             continue;
630         if ((dchr[x].d_cost > 0) || (dchr[x].d_build != 1) ||
631             (dchr[x].d_lcms > 0) || (dchr[x].d_hcms > 0)) {
632             if (first) {
633                 pr("sector type    cost to des    cost for 1%% eff   lcms for 1%%    hcms for 1%%\n");
634                 first = 0;
635             }
636             pr("%-14c %-14d %-17d %-14d %d\n",
637                dchr[x].d_mnem, dchr[x].d_cost, dchr[x].d_build,
638                dchr[x].d_lcms, dchr[x].d_hcms);
639         }
640     }
641     pr("\n");
642     pr("Infrastructure building - adding 1 point of efficiency costs:\n");
643     pr("       type          lcms    hcms    mobility    $$$$\n");
644     for (x = 0; intrchr[x].in_name; x++) {
645         pr("%-20s %4d    %4d    %8d    %4d\n", intrchr[x].in_name,
646            intrchr[x].in_lcms, intrchr[x].in_hcms,
647            intrchr[x].in_mcost, intrchr[x].in_dcost);
648     }
649 }
650
651 void
652 show_sect_stats(int foo)
653 {
654     register int x, first = 1;
655     struct sctstr sect;
656     struct natstr *natp;
657
658     natp = getnatp(player->cnum);
659     /* We fake this */
660     sect.sct_effic = 100;
661     for (x = 0; x <= SCT_MAXDEF; x++) {
662         if (dchr[x].d_mnem == 0)
663             continue;
664         if (first) {
665             pr("                        base     max   max   --  packing bonus  --   max\n");
666             pr("  sector type           mcost    off   def   mil  uw civ bar other   pop\n");
667             first = 0;
668         }
669         sect.sct_type = x;
670         pr("%c %-23s %3d  %5.2f %5.2f   %3d %3d %3d %3d %5d %5d\n",
671            dchr[x].d_mnem, dchr[x].d_name,
672            dchr[x].d_mcst, dchr[x].d_ostr,
673            dchr[x].d_dstr,
674            ichr[I_MILIT].i_pkg[dchr[x].d_pkg],
675            ichr[I_UW].i_pkg[dchr[x].d_pkg],
676            ichr[I_CIVIL].i_pkg[dchr[x].d_pkg],
677            ichr[I_BAR].i_pkg[dchr[x].d_pkg],
678            ichr[I_LCM].i_pkg[dchr[x].d_pkg],
679            max_pop(natp->nat_level[NAT_RLEV], &sect));
680     }
681 }
682
683 void
684 show_sect_capab(int foo)
685 {
686     register int x, first = 1, i, j;
687     char *tmpstr;
688
689     for (x = 0; x <= SCT_MAXDEF; x++) {
690         if ((dchr[x].d_mnem == 0) || (dchr[x].d_prd == 0))
691             continue;
692         if (first) {
693             pr("                                                 --- level ---          reso \n");
694             pr("  sector type             product use1 use2 use3 level min lag eff%% $$$ dep c\n");
695             first = 0;
696         }
697
698         j = dchr[x].d_prd;
699
700         pr("%c %-23s %-7s ", dchr[x].d_mnem, dchr[x].d_name,
701            pchr[j].p_sname);
702         (void)CANT_HAPPEN(MAXPRCON > 3); /* output has only three columns */
703         for (i = 0; i < 3; i++) {
704             if (i < MAXPRCON
705                 && pchr[j].p_camt[i]
706                 && pchr[j].p_ctype[i] > I_NONE
707                 && pchr[j].p_ctype[i] <= I_MAX) {
708                 pr("%2d %c ", pchr[j].p_camt[i],
709                    ichr[pchr[j].p_ctype[i]].i_name[0]);
710             } else {
711                 pr("     ");
712             }
713         }
714         switch (pchr[j].p_nlndx) {
715         case NAT_TLEV:
716             tmpstr = "tech";
717             break;
718         case NAT_ELEV:
719             tmpstr = "edu";
720             break;
721         case NAT_RLEV:
722             tmpstr = "res";
723             break;
724         case NAT_HLEV:
725             tmpstr = "hap";
726             break;
727         default:
728             tmpstr = " ";
729             break;
730         }
731         pr("%-5s %3d %3d %4d %3d %3d %c",
732            tmpstr,
733            pchr[j].p_nlmin,
734            pchr[j].p_nllag,
735            pchr[j].p_effic, pchr[j].p_cost, pchr[j].p_nrdep,
736            pchr[j].p_type ? ichr[pchr[j].p_type].i_mnem : ' ');
737
738         pr("\n");
739     }
740 }