/*
* 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
*
* ---
*
- * 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.
*
* ---
*
* (bailey@mcs.kent.edu)
*/
+#include <config.h>
+
#include <math.h>
#include "misc.h"
#include "player.h"
#include "file.h"
#include "nat.h"
#include "prototypes.h"
+#include "nsc.h"
struct look_list {
union {
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)
{
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);
}
}
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);
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);
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);
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);