2006-05-11 14:23:24 +04:00
|
|
|
/* $NetBSD: diag.c,v 1.10 2006/05/11 10:23:24 mrg Exp $ */
|
1997-10-19 00:03:05 +04:00
|
|
|
|
|
|
|
/* diag.c Larn is copyrighted 1986 by Noah Morgan. */
|
|
|
|
#include <sys/cdefs.h>
|
1993-08-02 21:18:41 +04:00
|
|
|
#ifndef lint
|
2006-05-11 14:23:24 +04:00
|
|
|
__RCSID("$NetBSD: diag.c,v 1.10 2006/05/11 10:23:24 mrg Exp $");
|
1997-10-19 00:03:05 +04:00
|
|
|
#endif /* not lint */
|
1993-08-02 21:18:41 +04:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/times.h>
|
|
|
|
#include <sys/stat.h>
|
1997-10-19 00:03:05 +04:00
|
|
|
#include <stdlib.h>
|
2000-07-03 07:57:39 +04:00
|
|
|
#include <string.h>
|
1997-10-19 00:03:05 +04:00
|
|
|
#include <unistd.h>
|
1993-03-21 12:45:37 +03:00
|
|
|
#include "header.h"
|
1997-10-19 00:03:05 +04:00
|
|
|
#include "extern.h"
|
1993-03-21 12:45:37 +03:00
|
|
|
static struct tms cputime;
|
|
|
|
/*
|
|
|
|
***************************
|
|
|
|
DIAG -- dungeon diagnostics
|
|
|
|
***************************
|
|
|
|
|
|
|
|
subroutine to print out data for debugging
|
|
|
|
*/
|
|
|
|
#ifdef EXTRA
|
1997-10-19 00:03:05 +04:00
|
|
|
static int rndcount[16];
|
|
|
|
void
|
1993-03-21 12:45:37 +03:00
|
|
|
diag()
|
1997-10-19 00:03:05 +04:00
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
int hit, dam;
|
|
|
|
cursors();
|
|
|
|
lwclose();
|
|
|
|
if (lcreat(diagfile) < 0) { /* open the diagnostic file */
|
|
|
|
lcreat((char *) 0);
|
|
|
|
lprcat("\ndiagnostic failure\n");
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
write(1, "\nDiagnosing . . .\n", 18);
|
1993-03-21 12:45:37 +03:00
|
|
|
lprcat("\n\nBeginning of DIAG diagnostics ----------\n");
|
|
|
|
|
1997-10-19 00:03:05 +04:00
|
|
|
/* for the character attributes */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-19 00:03:05 +04:00
|
|
|
lprintf("\n\nPlayer attributes:\n\nHit points: %2d(%2d)", (long) c[HP], (long) c[HPMAX]);
|
1993-03-21 12:45:37 +03:00
|
|
|
lprintf("\ngold: %d Experience: %d Character level: %d Level in caverns: %d",
|
1997-10-19 00:03:05 +04:00
|
|
|
(long) c[GOLD], (long) c[EXPERIENCE], (long) c[LEVEL], (long) level);
|
|
|
|
lprintf("\nTotal types of monsters: %d", (long) MAXMONST + 8);
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
lprcat("\f\nHere's the dungeon:\n\n");
|
|
|
|
|
1997-10-19 00:03:05 +04:00
|
|
|
i = level;
|
|
|
|
for (j = 0; j < MAXLEVEL + MAXVLEVEL; j++) {
|
1993-03-21 12:45:37 +03:00
|
|
|
newcavelevel(j);
|
1997-10-19 00:03:05 +04:00
|
|
|
lprintf("\nMaze for level %s:\n", levelname[level]);
|
1993-03-21 12:45:37 +03:00
|
|
|
diagdrawscreen();
|
1997-10-19 00:03:05 +04:00
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
newcavelevel(i);
|
|
|
|
|
|
|
|
lprcat("\f\nNow for the monster data:\n\n");
|
|
|
|
lprcat(" Monster Name LEV AC DAM ATT DEF GOLD HP EXP \n");
|
|
|
|
lprcat("--------------------------------------------------------------------------\n");
|
1997-10-19 00:03:05 +04:00
|
|
|
for (i = 0; i <= MAXMONST + 8; i++) {
|
|
|
|
lprintf("%19s %2d %3d ", monster[i].name, (long) monster[i].level, (long) monster[i].armorclass);
|
|
|
|
lprintf(" %3d %3d %3d ", (long) monster[i].damage, (long) monster[i].attack, (long) monster[i].defense);
|
|
|
|
lprintf("%6d %3d %6d\n", (long) monster[i].gold, (long) monster[i].hitpoints, (long) monster[i].experience);
|
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
lprcat("\n\nHere's a Table for the to hit percentages\n");
|
|
|
|
lprcat("\n We will be assuming that players level = 2 * monster level");
|
|
|
|
lprcat("\n and that the players dexterity and strength are 16.");
|
|
|
|
lprcat("\n to hit: if (rnd(22) < (2[monst AC] + your level + dex + WC/8 -1)/2) then hit");
|
|
|
|
lprcat("\n damage = rund(8) + WC/2 + STR - c[HARDGAME] - 4");
|
|
|
|
lprcat("\n to hit: if rnd(22) < to hit then player hits\n");
|
|
|
|
lprcat("\n Each entry is as follows: to hit / damage / number hits to kill\n");
|
|
|
|
lprcat("\n monster WC = 4 WC = 20 WC = 40");
|
|
|
|
lprcat("\n---------------------------------------------------------------");
|
1997-10-19 00:03:05 +04:00
|
|
|
for (i = 0; i <= MAXMONST + 8; i++) {
|
|
|
|
hit = 2 * monster[i].armorclass + 2 * monster[i].level + 16;
|
1993-03-21 12:45:37 +03:00
|
|
|
dam = 16 - c[HARDGAME];
|
|
|
|
lprintf("\n%20s %2d/%2d/%2d %2d/%2d/%2d %2d/%2d/%2d",
|
1997-10-19 00:03:05 +04:00
|
|
|
monster[i].name,
|
|
|
|
(long) (hit / 2), (long) max(0, dam + 2), (long) (monster[i].hitpoints / (dam + 2) + 1),
|
|
|
|
(long) ((hit + 2) / 2), (long) max(0, dam + 10), (long) (monster[i].hitpoints / (dam + 10) + 1),
|
|
|
|
(long) ((hit + 5) / 2), (long) max(0, dam + 20), (long) (monster[i].hitpoints / (dam + 20) + 1));
|
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
lprcat("\n\nHere's the list of available potions:\n\n");
|
1997-10-19 00:03:05 +04:00
|
|
|
for (i = 0; i < MAXPOTION; i++)
|
|
|
|
lprintf("%20s\n", &potionhide[i][1]);
|
1993-03-21 12:45:37 +03:00
|
|
|
lprcat("\n\nHere's the list of available scrolls:\n\n");
|
1997-10-19 00:03:05 +04:00
|
|
|
for (i = 0; i < MAXSCROLL; i++)
|
|
|
|
lprintf("%20s\n", &scrollhide[i][1]);
|
1993-03-21 12:45:37 +03:00
|
|
|
lprcat("\n\nHere's the spell list:\n\n");
|
|
|
|
lprcat("spell name description\n");
|
|
|
|
lprcat("-------------------------------------------------------------------------------------------\n\n");
|
1997-10-19 00:03:05 +04:00
|
|
|
for (j = 0; j < SPNUM; j++) {
|
|
|
|
lprc(' ');
|
|
|
|
lprcat(spelcode[j]);
|
|
|
|
lprintf(" %21s %s\n", spelname[j], speldescript[j]);
|
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
lprcat("\n\nFor the c[] array:\n");
|
1997-10-19 00:03:05 +04:00
|
|
|
for (j = 0; j < 100; j += 10) {
|
|
|
|
lprintf("\nc[%2d] = ", (long) j);
|
|
|
|
for (i = 0; i < 9; i++)
|
|
|
|
lprintf("%5d ", (long) c[i + j]);
|
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
lprcat("\n\nTest of random number generator ----------------");
|
|
|
|
lprcat("\n for 25,000 calls divided into 16 slots\n\n");
|
|
|
|
|
1997-10-19 00:03:05 +04:00
|
|
|
for (i = 0; i < 16; i++)
|
|
|
|
rndcount[i] = 0;
|
|
|
|
for (i = 0; i < 25000; i++)
|
|
|
|
rndcount[rund(16)]++;
|
|
|
|
for (i = 0; i < 16; i++) {
|
|
|
|
lprintf(" %5d", (long) rndcount[i]);
|
|
|
|
if (i == 7)
|
|
|
|
lprc('\n');
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
1997-10-19 00:03:05 +04:00
|
|
|
|
|
|
|
lprcat("\n\n");
|
|
|
|
lwclose();
|
|
|
|
lcreat((char *) 0);
|
|
|
|
lprcat("Done Diagnosing . . .");
|
|
|
|
return (0);
|
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
|
|
|
subroutine to count the number of occurrences of an object
|
|
|
|
*/
|
1997-10-19 00:03:05 +04:00
|
|
|
int
|
1993-03-21 12:45:37 +03:00
|
|
|
dcount(l)
|
|
|
|
int l;
|
1997-10-19 00:03:05 +04:00
|
|
|
{
|
|
|
|
int i, j, p;
|
1993-03-21 12:45:37 +03:00
|
|
|
int k;
|
1997-10-19 00:03:05 +04:00
|
|
|
k = 0;
|
|
|
|
for (i = 0; i < MAXX; i++)
|
|
|
|
for (j = 0; j < MAXY; j++)
|
|
|
|
for (p = 0; p < MAXLEVEL; p++)
|
|
|
|
if (cell[p * MAXX * MAXY + i * MAXY + j].item == l)
|
|
|
|
k++;
|
|
|
|
return (k);
|
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
subroutine to draw the whole screen as the player knows it
|
|
|
|
*/
|
1997-10-19 00:03:05 +04:00
|
|
|
void
|
1993-03-21 12:45:37 +03:00
|
|
|
diagdrawscreen()
|
1997-10-19 00:03:05 +04:00
|
|
|
{
|
|
|
|
int i, j, k;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-19 00:03:05 +04:00
|
|
|
for (i = 0; i < MAXY; i++)
|
|
|
|
/* for the east west walls of this line */
|
|
|
|
{
|
|
|
|
for (j = 0; j < MAXX; j++)
|
|
|
|
if (k = mitem[j][i])
|
|
|
|
lprc(monstnamelist[k]);
|
|
|
|
else
|
|
|
|
lprc(objnamelist[item[j][i]]);
|
1993-03-21 12:45:37 +03:00
|
|
|
lprc('\n');
|
|
|
|
}
|
1997-10-19 00:03:05 +04:00
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
#endif
|
1997-10-19 00:03:05 +04:00
|
|
|
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
|
|
|
to save the game in a file
|
|
|
|
*/
|
1997-10-19 00:03:05 +04:00
|
|
|
static time_t zzz = 0;
|
|
|
|
int
|
1993-03-21 12:45:37 +03:00
|
|
|
savegame(fname)
|
|
|
|
char *fname;
|
1997-10-19 00:03:05 +04:00
|
|
|
{
|
|
|
|
int i, k;
|
|
|
|
struct sphere *sp;
|
|
|
|
struct stat statbuf;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-19 00:03:05 +04:00
|
|
|
nosignal = 1;
|
|
|
|
lflush();
|
|
|
|
savelevel();
|
|
|
|
ointerest();
|
|
|
|
if (lcreat(fname) < 0) {
|
|
|
|
lcreat((char *) 0);
|
|
|
|
lprintf("\nCan't open file <%s> to save game\n", fname);
|
|
|
|
nosignal = 0;
|
|
|
|
return (-1);
|
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
set_score_output();
|
1997-10-19 00:03:05 +04:00
|
|
|
lwrite((char *) beenhere, MAXLEVEL + MAXVLEVEL);
|
|
|
|
for (k = 0; k < MAXLEVEL + MAXVLEVEL; k++)
|
1993-03-21 12:45:37 +03:00
|
|
|
if (beenhere[k])
|
1997-10-19 00:03:05 +04:00
|
|
|
lwrite((char *) &cell[k * MAXX * MAXY], sizeof(struct cel) * MAXY * MAXX);
|
1993-03-21 12:45:37 +03:00
|
|
|
times(&cputime); /* get cpu time */
|
1997-10-19 00:03:05 +04:00
|
|
|
c[CPUTIME] += (cputime.tms_utime + cputime.tms_stime) / 60;
|
|
|
|
lwrite((char *) &c[0], 100 * sizeof(long));
|
|
|
|
lprint((long) gltime);
|
|
|
|
lprc(level);
|
|
|
|
lprc(playerx);
|
|
|
|
lprc(playery);
|
|
|
|
lwrite((char *) iven, 26);
|
|
|
|
lwrite((char *) ivenarg, 26 * sizeof(short));
|
|
|
|
for (k = 0; k < MAXSCROLL; k++)
|
|
|
|
lprc(scrollname[k][0]);
|
|
|
|
for (k = 0; k < MAXPOTION; k++)
|
|
|
|
lprc(potionname[k][0]);
|
|
|
|
lwrite((char *) spelknow, SPNUM);
|
|
|
|
lprc(wizard);
|
|
|
|
lprc(rmst); /* random monster generation counter */
|
|
|
|
for (i = 0; i < 90; i++)
|
|
|
|
lprc(itm[i].qty);
|
|
|
|
lwrite((char *) course, 25);
|
|
|
|
lprc(cheat);
|
|
|
|
lprc(VERSION);
|
|
|
|
for (i = 0; i < MAXMONST; i++)
|
|
|
|
lprc(monster[i].genocided); /* genocide info */
|
|
|
|
for (sp = spheres; sp; sp = sp->p)
|
|
|
|
lwrite((char *) sp, sizeof(struct sphere)); /* save spheres of
|
|
|
|
* annihilation */
|
|
|
|
time(&zzz);
|
|
|
|
lprint((long) (zzz - initialtime));
|
|
|
|
lwrite((char *) &zzz, sizeof(long));
|
|
|
|
if (fstat(lfd, &statbuf) < 0)
|
|
|
|
lprint(0L);
|
|
|
|
else
|
|
|
|
lprint((long) statbuf.st_ino); /* inode # */
|
|
|
|
lwclose();
|
|
|
|
lastmonst[0] = 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
#ifndef VT100
|
|
|
|
setscroll();
|
1997-10-19 00:03:05 +04:00
|
|
|
#endif /* VT100 */
|
|
|
|
lcreat((char *) 0);
|
|
|
|
nosignal = 0;
|
|
|
|
return (0);
|
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-19 00:03:05 +04:00
|
|
|
void
|
1993-03-21 12:45:37 +03:00
|
|
|
restoregame(fname)
|
1997-10-19 00:03:05 +04:00
|
|
|
char *fname;
|
|
|
|
{
|
|
|
|
int i, k;
|
|
|
|
struct sphere *sp, *sp2;
|
|
|
|
struct stat filetimes;
|
|
|
|
cursors();
|
|
|
|
lprcat("\nRestoring . . .");
|
|
|
|
lflush();
|
|
|
|
if (lopen(fname) <= 0) {
|
|
|
|
lcreat((char *) 0);
|
|
|
|
lprintf("\nCan't open file <%s>to restore game\n", fname);
|
|
|
|
nap(2000);
|
|
|
|
c[GOLD] = c[BANKACCOUNT] = 0;
|
|
|
|
died(-265);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
lrfill((char *) beenhere, MAXLEVEL + MAXVLEVEL);
|
|
|
|
for (k = 0; k < MAXLEVEL + MAXVLEVEL; k++)
|
1993-03-21 12:45:37 +03:00
|
|
|
if (beenhere[k])
|
1997-10-19 00:03:05 +04:00
|
|
|
lrfill((char *) &cell[k * MAXX * MAXY], sizeof(struct cel) * MAXY * MAXX);
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-19 00:03:05 +04:00
|
|
|
lrfill((char *) &c[0], 100 * sizeof(long));
|
2006-05-11 14:23:24 +04:00
|
|
|
gltime = larn_lrint();
|
1993-03-21 12:45:37 +03:00
|
|
|
level = c[CAVELEVEL] = lgetc();
|
1997-10-19 00:03:05 +04:00
|
|
|
playerx = lgetc();
|
|
|
|
playery = lgetc();
|
|
|
|
lrfill((char *) iven, 26);
|
|
|
|
lrfill((char *) ivenarg, 26 * sizeof(short));
|
|
|
|
for (k = 0; k < MAXSCROLL; k++)
|
|
|
|
scrollname[k] = lgetc() ? scrollhide[k] : "";
|
|
|
|
for (k = 0; k < MAXPOTION; k++)
|
|
|
|
potionname[k] = lgetc() ? potionhide[k] : "";
|
|
|
|
lrfill((char *) spelknow, SPNUM);
|
|
|
|
wizard = lgetc();
|
|
|
|
rmst = lgetc(); /* random monster creation flag */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-10-19 00:03:05 +04:00
|
|
|
for (i = 0; i < 90; i++)
|
|
|
|
itm[i].qty = lgetc();
|
|
|
|
lrfill((char *) course, 25);
|
|
|
|
cheat = lgetc();
|
|
|
|
if (VERSION != lgetc()) { /* version number */
|
|
|
|
cheat = 1;
|
1993-03-21 12:45:37 +03:00
|
|
|
lprcat("Sorry, But your save file is for an older version of larn\n");
|
1997-10-19 00:03:05 +04:00
|
|
|
nap(2000);
|
|
|
|
c[GOLD] = c[BANKACCOUNT] = 0;
|
|
|
|
died(-266);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
for (i = 0; i < MAXMONST; i++)
|
|
|
|
monster[i].genocided = lgetc(); /* genocide info */
|
|
|
|
for (sp = 0, i = 0; i < c[SPHCAST]; i++) {
|
1993-03-21 12:45:37 +03:00
|
|
|
sp2 = sp;
|
1997-10-19 00:03:05 +04:00
|
|
|
sp = (struct sphere *) malloc(sizeof(struct sphere));
|
|
|
|
if (sp == 0) {
|
|
|
|
write(2, "Can't malloc() for sphere space\n", 32);
|
|
|
|
break;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
1997-10-19 00:03:05 +04:00
|
|
|
lrfill((char *) sp, sizeof(struct sphere)); /* get spheres of
|
|
|
|
* annihilation */
|
|
|
|
sp->p = 0; /* null out pointer */
|
|
|
|
if (i == 0)
|
|
|
|
spheres = sp; /* beginning of list */
|
|
|
|
else
|
|
|
|
sp2->p = sp;
|
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
time(&zzz);
|
2006-05-11 14:23:24 +04:00
|
|
|
initialtime = zzz - larn_lrint();
|
1997-10-19 00:03:05 +04:00
|
|
|
fstat(fd, &filetimes); /* get the creation and modification time of
|
|
|
|
* file */
|
|
|
|
lrfill((char *) &zzz, sizeof(long));
|
|
|
|
zzz += 6;
|
|
|
|
if (filetimes.st_ctime > zzz)
|
|
|
|
fsorry(); /* file create time */
|
|
|
|
else if (filetimes.st_mtime > zzz)
|
|
|
|
fsorry(); /* file modify time */
|
|
|
|
if (c[HP] < 0) {
|
|
|
|
died(284);
|
|
|
|
return;
|
|
|
|
} /* died a post mortem death */
|
1993-03-21 12:45:37 +03:00
|
|
|
oldx = oldy = 0;
|
2006-05-11 14:23:24 +04:00
|
|
|
i = larn_lrint(); /* inode # */
|
1997-10-19 00:03:05 +04:00
|
|
|
if (i && (filetimes.st_ino != i))
|
|
|
|
fsorry();
|
1993-03-21 12:45:37 +03:00
|
|
|
lrclose();
|
1997-10-19 00:03:05 +04:00
|
|
|
if (strcmp(fname, ckpfile) == 0) {
|
|
|
|
if (lappend(fname) < 0)
|
|
|
|
fcheat();
|
|
|
|
else {
|
|
|
|
lprc(' ');
|
|
|
|
lwclose();
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
1997-10-19 00:03:05 +04:00
|
|
|
lcreat((char *) 0);
|
|
|
|
} else if (unlink(fname) < 0)
|
|
|
|
fcheat(); /* can't unlink save file */
|
|
|
|
/* for the greedy cheater checker */
|
|
|
|
for (k = 0; k < 6; k++)
|
|
|
|
if (c[k] > 99)
|
|
|
|
greedy();
|
|
|
|
if (c[HPMAX] > 999 || c[SPELLMAX] > 125)
|
|
|
|
greedy();
|
|
|
|
if (c[LEVEL] == 25 && c[EXPERIENCE] > skill[24]) { /* if patch up lev 25
|
|
|
|
* player */
|
|
|
|
long tmp;
|
|
|
|
tmp = c[EXPERIENCE] - skill[24]; /* amount to go up */
|
1993-03-21 12:45:37 +03:00
|
|
|
c[EXPERIENCE] = skill[24];
|
1997-10-19 00:03:05 +04:00
|
|
|
raiseexperience((long) tmp);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
1997-10-19 00:03:05 +04:00
|
|
|
getlevel();
|
|
|
|
lasttime = gltime;
|
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
subroutine to not allow greedy cheaters
|
|
|
|
*/
|
1997-10-19 00:03:05 +04:00
|
|
|
void
|
1993-03-21 12:45:37 +03:00
|
|
|
greedy()
|
1997-10-19 00:03:05 +04:00
|
|
|
{
|
1993-03-21 12:45:37 +03:00
|
|
|
#if WIZID
|
1997-10-19 00:03:05 +04:00
|
|
|
if (wizard)
|
|
|
|
return;
|
1993-03-21 12:45:37 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
lprcat("\n\nI am so sorry, but your character is a little TOO good! Since this\n");
|
|
|
|
lprcat("cannot normally happen from an honest game, I must assume that you cheated.\n");
|
|
|
|
lprcat("In that you are GREEDY as well as a CHEATER, I cannot allow this game\n");
|
1997-10-19 00:03:05 +04:00
|
|
|
lprcat("to continue.\n");
|
|
|
|
nap(5000);
|
|
|
|
c[GOLD] = c[BANKACCOUNT] = 0;
|
|
|
|
died(-267);
|
|
|
|
return;
|
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
subroutine to not allow altered save files and terminate the attempted
|
|
|
|
restart
|
|
|
|
*/
|
1997-10-19 00:03:05 +04:00
|
|
|
void
|
1993-03-21 12:45:37 +03:00
|
|
|
fsorry()
|
1997-10-19 00:03:05 +04:00
|
|
|
{
|
1993-03-21 12:45:37 +03:00
|
|
|
lprcat("\nSorry, but your savefile has been altered.\n");
|
|
|
|
lprcat("However, seeing as I am a good sport, I will let you play.\n");
|
|
|
|
lprcat("Be advised though, you won't be placed on the normal scoreboard.");
|
1997-10-19 00:03:05 +04:00
|
|
|
cheat = 1;
|
|
|
|
nap(4000);
|
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
subroutine to not allow game if save file can't be deleted
|
|
|
|
*/
|
1997-10-19 00:03:05 +04:00
|
|
|
void
|
1993-03-21 12:45:37 +03:00
|
|
|
fcheat()
|
1997-10-19 00:03:05 +04:00
|
|
|
{
|
1993-03-21 12:45:37 +03:00
|
|
|
#if WIZID
|
1997-10-19 00:03:05 +04:00
|
|
|
if (wizard)
|
|
|
|
return;
|
1993-03-21 12:45:37 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
lprcat("\nSorry, but your savefile can't be deleted. This can only mean\n");
|
|
|
|
lprcat("that you tried to CHEAT by protecting the directory the savefile\n");
|
|
|
|
lprcat("is in. Since this is unfair to the rest of the larn community, I\n");
|
|
|
|
lprcat("cannot let you play this game.\n");
|
1997-10-19 00:03:05 +04:00
|
|
|
nap(5000);
|
|
|
|
c[GOLD] = c[BANKACCOUNT] = 0;
|
|
|
|
died(-268);
|
|
|
|
return;
|
|
|
|
}
|