src/lib/commands/peek.c

Go to the documentation of this file.
00001 /*
00002  *  Empire - A multi-player, client/server Internet based war game.
00003  *  Copyright (C) 1986-2007, Dave Pare, Jeff Bailey, Thomas Ruschak,
00004  *                           Ken Stevens, Steve McClure
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  *  ---
00021  *
00022  *  See files README, COPYING and CREDITS in the root of the source
00023  *  tree for related information and legal notices.  It is expected
00024  *  that future projects/authors will amend these files as needed.
00025  *
00026  *  ---
00027  *
00028  *  peek.c: Show hidden values report (deity)
00029  * 
00030  *  Known contributors to this file:
00031  *     Jeff Wallace, 1989
00032  *     Pat Loney, 1998
00033  *     Steve McClure, 1998
00034  */
00035 
00036 #include <config.h>
00037 
00038 #include "commands.h"
00039 
00040 int
00041 peek(void)
00042 {
00043     struct sctstr sect;
00044     int nsect;
00045     struct nstr_sect nstr;
00046 
00047     if (!snxtsct(&nstr, player->argp[1]))
00048         return RET_SYN;
00049     prdate();
00050     nsect = 0;
00051     while (nxtsct(&nstr, &sect)) {
00052         if (!player->owner)
00053             continue;
00054         if (nsect++ == 0) {
00055             pr("    HIDDEN VALUES           che-------  plague----\n");
00056             pr("own   sect        eff loyal cnum value  stage time mines\n");
00057         }
00058         pr("%3d ", sect.sct_own);
00059         prxy("%4d,%-4d", nstr.x, nstr.y, player->cnum);
00060         pr(" %c  %3d%%   %3d  %3d  %3d    %3d   %3d  %3d",
00061            dchr[sect.sct_type].d_mnem, sect.sct_effic,
00062            sect.sct_loyal, sect.sct_che_target, sect.sct_che,
00063            sect.sct_pstage, sect.sct_ptime, sect.sct_mines);
00064         pr("\n");
00065     }
00066     if (nsect == 0) {
00067         if (player->argp[1])
00068             pr("%s: No sector(s)\n", player->argp[1]);
00069         else
00070             pr("%s: No sector(s)\n", "");
00071         return RET_FAIL;
00072     } else
00073         pr("%d sector%s\n", nsect, splur(nsect));
00074     return 0;
00075 }

Generated on Fri Mar 28 11:01:12 2008 for empserver by  doxygen 1.5.2