]> granicus.if.org Git - nethack/commitdiff
fix scroll of charging
authorPatR <rankin@nethack.org>
Fri, 6 Nov 2015 02:39:02 +0000 (18:39 -0800)
committerPatR <rankin@nethack.org>
Fri, 6 Nov 2015 02:39:02 +0000 (18:39 -0800)
The intended change was that you'd get an increase to max energy if
current was sufficiently close to max rather than only when it was
already at max.  It wasn't intended that you'd fail to have current
boosted all the way to max in the case where it wasn't sufficiently
close.  That's fixed here.

src/read.c

index 89c4607365b405c78ae4951215bd7270fa376b20..6f4fc1de9ed6d26d6087eb8fa501d9740c5e737b 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 read.c  $NHDT-Date: 1446713638 2015/11/05 08:53:58 $  $NHDT-Branch: master $:$NHDT-Revision: 1.119 $ */
+/* NetHack 3.6 read.c  $NHDT-Date: 1446777536 2015/11/06 02:38:56 $  $NHDT-Branch: master $:$NHDT-Revision: 1.120 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1428,8 +1428,10 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
             } else {
                 You_feel("charged up!");
                 u.uen += d(sblessed ? 6 : 4, 4);
-                if (u.uen > u.uenmax)
-                    u.uenmax = u.uen;
+                if (u.uen > u.uenmax) /* if current energy is already at   */
+                    u.uenmax = u.uen; /* or near maximum, increase maximum */
+                else
+                    u.uen = u.uenmax; /* otherwise restore current to max  */
             }
             context.botl = 1;
             break;