/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
* ---
*
* show.c: General show routines
- *
+ *
* Known contributors to this file:
* Julian Onions, 1988
* Jeff Bailey, 1990
* Steve McClure, 1996
- * Ron Koenderink, 2005
+ * Ron Koenderink, 2005-2009
* Markus Armbruster, 2006-2008
*/
#include <config.h>
-#if defined(_WIN32)
-#include <Windows.h>
-#endif
-
#include <math.h>
#include "file.h"
#include "game.h"
void
show_sect_build(int foo)
{
- int x, first;
+ int i, first;
- pr("sector type cost to des cost for 1%% eff lcms for 1%% hcms for 1%%\n");
- for (x = 0; dchr[x].d_name; x++) {
- if (dchr[x].d_mnem == 0)
+ pr(" desig build 100%% eff maint\n"
+ "sector type $ lcm hcm $ $\n");
+ for (i = 0; dchr[i].d_name; i++) {
+ if (dchr[i].d_mnem == 0)
continue;
- if (dchr[x].d_cost < 0)
+ if (dchr[i].d_mob0 < 0)
continue;
- if ((dchr[x].d_cost > 0) || (dchr[x].d_build != 1) ||
- (dchr[x].d_lcms > 0) || (dchr[x].d_hcms > 0)) {
- pr("%-14c %-14d %-17d %-14d %d\n",
- dchr[x].d_mnem, dchr[x].d_cost, dchr[x].d_build,
- dchr[x].d_lcms, dchr[x].d_hcms);
- }
+ if (dchr[i].d_cost <= 0 && dchr[i].d_build == 1
+ && dchr[i].d_lcms == 0 && dchr[i].d_hcms == 0
+ && dchr[i].d_maint == 0)
+ continue; /* the usual, skip */
+ pr("%c %-21.21s", dchr[i].d_mnem, dchr[i].d_name);
+ if (dchr[i].d_cost < 0)
+ pr(" can't");
+ else
+ pr(" %5d", dchr[i].d_cost);
+ pr(" %5d%5d %5d %5d\n",
+ 100 * dchr[i].d_lcms,
+ 100 * dchr[i].d_hcms,
+ 100 * dchr[i].d_build,
+ dchr[i].d_maint * etu_per_update);
}
- pr("other 0 1 0 0\n");
+ pr("any other 0 0 0 100 0\n");
first = 1;
- for (x = 0; intrchr[x].in_name; x++) {
- if (!intrchr[x].in_enable)
+ for (i = 0; intrchr[i].in_name; i++) {
+ if (!intrchr[i].in_enable)
continue;
if (first)
pr("\nInfrastructure building - adding 1 point of efficiency costs:\n"
" type lcms hcms mobility $$$$\n");
pr("%-20s %4d %4d %8d %4d\n",
- intrchr[x].in_name, intrchr[x].in_lcms, intrchr[x].in_hcms,
- intrchr[x].in_mcost, intrchr[x].in_dcost);
+ intrchr[i].in_name, intrchr[i].in_lcms, intrchr[i].in_hcms,
+ intrchr[i].in_mcost, intrchr[i].in_dcost);
first = 0;
}
}
void
show_sect_stats(int foo)
{
- int x, first = 1;
- struct natstr *natp;
+ int i;
+ struct natstr *natp = getnatp(player->cnum);
- natp = getnatp(player->cnum);
- for (x = 0; dchr[x].d_name; x++) {
- if (dchr[x].d_mnem == 0)
+ pr(" mob cost max max naviga packing max\n");
+ pr(" sector type 0%% 100%% off def bility bonus pop\n");
+
+ for (i = 0; dchr[i].d_name; i++) {
+ if (dchr[i].d_mnem == 0)
continue;
- if (first) {
- pr(" mob cost max max -- packing bonus -- max\n");
- pr(" sector type 0%% 100%% off def mil uw civ bar other pop\n");
- first = 0;
- }
- pr("%c %-21.21s", dchr[x].d_mnem, dchr[x].d_name);
- if (dchr[x].d_mob0 < 0)
+ pr("%c %-21.21s", dchr[i].d_mnem, dchr[i].d_name);
+ if (dchr[i].d_mob0 < 0)
pr(" no way ");
else
- pr(" %3.1f %3.1f", dchr[x].d_mob0, dchr[x].d_mob1);
- pr(" %5.2f %5.2f %3d %3d %3d %3d %5d %5d\n",
- dchr[x].d_ostr, dchr[x].d_dstr,
- ichr[I_MILIT].i_pkg[dchr[x].d_pkg],
- ichr[I_UW].i_pkg[dchr[x].d_pkg],
- ichr[I_CIVIL].i_pkg[dchr[x].d_pkg],
- ichr[I_BAR].i_pkg[dchr[x].d_pkg],
- ichr[I_LCM].i_pkg[dchr[x].d_pkg],
- max_population(natp->nat_level[NAT_RLEV], x, 100));
+ pr(" %3.1f %3.1f", dchr[i].d_mob0, dchr[i].d_mob1);
+ pr(" %5.2f %5.2f %7.7s %10.10s %5d\n",
+ dchr[i].d_ostr, dchr[i].d_dstr,
+ symbol_by_value(dchr[i].d_nav, sector_navigation),
+ symbol_by_value(dchr[i].d_pkg, packing),
+ max_population(natp->nat_level[NAT_RLEV], i, 100));
}
}
void
show_sect_capab(int foo)
{
- int x, first = 1, i, j;
- char *tmpstr;
-
- for (x = 0; dchr[x].d_name; x++) {
- if (dchr[x].d_mnem == 0 || dchr[x].d_prd < 0)
- continue;
- if (first) {
- pr(" --- level --- reso \n");
- pr(" sector type product use1 use2 use3 level min lag eff%% $$$ dep c\n");
- first = 0;
- }
-
- j = dchr[x].d_prd;
+ int i;
- pr("%c %-23s %-7s ",
- dchr[x].d_mnem, dchr[x].d_name, pchr[j].p_sname);
- (void)CANT_HAPPEN(MAXPRCON > 3); /* output has only three columns */
- for (i = 0; i < 3; i++) {
- if (i < MAXPRCON
- && pchr[j].p_camt[i]
- && pchr[j].p_ctype[i] > I_NONE
- && pchr[j].p_ctype[i] <= I_MAX) {
- pr("%2d %c ", pchr[j].p_camt[i],
- ichr[pchr[j].p_ctype[i]].i_name[0]);
- } else {
- pr(" ");
- }
- }
- switch (pchr[j].p_nlndx) {
- case NAT_TLEV:
- tmpstr = "tech";
- break;
- case NAT_ELEV:
- tmpstr = "edu";
- break;
- case NAT_RLEV:
- tmpstr = "res";
- break;
- case NAT_HLEV:
- tmpstr = "hap";
- break;
- default:
- tmpstr = " ";
- break;
- }
- pr("%-5s %3d %3d %4d %3d %3d %c",
- tmpstr,
- pchr[j].p_nlmin,
- pchr[j].p_nllag,
- dchr[x].d_peffic, pchr[j].p_cost, pchr[j].p_nrdep,
- pchr[j].p_type != I_NONE ? ichr[pchr[j].p_type].i_mnem : ' ');
+ pr(" sector type product p.e.\n");
- pr("\n");
+ for (i = 0; dchr[i].d_name; i++) {
+ if (dchr[i].d_mnem == 0 || dchr[i].d_prd < 0)
+ continue;
+ pr("%c %-23s %-7s %4d%%\n",
+ dchr[i].d_mnem, dchr[i].d_name, pchr[dchr[i].d_prd].p_sname,
+ dchr[i].d_peffic);
}
}
struct ichrstr *ip;
pr("item value sell lbs packing melt item\n");
- pr("mnem in rg wh ur bk deno name\n");
+ pr("mnem in no wh ur bk deno name\n");
for (ip = ichr; ip->i_name; ip++) {
pr(" %c %5d %4s %3d %2d %2d %2d %2d %2d %4d %s\n",
}
}
+void
+show_product(int tlev)
+{
+ struct pchrstr *pp;
+ int i;
+ char *lev;
+
+ pr("product cost raw materials reso dep level p.e.\n");
+
+ for (pp = pchr; pp->p_sname; pp++) {
+ pr("%7.7s %c $%-3d ",
+ pp->p_sname,
+ pp->p_type < 0 ? ' ' : ichr[pp->p_type].i_mnem,
+ pp->p_cost);
+ (void)CANT_HAPPEN(MAXPRCON > 3); /* output has only three columns */
+ for (i = 0; i < 3; i++) {
+ if (i < MAXPRCON && pp->p_camt[i]
+ && pp->p_ctype[i] > I_NONE && pp->p_ctype[i] <= I_MAX)
+ pr(" %2d%c", pp->p_camt[i], ichr[pp->p_ctype[i]].i_mnem);
+ else
+ pr(" ");
+ }
+ if (pp->p_nrndx)
+ pr(" %5.5s %3d ",
+ symbol_by_value(pp->p_nrndx, resources), pp->p_nrdep);
+ else
+ pr(" ");
+ if (pp->p_nlndx < 0)
+ pr("1.0\n");
+ else {
+ lev = symbol_by_value(pp->p_nlndx, level);
+ pr("(%.4s%+d)/(%.4s%+d)\n",
+ lev, -pp->p_nlmin, lev, pp->p_nllag - pp->p_nlmin);
+ }
+ }
+}
+
void
show_news(int tlev)
{
int i, j;
-
+
pr("id category good will\n");
pr(" messsages\n");
TIME_ZONE_INFORMATION tzi;
long time_offset;
struct tm *time;
-
+
time = localtime(&t);
n = strftime(buf, sizeof(buf), "%a, %d %b %Y %H:%M:%S", time);