Home | History | Annotate | Line # | Download | only in phantasia
gamesupport.c revision 1.10
      1  1.10  dholland /*	$NetBSD: gamesupport.c,v 1.10 2009/05/25 23:08:45 dholland Exp $	*/
      2   1.2       cgd 
      3   1.1       jtc /*
      4   1.1       jtc  * gamesupport.c - auxiliary routines for support of Phantasia
      5   1.1       jtc  */
      6   1.1       jtc 
      7   1.1       jtc #include "include.h"
      8   1.8        he #undef bool
      9   1.7      ross #include <curses.h>
     10   1.1       jtc 
     11   1.4     lukem void
     12  1.10  dholland changestats(phbool ingameflag)
     13   1.1       jtc {
     14   1.4     lukem 	static char flag[2] =	/* for printing values of bools */
     15   1.1       jtc 	{'F', 'T'};
     16   1.4     lukem 	struct player *playerp;	/* pointer to structure to alter */
     17   1.5       jsm 	const char   *prompt;		/* pointer to prompt string */
     18   1.4     lukem 	int     c;		/* input */
     19   1.4     lukem 	int     today;		/* day of year of today */
     20   1.4     lukem 	int     temp;		/* temporary variable */
     21   1.4     lukem 	long    loc;		/* location in player file */
     22   1.4     lukem 	time_t  now;		/* time now */
     23   1.4     lukem 	double  dtemp;		/* temporary variable */
     24   1.9       jsm 	phbool *bptr;		/* pointer to bool item to change */
     25   1.4     lukem 	double *dptr;		/* pointer to double item to change */
     26   1.4     lukem 	short  *sptr;		/* pointer to short item to change */
     27   1.1       jtc 
     28   1.4     lukem 	clear();
     29   1.1       jtc 
     30   1.4     lukem 	for (;;)
     31   1.4     lukem 		/* get name of player to examine/alter */
     32   1.1       jtc 	{
     33   1.4     lukem 		mvaddstr(5, 0, "Which character do you want to look at ? ");
     34   1.4     lukem 		getstring(Databuf, SZ_DATABUF);
     35   1.4     lukem 		truncstring(Databuf);
     36   1.1       jtc 
     37   1.4     lukem 		if (Databuf[0] == '\0')
     38   1.4     lukem 			userlist(ingameflag);
     39   1.4     lukem 		else
     40   1.4     lukem 			break;
     41   1.1       jtc 	}
     42   1.1       jtc 
     43   1.4     lukem 	loc = -1L;
     44   1.1       jtc 
     45   1.4     lukem 	if (!ingameflag)
     46   1.4     lukem 		/* use 'Player' structure */
     47   1.4     lukem 		playerp = &Player;
     48   1.4     lukem 	else
     49   1.4     lukem 		if (strcmp(Databuf, Player.p_name) == 0)
     50   1.4     lukem 			/* alter/examine current player */
     51   1.4     lukem 		{
     52   1.4     lukem 			playerp = &Player;
     53   1.4     lukem 			loc = Fileloc;
     54   1.4     lukem 		} else
     55   1.4     lukem 			/* use 'Other' structure */
     56   1.4     lukem 			playerp = &Other;
     57   1.4     lukem 
     58   1.4     lukem 	/* find player on file */
     59   1.4     lukem 	if (loc < 0L && (loc = findname(Databuf, playerp)) < 0L)
     60   1.4     lukem 		/* didn't find player */
     61   1.1       jtc 	{
     62   1.4     lukem 		clear();
     63   1.4     lukem 		mvaddstr(11, 0, "Not found.");
     64   1.4     lukem 		return;
     65   1.1       jtc 	}
     66   1.4     lukem 	time(&now);
     67   1.4     lukem 	today = localtime(&now)->tm_yday;
     68   1.4     lukem 
     69   1.1       jtc 	clear();
     70   1.1       jtc 
     71   1.4     lukem 	for (;;)
     72   1.4     lukem 		/* print player structure, and prompt for action */
     73   1.1       jtc 	{
     74   1.4     lukem 		mvprintw(0, 0, "A:Name         %s\n", playerp->p_name);
     75   1.1       jtc 
     76   1.4     lukem 		if (Wizard)
     77   1.4     lukem 			printw("B:Password     %s\n", playerp->p_password);
     78   1.4     lukem 		else
     79   1.4     lukem 			addstr("B:Password     XXXXXXXX\n");
     80   1.1       jtc 
     81   1.4     lukem 		printw(" :Login        %s\n", playerp->p_login);
     82   1.1       jtc 
     83   1.4     lukem 		printw("C:Experience   %.0f\n", playerp->p_experience);
     84   1.4     lukem 		printw("D:Level        %.0f\n", playerp->p_level);
     85   1.4     lukem 		printw("E:Strength     %.0f\n", playerp->p_strength);
     86   1.4     lukem 		printw("F:Sword        %.0f\n", playerp->p_sword);
     87   1.4     lukem 		printw(" :Might        %.0f\n", playerp->p_might);
     88   1.4     lukem 		printw("G:Energy       %.0f\n", playerp->p_energy);
     89   1.4     lukem 		printw("H:Max-Energy   %.0f\n", playerp->p_maxenergy);
     90   1.4     lukem 		printw("I:Shield       %.0f\n", playerp->p_shield);
     91   1.4     lukem 		printw("J:Quickness    %.0f\n", playerp->p_quickness);
     92   1.4     lukem 		printw("K:Quicksilver  %.0f\n", playerp->p_quksilver);
     93   1.4     lukem 		printw(" :Speed        %.0f\n", playerp->p_speed);
     94   1.4     lukem 		printw("L:Magic Level  %.0f\n", playerp->p_magiclvl);
     95   1.4     lukem 		printw("M:Mana         %.0f\n", playerp->p_mana);
     96   1.4     lukem 		printw("N:Brains       %.0f\n", playerp->p_brains);
     97   1.4     lukem 
     98   1.4     lukem 		if (Wizard || playerp->p_specialtype != SC_VALAR)
     99   1.4     lukem 			mvaddstr(0, 40, descrstatus(playerp));
    100   1.4     lukem 
    101   1.4     lukem 		mvprintw(1, 40, "O:Poison       %0.3f\n", playerp->p_poison);
    102   1.4     lukem 		mvprintw(2, 40, "P:Gold         %.0f\n", playerp->p_gold);
    103   1.4     lukem 		mvprintw(3, 40, "Q:Gem          %.0f\n", playerp->p_gems);
    104   1.4     lukem 		mvprintw(4, 40, "R:Sin          %0.3f\n", playerp->p_sin);
    105   1.4     lukem 		if (Wizard) {
    106   1.4     lukem 			mvprintw(5, 40, "S:X-coord      %.0f\n", playerp->p_x);
    107   1.4     lukem 			mvprintw(6, 40, "T:Y-coord      %.0f\n", playerp->p_y);
    108   1.4     lukem 		} else {
    109   1.4     lukem 			mvaddstr(5, 40, "S:X-coord      ?\n");
    110   1.4     lukem 			mvaddstr(6, 40, "T:Y-coord      ?\n");
    111   1.1       jtc 		}
    112   1.1       jtc 
    113   1.4     lukem 		mvprintw(7, 40, "U:Age          %ld\n", playerp->p_age);
    114   1.4     lukem 		mvprintw(8, 40, "V:Degenerated  %d\n", playerp->p_degenerated);
    115   1.1       jtc 
    116   1.4     lukem 		mvprintw(9, 40, "W:Type         %d (%s)\n",
    117   1.4     lukem 		    playerp->p_type, descrtype(playerp, FALSE) + 1);
    118   1.4     lukem 		mvprintw(10, 40, "X:Special Type %d\n", playerp->p_specialtype);
    119   1.4     lukem 		mvprintw(11, 40, "Y:Lives        %d\n", playerp->p_lives);
    120   1.4     lukem 		mvprintw(12, 40, "Z:Crowns       %d\n", playerp->p_crowns);
    121   1.4     lukem 		mvprintw(13, 40, "0:Charms       %d\n", playerp->p_charms);
    122   1.4     lukem 		mvprintw(14, 40, "1:Amulets      %d\n", playerp->p_amulets);
    123   1.4     lukem 		mvprintw(15, 40, "2:Holy Water   %d\n", playerp->p_holywater);
    124   1.4     lukem 
    125   1.4     lukem 		temp = today - playerp->p_lastused;
    126   1.4     lukem 		if (temp < 0)
    127   1.4     lukem 			/* last year */
    128   1.4     lukem 			temp += 365;
    129   1.4     lukem 		mvprintw(16, 40, "3:Lastused     %d  (%d)\n", playerp->p_lastused, temp);
    130   1.4     lukem 
    131   1.4     lukem 		mvprintw(18, 8, "4:Palantir %c  5:Blessing %c  6:Virgin %c  7:Blind %c",
    132   1.4     lukem 		    flag[(int)playerp->p_palantir],
    133   1.4     lukem 		    flag[(int)playerp->p_blessing],
    134   1.4     lukem 		    flag[(int)playerp->p_virgin],
    135   1.4     lukem 		    flag[(int)playerp->p_blindness]);
    136   1.1       jtc 
    137   1.1       jtc 		if (!Wizard)
    138   1.4     lukem 			mvprintw(19, 8, "8:Ring    %c",
    139   1.4     lukem 			    flag[playerp->p_ring.ring_type != R_NONE]);
    140   1.1       jtc 		else
    141   1.4     lukem 			mvprintw(19, 8, "8:Ring    %d  9:Duration %d",
    142   1.4     lukem 			    playerp->p_ring.ring_type, playerp->p_ring.ring_duration);
    143   1.1       jtc 
    144   1.4     lukem 		if (!Wizard
    145   1.4     lukem 		/* not wizard */
    146   1.4     lukem 		    && (ingameflag || strcmp(Login, playerp->p_login) != 0))
    147   1.4     lukem 			/* in game or not examining own character */
    148   1.4     lukem 		{
    149   1.4     lukem 			if (ingameflag) {
    150   1.4     lukem 				more(LINES - 1);
    151   1.4     lukem 				clear();
    152   1.4     lukem 				return;
    153   1.4     lukem 			} else
    154   1.4     lukem 				cleanup(TRUE);
    155   1.4     lukem 			/* NOTREACHED */
    156   1.4     lukem 		}
    157   1.4     lukem 		mvaddstr(20, 0, "!:Quit       ?:Delete");
    158   1.4     lukem 		mvaddstr(21, 0, "What would you like to change ? ");
    159   1.4     lukem 
    160   1.4     lukem 		if (Wizard)
    161   1.4     lukem 			c = getanswer(" ", TRUE);
    162   1.4     lukem 		else
    163   1.4     lukem 			/* examining own player; allow to change name and
    164   1.4     lukem 			 * password */
    165   1.4     lukem 			c = getanswer("!BA", FALSE);
    166   1.4     lukem 
    167   1.4     lukem 		switch (c) {
    168   1.4     lukem 		case 'A':	/* change name */
    169   1.4     lukem 		case 'B':	/* change password */
    170   1.4     lukem 			if (!Wizard)
    171   1.4     lukem 				/* prompt for password */
    172   1.1       jtc 			{
    173   1.4     lukem 				mvaddstr(23, 0, "Password ? ");
    174   1.4     lukem 				Echo = FALSE;
    175   1.4     lukem 				getstring(Databuf, 9);
    176   1.4     lukem 				Echo = TRUE;
    177   1.4     lukem 				if (strcmp(Databuf, playerp->p_password) != 0)
    178   1.4     lukem 					continue;
    179   1.1       jtc 			}
    180   1.4     lukem 			if (c == 'A')
    181   1.4     lukem 				/* get new name */
    182   1.4     lukem 			{
    183   1.4     lukem 				mvaddstr(23, 0, "New name: ");
    184   1.4     lukem 				getstring(Databuf, SZ_NAME);
    185   1.4     lukem 				truncstring(Databuf);
    186   1.4     lukem 				if (Databuf[0] != '\0')
    187   1.4     lukem 					if (Wizard || findname(Databuf, &Other) < 0L)
    188   1.4     lukem 						strcpy(playerp->p_name, Databuf);
    189   1.4     lukem 			} else
    190   1.4     lukem 				/* get new password */
    191   1.4     lukem 			{
    192   1.4     lukem 				if (!Wizard)
    193   1.4     lukem 					Echo = FALSE;
    194   1.1       jtc 
    195   1.4     lukem 				do
    196   1.4     lukem 					/* get two copies of new password
    197   1.4     lukem 					 * until they match */
    198   1.4     lukem 				{
    199   1.4     lukem 					/* get first copy */
    200   1.4     lukem 					mvaddstr(23, 0, "New password ? ");
    201   1.4     lukem 					getstring(Databuf, SZ_PASSWORD);
    202   1.4     lukem 					if (Databuf[0] == '\0')
    203   1.4     lukem 						break;
    204   1.4     lukem 
    205   1.4     lukem 					/* get second copy */
    206   1.4     lukem 					mvaddstr(23, 0, "One more time ? ");
    207   1.4     lukem 					getstring(playerp->p_password, SZ_PASSWORD);
    208   1.4     lukem 				}
    209   1.4     lukem 				while (strcmp(playerp->p_password, Databuf) != 0);
    210   1.1       jtc 
    211   1.4     lukem 				Echo = TRUE;
    212   1.4     lukem 			}
    213   1.4     lukem 
    214   1.4     lukem 			continue;
    215   1.4     lukem 
    216   1.4     lukem 		case 'C':	/* change experience */
    217   1.4     lukem 			prompt = "experience";
    218   1.4     lukem 			dptr = &playerp->p_experience;
    219   1.4     lukem 			goto DALTER;
    220   1.4     lukem 
    221   1.4     lukem 		case 'D':	/* change level */
    222   1.4     lukem 			prompt = "level";
    223   1.4     lukem 			dptr = &playerp->p_level;
    224   1.4     lukem 			goto DALTER;
    225   1.4     lukem 
    226   1.4     lukem 		case 'E':	/* change strength */
    227   1.4     lukem 			prompt = "strength";
    228   1.4     lukem 			dptr = &playerp->p_strength;
    229   1.4     lukem 			goto DALTER;
    230   1.4     lukem 
    231   1.4     lukem 		case 'F':	/* change swords */
    232   1.4     lukem 			prompt = "sword";
    233   1.4     lukem 			dptr = &playerp->p_sword;
    234   1.4     lukem 			goto DALTER;
    235   1.4     lukem 
    236   1.4     lukem 		case 'G':	/* change energy */
    237   1.4     lukem 			prompt = "energy";
    238   1.4     lukem 			dptr = &playerp->p_energy;
    239   1.4     lukem 			goto DALTER;
    240   1.4     lukem 
    241   1.4     lukem 		case 'H':	/* change maximum energy */
    242   1.4     lukem 			prompt = "max energy";
    243   1.4     lukem 			dptr = &playerp->p_maxenergy;
    244   1.4     lukem 			goto DALTER;
    245   1.4     lukem 
    246   1.4     lukem 		case 'I':	/* change shields */
    247   1.4     lukem 			prompt = "shield";
    248   1.4     lukem 			dptr = &playerp->p_shield;
    249   1.4     lukem 			goto DALTER;
    250   1.4     lukem 
    251   1.4     lukem 		case 'J':	/* change quickness */
    252   1.4     lukem 			prompt = "quickness";
    253   1.4     lukem 			dptr = &playerp->p_quickness;
    254   1.4     lukem 			goto DALTER;
    255   1.4     lukem 
    256   1.4     lukem 		case 'K':	/* change quicksilver */
    257   1.4     lukem 			prompt = "quicksilver";
    258   1.4     lukem 			dptr = &playerp->p_quksilver;
    259   1.4     lukem 			goto DALTER;
    260   1.4     lukem 
    261   1.4     lukem 		case 'L':	/* change magic */
    262   1.4     lukem 			prompt = "magic level";
    263   1.4     lukem 			dptr = &playerp->p_magiclvl;
    264   1.4     lukem 			goto DALTER;
    265   1.4     lukem 
    266   1.4     lukem 		case 'M':	/* change mana */
    267   1.4     lukem 			prompt = "mana";
    268   1.4     lukem 			dptr = &playerp->p_mana;
    269   1.4     lukem 			goto DALTER;
    270   1.4     lukem 
    271   1.4     lukem 		case 'N':	/* change brains */
    272   1.4     lukem 			prompt = "brains";
    273   1.4     lukem 			dptr = &playerp->p_brains;
    274   1.4     lukem 			goto DALTER;
    275   1.4     lukem 
    276   1.4     lukem 		case 'O':	/* change poison */
    277   1.4     lukem 			prompt = "poison";
    278   1.4     lukem 			dptr = &playerp->p_poison;
    279   1.4     lukem 			goto DALTER;
    280   1.4     lukem 
    281   1.4     lukem 		case 'P':	/* change gold */
    282   1.4     lukem 			prompt = "gold";
    283   1.4     lukem 			dptr = &playerp->p_gold;
    284   1.4     lukem 			goto DALTER;
    285   1.4     lukem 
    286   1.4     lukem 		case 'Q':	/* change gems */
    287   1.4     lukem 			prompt = "gems";
    288   1.4     lukem 			dptr = &playerp->p_gems;
    289   1.4     lukem 			goto DALTER;
    290   1.4     lukem 
    291   1.4     lukem 		case 'R':	/* change sin */
    292   1.4     lukem 			prompt = "sin";
    293   1.4     lukem 			dptr = &playerp->p_sin;
    294   1.4     lukem 			goto DALTER;
    295   1.4     lukem 
    296   1.4     lukem 		case 'S':	/* change x coord */
    297   1.4     lukem 			prompt = "x";
    298   1.4     lukem 			dptr = &playerp->p_x;
    299   1.4     lukem 			goto DALTER;
    300   1.4     lukem 
    301   1.4     lukem 		case 'T':	/* change y coord */
    302   1.4     lukem 			prompt = "y";
    303   1.4     lukem 			dptr = &playerp->p_y;
    304   1.4     lukem 			goto DALTER;
    305   1.4     lukem 
    306   1.4     lukem 		case 'U':	/* change age */
    307   1.4     lukem 			mvprintw(23, 0, "age = %ld; age = ", playerp->p_age);
    308   1.4     lukem 			dtemp = infloat();
    309   1.4     lukem 			if (dtemp != 0.0)
    310   1.4     lukem 				playerp->p_age = (long) dtemp;
    311   1.4     lukem 			continue;
    312   1.4     lukem 
    313   1.4     lukem 		case 'V':	/* change degen */
    314   1.4     lukem 			mvprintw(23, 0, "degen = %d; degen = ", playerp->p_degenerated);
    315   1.4     lukem 			dtemp = infloat();
    316   1.4     lukem 			if (dtemp != 0.0)
    317   1.4     lukem 				playerp->p_degenerated = (int) dtemp;
    318   1.4     lukem 			continue;
    319   1.1       jtc 
    320   1.4     lukem 		case 'W':	/* change type */
    321   1.4     lukem 			prompt = "type";
    322   1.4     lukem 			sptr = &playerp->p_type;
    323   1.4     lukem 			goto SALTER;
    324   1.4     lukem 
    325   1.4     lukem 		case 'X':	/* change special type */
    326   1.4     lukem 			prompt = "special type";
    327   1.4     lukem 			sptr = &playerp->p_specialtype;
    328   1.4     lukem 			goto SALTER;
    329   1.4     lukem 
    330   1.4     lukem 		case 'Y':	/* change lives */
    331   1.4     lukem 			prompt = "lives";
    332   1.4     lukem 			sptr = &playerp->p_lives;
    333   1.4     lukem 			goto SALTER;
    334   1.4     lukem 
    335   1.4     lukem 		case 'Z':	/* change crowns */
    336   1.4     lukem 			prompt = "crowns";
    337   1.4     lukem 			sptr = &playerp->p_crowns;
    338   1.4     lukem 			goto SALTER;
    339   1.4     lukem 
    340   1.4     lukem 		case '0':	/* change charms */
    341   1.4     lukem 			prompt = "charm";
    342   1.4     lukem 			sptr = &playerp->p_charms;
    343   1.4     lukem 			goto SALTER;
    344   1.4     lukem 
    345   1.4     lukem 		case '1':	/* change amulet */
    346   1.4     lukem 			prompt = "amulet";
    347   1.4     lukem 			sptr = &playerp->p_amulets;
    348   1.4     lukem 			goto SALTER;
    349   1.4     lukem 
    350   1.4     lukem 		case '2':	/* change holy water */
    351   1.4     lukem 			prompt = "holy water";
    352   1.4     lukem 			sptr = &playerp->p_holywater;
    353   1.4     lukem 			goto SALTER;
    354   1.4     lukem 
    355   1.4     lukem 		case '3':	/* change last-used */
    356   1.4     lukem 			prompt = "last-used";
    357   1.4     lukem 			sptr = &playerp->p_lastused;
    358   1.4     lukem 			goto SALTER;
    359   1.4     lukem 
    360   1.4     lukem 		case '4':	/* change palantir */
    361   1.4     lukem 			prompt = "palantir";
    362   1.4     lukem 			bptr = &playerp->p_palantir;
    363   1.4     lukem 			goto BALTER;
    364   1.4     lukem 
    365   1.4     lukem 		case '5':	/* change blessing */
    366   1.4     lukem 			prompt = "blessing";
    367   1.4     lukem 			bptr = &playerp->p_blessing;
    368   1.4     lukem 			goto BALTER;
    369   1.4     lukem 
    370   1.4     lukem 		case '6':	/* change virgin */
    371   1.4     lukem 			prompt = "virgin";
    372   1.4     lukem 			bptr = &playerp->p_virgin;
    373   1.4     lukem 			goto BALTER;
    374   1.4     lukem 
    375   1.4     lukem 		case '7':	/* change blindness */
    376   1.4     lukem 			prompt = "blindness";
    377   1.4     lukem 			bptr = &playerp->p_blindness;
    378   1.4     lukem 			goto BALTER;
    379   1.4     lukem 
    380   1.4     lukem 		case '8':	/* change ring type */
    381   1.4     lukem 			prompt = "ring-type";
    382   1.4     lukem 			sptr = &playerp->p_ring.ring_type;
    383   1.4     lukem 			goto SALTER;
    384   1.4     lukem 
    385   1.4     lukem 		case '9':	/* change ring duration */
    386   1.4     lukem 			prompt = "ring-duration";
    387   1.4     lukem 			sptr = &playerp->p_ring.ring_duration;
    388   1.4     lukem 			goto SALTER;
    389   1.4     lukem 
    390   1.4     lukem 		case '!':	/* quit, update */
    391   1.4     lukem 			if (Wizard &&
    392   1.4     lukem 			    (!ingameflag || playerp != &Player))
    393   1.4     lukem 				/* turn off status if not modifying self */
    394   1.4     lukem 			{
    395   1.4     lukem 				playerp->p_status = S_OFF;
    396   1.4     lukem 				playerp->p_tampered = T_OFF;
    397   1.4     lukem 			}
    398   1.4     lukem 			writerecord(playerp, loc);
    399   1.4     lukem 			clear();
    400   1.4     lukem 			return;
    401   1.4     lukem 
    402   1.4     lukem 		case '?':	/* delete player */
    403   1.4     lukem 			if (ingameflag && playerp == &Player)
    404   1.4     lukem 				/* cannot delete self */
    405   1.4     lukem 				continue;
    406   1.4     lukem 
    407   1.4     lukem 			freerecord(playerp, loc);
    408   1.4     lukem 			clear();
    409   1.4     lukem 			return;
    410   1.1       jtc 
    411   1.4     lukem 		default:
    412   1.4     lukem 			continue;
    413   1.4     lukem 		}
    414   1.4     lukem DALTER:
    415   1.4     lukem 		mvprintw(23, 0, "%s = %f; %s = ", prompt, *dptr, prompt);
    416   1.1       jtc 		dtemp = infloat();
    417   1.1       jtc 		if (dtemp != 0.0)
    418   1.4     lukem 			*dptr = dtemp;
    419   1.1       jtc 		continue;
    420   1.1       jtc 
    421   1.4     lukem SALTER:
    422   1.4     lukem 		mvprintw(23, 0, "%s = %d; %s = ", prompt, *sptr, prompt);
    423   1.1       jtc 		dtemp = infloat();
    424   1.1       jtc 		if (dtemp != 0.0)
    425   1.4     lukem 			*sptr = (short) dtemp;
    426   1.1       jtc 		continue;
    427   1.1       jtc 
    428   1.4     lukem BALTER:
    429   1.4     lukem 		mvprintw(23, 0, "%s = %c; %s = ", prompt, flag[(int)*bptr],
    430   1.4     lukem 		    prompt);
    431   1.4     lukem 		c = getanswer("\nTF", TRUE);
    432   1.4     lukem 		if (c == 'T')
    433   1.4     lukem 			*bptr = TRUE;
    434   1.4     lukem 		else
    435   1.4     lukem 			if (c == 'F')
    436   1.4     lukem 				*bptr = FALSE;
    437   1.1       jtc 		continue;
    438   1.1       jtc 	}
    439   1.1       jtc }
    440   1.1       jtc 
    441   1.4     lukem void
    442  1.10  dholland monstlist(void)
    443   1.1       jtc {
    444   1.4     lukem 	int     count = 0;	/* count in file */
    445   1.1       jtc 
    446   1.4     lukem 	puts(" #)  Name                 Str  Brain  Quick  Energy  Exper  Treas  Type  Flock%\n");
    447   1.6       jsm 	fseek(Monstfp, 0L, SEEK_SET);
    448   1.4     lukem 	while (fread((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp) == 1)
    449   1.4     lukem 		printf("%2d)  %-20.20s%4.0f   %4.0f     %2.0f   %5.0f  %5.0f     %2d    %2d     %3.0f\n", count++,
    450   1.4     lukem 		    Curmonster.m_name, Curmonster.m_strength, Curmonster.m_brains,
    451   1.4     lukem 		    Curmonster.m_speed, Curmonster.m_energy, Curmonster.m_experience,
    452   1.4     lukem 		    Curmonster.m_treasuretype, Curmonster.m_type, Curmonster.m_flock);
    453   1.1       jtc }
    454   1.1       jtc 
    455   1.4     lukem void
    456  1.10  dholland scorelist(void)
    457   1.1       jtc {
    458   1.4     lukem 	struct scoreboard sbuf;	/* for reading entries */
    459   1.4     lukem 	FILE   *fp;		/* to open the file */
    460   1.1       jtc 
    461   1.4     lukem 	if ((fp = fopen(_PATH_SCORE, "r")) != NULL) {
    462   1.4     lukem 		while (fread((char *) &sbuf, SZ_SCORESTRUCT, 1, fp) == 1)
    463   1.4     lukem 			printf("%-20s   (%-9s)  Level: %6.0f  Type: %s\n",
    464   1.4     lukem 			    sbuf.sb_name, sbuf.sb_login, sbuf.sb_level, sbuf.sb_type);
    465   1.4     lukem 		fclose(fp);
    466   1.1       jtc 	}
    467   1.1       jtc }
    468   1.1       jtc 
    469   1.4     lukem void
    470  1.10  dholland activelist(void)
    471   1.1       jtc {
    472   1.6       jsm 	fseek(Playersfp, 0L, SEEK_SET);
    473   1.4     lukem 	printf("Current characters on file are:\n\n");
    474   1.1       jtc 
    475   1.4     lukem 	while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
    476   1.4     lukem 		if (Other.p_status != S_NOTUSED)
    477   1.4     lukem 			printf("%-20s   (%-9s)  Level: %6.0f  %s  (%s)\n",
    478   1.4     lukem 			    Other.p_name, Other.p_login, Other.p_level,
    479   1.4     lukem 			    descrtype(&Other, FALSE), descrstatus(&Other));
    480   1.1       jtc 
    481   1.1       jtc }
    482   1.1       jtc 
    483   1.4     lukem void
    484  1.10  dholland purgeoldplayers(void)
    485   1.1       jtc {
    486   1.4     lukem 	int     today;		/* day of year for today */
    487   1.4     lukem 	int     daysold;	/* how many days since the character has been
    488   1.4     lukem 				 * used */
    489   1.4     lukem 	time_t  ltime;		/* time in seconds */
    490   1.4     lukem 	long    loc = 0L;	/* location in file */
    491   1.4     lukem 
    492   1.4     lukem 	time(&ltime);
    493   1.4     lukem 	today = localtime(&ltime)->tm_yday;
    494   1.4     lukem 
    495   1.4     lukem 	for (;;) {
    496   1.6       jsm 		fseek(Playersfp, loc, SEEK_SET);
    497   1.4     lukem 		if (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) != 1)
    498   1.4     lukem 			break;
    499   1.4     lukem 
    500   1.4     lukem 		daysold = today - Other.p_lastused;
    501   1.4     lukem 		if (daysold < 0)
    502   1.4     lukem 			daysold += 365;
    503   1.4     lukem 
    504   1.4     lukem 		if (daysold > N_DAYSOLD)
    505   1.4     lukem 			/* player hasn't been used in a while; delete */
    506   1.4     lukem 			freerecord(&Other, loc);
    507   1.1       jtc 
    508   1.4     lukem 		loc += SZ_PLAYERSTRUCT;
    509   1.1       jtc 	}
    510   1.1       jtc }
    511   1.1       jtc 
    512   1.4     lukem void
    513  1.10  dholland enterscore(void)
    514   1.1       jtc {
    515   1.4     lukem 	struct scoreboard sbuf;	/* buffer to read in scoreboard entries */
    516   1.4     lukem 	FILE   *fp;		/* to open scoreboard file */
    517   1.4     lukem 	long    loc = 0L;	/* location in scoreboard file */
    518   1.4     lukem 	bool    found = FALSE;	/* set if we found an entry for this login */
    519   1.4     lukem 
    520   1.4     lukem 	if ((fp = fopen(_PATH_SCORE, "r+")) != NULL) {
    521   1.4     lukem 		while (fread((char *) &sbuf, SZ_SCORESTRUCT, 1, fp) == 1)
    522   1.4     lukem 			if (strcmp(Player.p_login, sbuf.sb_login) == 0) {
    523   1.4     lukem 				found = TRUE;
    524   1.4     lukem 				break;
    525   1.4     lukem 			} else
    526   1.4     lukem 				loc += SZ_SCORESTRUCT;
    527   1.4     lukem 	} else {
    528   1.4     lukem 		error(_PATH_SCORE);
    529   1.4     lukem 		/* NOTREACHED */
    530   1.1       jtc 	}
    531   1.1       jtc 
    532   1.4     lukem 	/*
    533   1.4     lukem          * At this point, 'loc' will either indicate a point beyond
    534   1.4     lukem          * the end of file, or the place where the previous entry
    535   1.4     lukem          * was found.
    536   1.4     lukem          */
    537   1.1       jtc 
    538   1.4     lukem 	if ((!found) || Player.p_level > sbuf.sb_level)
    539   1.4     lukem 		/* put new entry in for this login */
    540   1.1       jtc 	{
    541   1.4     lukem 		strcpy(sbuf.sb_login, Player.p_login);
    542   1.4     lukem 		strcpy(sbuf.sb_name, Player.p_name);
    543   1.4     lukem 		sbuf.sb_level = Player.p_level;
    544   1.4     lukem 		strcpy(sbuf.sb_type, descrtype(&Player, TRUE));
    545   1.1       jtc 	}
    546   1.4     lukem 	/* update entry */
    547   1.6       jsm 	fseek(fp, loc, SEEK_SET);
    548   1.4     lukem 	fwrite((char *) &sbuf, SZ_SCORESTRUCT, 1, fp);
    549   1.4     lukem 	fclose(fp);
    550   1.1       jtc }
    551