/* ### allmain.c ### */
-E void NDECL(moveloop);
+E void FDECL(moveloop, (BOOLEAN_P));
E void NDECL(stop_occupation);
E void NDECL(display_gamewindows);
E void NDECL(newgame);
-/* SCCS Id: @(#)allmain.c 3.5 2003/04/02 */
+/* SCCS Id: @(#)allmain.c 3.5 2006/04/01 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
#endif
void
-moveloop()
+moveloop(resuming)
+boolean resuming;
{
#if defined(MICRO) || defined(WIN32)
char ch;
int moveamt = 0, wtcap = 0, change = 0;
boolean didmove = FALSE, monscanmove = FALSE;
+ /* Note: these initializers don't do anything except guarantee that
+ we're linked properly.
+ */
+ decl_init();
+ monst_init();
+ monstr_init(); /* monster strengths */
+ objects_init();
+
+#ifdef WIZARD
+ if (wizard) add_debug_extended_commands();
+#endif
+
+ /* side-effects from the real world */
flags.moonphase = phase_of_the_moon();
if(flags.moonphase == FULL_MOON) {
You("are lucky! Full moon tonight.");
change_luck(-1);
}
- initrack();
-
-
- /* Note: these initializers don't do anything except guarantee that
- we're linked properly.
- */
- decl_init();
- monst_init();
- monstr_init(); /* monster strengths */
- objects_init();
-
-#ifdef WIZARD
- if (wizard) add_debug_extended_commands();
-#endif
+ if (!resuming) { /* new game */
+ set_wear(); /* handle side-effects of worn starting gear */
+ (void) pickup(1); /* autopickup at initial location */
+ } else {
+ update_inventory(); /* for perm_invent */
+ read_engr_at(u.ux, u.uy); /* subset of pickup() */
+ }
(void) encumber_msg(); /* in case they auto-picked up something */
if (defer_see_monsters) {
defer_see_monsters = FALSE;
see_monsters();
}
+ initrack();
u.uz0.dlevel = u.uz.dlevel;
youmonst.movement = NORMAL_SPEED; /* give the hero some movement points */
+ context.move = 0;
for(;;) {
get_nh_event();
-/* SCCS Id: @(#)restore.c 3.5 2005/12/14 */
+/* SCCS Id: @(#)restore.c 3.5 2006/04/01 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
/* Success! */
welcome(FALSE);
+ check_special_room(FALSE);
return(1);
}
-/* SCCS Id: @(#)bemain.c 3.5 1998/07/15 */
+/* SCCS Id: @(#)bemain.c 3.5 2006/04/01 */
/* Copyright (c) Dean Luick, 1996. */
/* NetHack may be freely redistributed. See license for details. */
int MAIN(int argc, char **argv)
{
int fd;
- char *dir;
+ char *dir;
+ boolean resuming = FALSE; /* assume new game */
dir = nh_getenv("NETHACKDIR");
if (!dir) dir = nh_getenv("HACKDIR");
#endif
pline("Restoring save file...");
mark_synch(); /* flush output */
- if(!dorecover(fd))
- goto not_recovered;
+ if (dorecover(fd)) {
+ resuming = TRUE; /* not starting new game */
#ifdef WIZARD
- if(!wizard && remember_wiz_mode) wizard = TRUE;
+ if (!wizard && remember_wiz_mode) wizard = TRUE;
#endif
- check_special_room(FALSE);
- if (discover)
+ if (discover)
You("are in non-scoring discovery mode.");
- if (discover || wizard) {
+ if (discover || wizard) {
if(yn("Do you want to keep the save file?") == 'n')
(void) delete_savefile();
else {
nh_compress(fqname(SAVEF, SAVEPREFIX, 0));
}
+ }
}
+ }
- flags.move = 0;
- } else {
-not_recovered:
+ if (!resuming) {
player_selection();
newgame();
if (discover)
You("are in non-scoring discovery mode.");
-
- flags.move = 0;
- set_wear();
- (void) pickup(1);
}
- moveloop();
+ moveloop(resuming);
return 0;
}
-/* SCCS Id: @(#)macmain.c 3.5 1997/01/22 */
+/* SCCS Id: @(#)macmain.c 3.5 2006/04/01 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
{
register int fd = -1;
int argc = 1;
+ boolean resuming = FALSE; /* assume new game */
windowprocs = mac_procs;
InitMac ();
mark_synch(); /* flush output */
game_active = 1;
if (dorecover(fd)) {
+ resuming = TRUE; /* not starting new game */
#ifdef WIZARD
if(!wizard && remember_wiz_mode) wizard = TRUE;
#endif
- check_special_room(FALSE);
-
if (discover || wizard) {
if(yn("Do you want to keep the save file?") == 'n')
(void) delete_savefile();
}
}
}
- else {
- fd = -1; /* set bad status */
- }
}
- if (fd < 0) {
+
+ if (!resuming) {
player_selection();
game_active = 1; /* done with selection, draw active game window */
newgame();
- set_wear();
- (void) pickup(1);
}
if (discover)
You("are in non-scoring discovery mode.");
- flags.move = 0;
UndimMenuBar (); /* Yes, this is the place for it (!) */
-
- moveloop();
+
+ moveloop(resuming);
exit(EXIT_SUCCESS);
/*NOTREACHED*/
-/* SCCS Id: @(#)pcmain.c 3.5 2002/08/22 */
+/* SCCS Id: @(#)pcmain.c 3.5 2006/04/01 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
int FDECL(main, (int,char **));
-extern void FDECL(pcmain, (int,char **));
+extern boolean FDECL(pcmain, (int,char **));
#if defined(__BORLANDC__) && !defined(_WIN32)
int argc;
char *argv[];
{
- pcmain(argc,argv);
+ boolean resuming;
+
+ resuming = pcmain(argc,argv);
#ifdef LAN_FEATURES
init_lan_features();
#endif
- moveloop();
+ moveloop(resuming);
nethack_exit(EXIT_SUCCESS);
/*NOTREACHED*/
return 0;
}
#endif /*MSWIN_GRAPHICS*/
-void
+boolean
pcmain(argc,argv)
int argc;
char *argv[];
#ifdef NOCWD_ASSUMPTIONS
char failbuf[BUFSZ];
#endif
+ boolean resuming = FALSE; /* assume new game */
#if defined(__BORLANDC__) && !defined(_WIN32)
startup();
pline("Restoring save file...");
mark_synch(); /* flush output */
- if(!dorecover(fd))
- goto not_recovered;
+ if (dorecover(fd)) {
+ resuming = TRUE; /* not starting new game */
#ifdef WIZARD
- if(!wizard && remember_wiz_mode) wizard = TRUE;
+ if (!wizard && remember_wiz_mode) wizard = TRUE;
#endif
- check_special_room(FALSE);
- if (discover)
+ if (discover)
You("are in non-scoring discovery mode.");
- update_inventory();
-
- if (discover || wizard) {
+ if (discover || wizard) {
if(yn("Do you want to keep the save file?") == 'n')
(void) delete_savefile();
else {
nh_compress(fqname(SAVEF, SAVEPREFIX, 0));
}
-
+ }
}
+ }
- context.move = 0;
- } else {
-not_recovered:
+ if (!resuming) {
player_selection();
newgame();
if (discover)
You("are in non-scoring discovery mode.");
-
- context.move = 0;
- set_wear();
- (void) pickup(1);
- read_engr_at(u.ux,u.uy);
- update_inventory();
}
#ifndef NO_SIGNAL
#ifdef OS2
gettty(); /* somehow ctrl-P gets turned back on during startup ... */
#endif
- return;
+ return resuming;
}
STATIC_OVL void
-/* SCCS Id: @(#)unixmain.c 3.5 1997/01/22 */
+/* SCCS Id: @(#)unixmain.c 3.5 2006/04/01 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
register char *dir;
#endif
boolean exact_username;
+ boolean resuming = FALSE; /* assume new game */
#if defined(__APPLE__)
/* special hack to change working directory to a resource fork when
#endif
pline("Restoring save file...");
mark_synch(); /* flush output */
- if(!dorecover(fd))
- goto not_recovered;
+ if (dorecover(fd)) {
+ resuming = TRUE; /* not starting new game */
#ifdef WIZARD
- if(!wizard && remember_wiz_mode) wizard = TRUE;
+ if (!wizard && remember_wiz_mode) wizard = TRUE;
#endif
- check_special_room(FALSE);
- wd_message();
-
- if (discover || wizard) {
+ wd_message();
+ if (discover || wizard) {
if(yn("Do you want to keep the save file?") == 'n')
(void) delete_savefile();
else {
(void) chmod(fq_save,FCMASK); /* back to readable */
nh_compress(fq_save);
}
+ }
}
- context.move = 0;
- } else {
-not_recovered:
+ }
+
+ if (!resuming) {
player_selection();
newgame();
wd_message();
-
- context.move = 0;
- set_wear();
- (void) pickup(1);
}
- moveloop();
+ moveloop(resuming);
exit(EXIT_SUCCESS);
/*NOTREACHED*/
return(0);
-/* SCCS Id: @(#)vmsmain.c 3.5 2003/10/16 */
+/* SCCS Id: @(#)vmsmain.c 3.5 2006/04/01 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
/* main.c - VMS NetHack */
#ifdef CHDIR
register char *dir;
#endif
+ boolean resuming = FALSE; /* assume new game */
#ifdef SECURE /* this should be the very first code executed */
privoff();
#endif
pline("Restoring save file...");
mark_synch(); /* flush output */
- if(!dorecover(fd))
- goto not_recovered;
+ if (dorecover(fd)) {
+ resuming = TRUE; /* not starting new game */
#ifdef WIZARD
- if(!wizard && remember_wiz_mode) wizard = TRUE;
+ if (!wizard && remember_wiz_mode) wizard = TRUE;
#endif
- check_special_room(FALSE);
- wd_message();
-
- if (discover || wizard) {
+ wd_message();
+ if (discover || wizard) {
if (yn("Do you want to keep the save file?") == 'n')
(void) delete_savefile();
else
(void) chmod(fq_save,FCMASK); /* back to readable */
+ }
}
+ }
- context.move = 0;
- } else {
-not_recovered:
+ if (!resuming) {
player_selection();
newgame();
wd_message();
-
- context.move = 0;
- set_wear();
- (void) pickup(1);
}
- moveloop();
+ moveloop(resuming);
exit(EXIT_SUCCESS);
/*NOTREACHED*/
return(0);
-/* SCCS Id: @(#)winhack.c 3.5 2005/01/23 */
+/* SCCS Id: @(#)winhack.c 3.5 2006/04/01 */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
#endif
// Foward declarations of functions included in this code module:
-extern void FDECL(pcmain, (int,char **));
+extern boolean FDECL(pcmain, (int,char **));
static void __cdecl mswin_moveloop(void *);
#define MAX_CMDLINE_PARAM 255
TCHAR wbuf[BUFSZ];
char buf[BUFSZ];
DWORD major, minor;
+ boolean resuming;
/* ensure that we don't access violate on a panic() */
}
free(savefile);
}
- pcmain(argc,argv);
+ resuming = pcmain(argc,argv);
- moveloop();
+ moveloop(resuming);
return 0;
}