Unify file removed -trickery
This commit is contained in:
@@ -1981,6 +1981,7 @@ E void NDECL(rumor_check);
|
|||||||
|
|
||||||
E int NDECL(dosave);
|
E int NDECL(dosave);
|
||||||
E int NDECL(dosave0);
|
E int NDECL(dosave0);
|
||||||
|
E boolean FDECL(tricked_fileremoved, (int, char *));
|
||||||
#ifdef INSURANCE
|
#ifdef INSURANCE
|
||||||
E void NDECL(savestateinlock);
|
E void NDECL(savestateinlock);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
6
src/do.c
6
src/do.c
@@ -1225,11 +1225,7 @@ boolean at_stairs, falling, portal;
|
|||||||
} else {
|
} else {
|
||||||
/* returning to previously visited level; reload it */
|
/* returning to previously visited level; reload it */
|
||||||
fd = open_levelfile(new_ledger, whynot);
|
fd = open_levelfile(new_ledger, whynot);
|
||||||
if (fd < 0) {
|
if (tricked_fileremoved(fd, whynot)) {
|
||||||
pline1(whynot);
|
|
||||||
pline("Probably someone removed it.");
|
|
||||||
Strcpy(killer.name, whynot);
|
|
||||||
done(TRICKED);
|
|
||||||
/* we'll reach here if running in wizard mode */
|
/* we'll reach here if running in wizard mode */
|
||||||
error("Cannot continue this game.");
|
error("Cannot continue this game.");
|
||||||
}
|
}
|
||||||
|
|||||||
23
src/save.c
23
src/save.c
@@ -360,6 +360,21 @@ register int fd, mode;
|
|||||||
bflush(fd);
|
bflush(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean
|
||||||
|
tricked_fileremoved(fd, whynot)
|
||||||
|
int fd;
|
||||||
|
char *whynot;
|
||||||
|
{
|
||||||
|
if (fd < 0) {
|
||||||
|
pline1(whynot);
|
||||||
|
pline("Probably someone removed it.");
|
||||||
|
Strcpy(killer.name, whynot);
|
||||||
|
done(TRICKED);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef INSURANCE
|
#ifdef INSURANCE
|
||||||
void
|
void
|
||||||
savestateinlock()
|
savestateinlock()
|
||||||
@@ -387,13 +402,7 @@ savestateinlock()
|
|||||||
* readable by an external utility
|
* readable by an external utility
|
||||||
*/
|
*/
|
||||||
fd = open_levelfile(0, whynot);
|
fd = open_levelfile(0, whynot);
|
||||||
if (fd < 0) {
|
if (tricked_fileremoved(fd, whynot)) return;
|
||||||
pline1(whynot);
|
|
||||||
pline("Probably someone removed it.");
|
|
||||||
Strcpy(killer.name, whynot);
|
|
||||||
done(TRICKED);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
(void) read(fd, (genericptr_t) &hpid, sizeof(hpid));
|
(void) read(fd, (genericptr_t) &hpid, sizeof(hpid));
|
||||||
if (hackpid != hpid) {
|
if (hackpid != hpid) {
|
||||||
|
|||||||
Reference in New Issue
Block a user