]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/show.c
COPYING duplicates information from README. Remove. Move GPL from
[empserver] / src / lib / subs / show.c
index d8ca82f7c218a4d35088b7995f7e344a04ac1ff6..c14282c2f9ff5fc40bf476768eeb85ea96ab0653 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2005, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -19,9 +19,9 @@
  *
  *  ---
  *
- *  See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- *  related information and legal notices. It is expected that any future
- *  projects/authors will amend these files as needed.
+ *  See files README, COPYING and CREDITS in the root of the source
+ *  tree for related information and legal notices.  It is expected
+ *  that future projects/authors will amend these files as needed.
  *
  *  ---
  *
@@ -41,6 +41,8 @@
  *                                    (bailey@mcs.kent.edu)
  */
 
+#include <config.h>
+
 #include <math.h>
 #include "misc.h"
 #include "player.h"
@@ -54,6 +56,7 @@
 #include "file.h"
 #include "nat.h"
 #include "prototypes.h"
+#include "nsc.h"
 
 struct look_list {
     union {
@@ -125,18 +128,6 @@ make_new_list(int tlev, int type)
     sort_lookup_list();
 }
 
-static char *
-lookup(int key, struct symbol *table)
-{
-    int i;
-
-    for (i = 0; table[i].name; i++)
-       if (key == table[i].value)
-           return table[i].name;
-
-    return NULL;
-}
-
 void
 show_bridge(int tlev)
 {
@@ -175,24 +166,17 @@ show_nuke_build(int tlev)
     struct nchrstr *np;
     int avail;
 
-    if (opt_DRNUKE)
-       pr("%13s lcm hcm  oil  rad avail tech res $\n", "");
-    else
-       pr("%13s lcm hcm  oil  rad avail tech $\n", "");
+    pr("%13s lcm hcm  oil  rad avail tech res $\n", "");
 
     for (np = nchr; np->n_name; np++) {
        avail = NUK_BLD_WORK(np->n_lcm, np->n_hcm, np->n_oil, np->n_rad);
        if (np->n_tech > tlev)
            continue;
-       if (opt_DRNUKE)
-           pr("%-13.13s %3d %3d %4d %4d %5d %4d %3d $%6d\n",
-              np->n_name, np->n_lcm, np->n_hcm, np->n_oil,
-              np->n_rad, avail, np->n_tech,
-              (int)(np->n_tech * drnuke_const) + 1, np->n_cost);
-       else
-           pr("%-13.13s %3d %3d %4d %4d %5d %4d $%6d\n",
-              np->n_name, np->n_lcm, np->n_hcm, np->n_oil,
-              np->n_rad, avail, np->n_tech, np->n_cost);
+       pr("%-13.13s %3d %3d %4d %4d %5d %4d %3d $%6d\n",
+          np->n_name, np->n_lcm, np->n_hcm, np->n_oil,
+          np->n_rad, avail, np->n_tech,
+          opt_DRNUKE ? (int)(np->n_tech * drnuke_const) + 1 : 0,
+          np->n_cost);
     }
 }
 
@@ -203,28 +187,20 @@ show_nuke_capab(int tlev)
     int i, j;
     char *p;
 
-    if (opt_DRNUKE)
-       pr("%13s blst dam lbs tech res $%7s abilities\n", "", "");
-    else
-       pr("%13s blst dam lbs tech $%7s abilities\n", "", "");
+    pr("%13s blst dam lbs tech res $%7s abilities\n", "", "");
 
     for (np = nchr; np->n_name; np++) {
        if (np->n_tech > tlev)
            continue;
-       if (opt_DRNUKE)
-           pr("%-13.13s %4d %3d %3d %4d %3d $%7d ",
-              np->n_name, np->n_blast, np->n_dam,
-              np->n_weight, np->n_tech,
-              (int)(np->n_tech * drnuke_const) + 1, np->n_cost);
-       else                    /* not DRNUKE */
-           pr("%-13.13s %4d %3d %3d %4d $%7d ",
-              np->n_name, np->n_blast, np->n_dam,
-              np->n_weight, np->n_tech, np->n_cost);
-
+       pr("%-13.13s %4d %3d %3d %4d %3d $%7d ",
+          np->n_name, np->n_blast, np->n_dam,
+          np->n_weight, np->n_tech,
+          opt_DRNUKE ? (int)(np->n_tech * drnuke_const) + 1 : 0,
+          np->n_cost);
        for (i = j = 0; i < 32; i++) {
            if (!(np->n_flags & bit(i)))
                continue;
-           if (NULL != (p = lookup(bit(i), nuke_chr_flags))) {
+           if (NULL != (p = symbol_by_value(bit(i), nuke_chr_flags))) {
                if (j++ > 0)
                    pr(" ");
                pr(p);
@@ -338,7 +314,7 @@ show_ship_capab(int tlev)
        for (j = n = 0; j < 32; j++) {
            if (!(mp->m_flags & bit(j)))
                continue;
-           if (NULL != (p = lookup(bit(j), ship_chr_flags))) {
+           if (NULL != (p = symbol_by_value(bit(j), ship_chr_flags))) {
                if (n++ > 0)
                    pr(" ");
                pr(p);
@@ -389,7 +365,7 @@ show_plane_capab(int tlev)
        for (i = n = 0; i < 32; i++) {
            if (!(pp->pl_flags & bit(i)))
                continue;
-           if (NULL != (p = lookup(bit(i), plane_chr_flags))) {
+           if (NULL != (p = symbol_by_value(bit(i), plane_chr_flags))) {
                if (n++ > 0)
                    pr(" ");
                pr(p);
@@ -462,7 +438,7 @@ show_land_capab(int tlev)
        for (j = n = 0; j < 32; j++) {
            if (!(lcp->l_flags & bit(j)))
                continue;
-           if (NULL != (p = lookup(bit(j), land_chr_flags))) {
+           if (NULL != (p = symbol_by_value(bit(j), land_chr_flags))) {
                if (n++ > 0)
                    pr(" ");
                pr(p);