kill extremely long running games
If move counter ever hits one billion, quit. Leaving it unlimited means that it could eventually wrap to a negative value and break various things.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.534 $ $NHDT-Date: 1621131203 2021/05/16 02:13:23 $
|
||||
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.535 $ $NHDT-Date: 1621208908 2021/05/16 23:48:28 $
|
||||
|
||||
General Fixes and Modified Features
|
||||
-----------------------------------
|
||||
@@ -519,6 +519,7 @@ fighter types who start out knowing all non-magic armor should not know
|
||||
prediscovered weapons adjustmens: only knights and samurai know polearms;
|
||||
rangers know launchers (bows), ammo (arrows), and spears regardless
|
||||
of their race/species; likewise, rogues know all daggers
|
||||
if the move counter ever reaches 1000000000, end the game
|
||||
|
||||
|
||||
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 allmain.c $NHDT-Date: 1613292825 2021/02/14 08:53:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.151 $ */
|
||||
/* NetHack 3.7 allmain.c $NHDT-Date: 1621208846 2021/05/16 23:47:26 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.152 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -180,6 +180,19 @@ moveloop(boolean resuming)
|
||||
|
||||
g.monstermoves++; /* [obsolete (for a long time...)] */
|
||||
g.moves++;
|
||||
/*
|
||||
* Never allow 'moves' to grow big enough to wrap.
|
||||
* We don't care what the maximum possible 'long int'
|
||||
* is for the current configuration, we want a value
|
||||
* that is the same for all viable configurations.
|
||||
* When imposing the limit, use a mystic decimal value
|
||||
* instead of a magic binary one such as 0x7fffffffL.
|
||||
*/
|
||||
if (g.moves >= 1000000000L) {
|
||||
display_nhwindow(WIN_MESSAGE, TRUE);
|
||||
pline_The("dungeon capitulates.");
|
||||
done(ESCAPED);
|
||||
}
|
||||
|
||||
if (flags.time && !g.context.run)
|
||||
iflags.time_botl = TRUE; /* 'moves' just changed */
|
||||
|
||||
Reference in New Issue
Block a user