fix github issue #1191 - obj->age of oil potions

Issue reported by AmyBSOD:  several actions change the object type of
a potion rather than force creation of a replacement one, and if/when
the type was changed to oil, the age wasn't converted from absolute
to relative.  Relative age is the amount available and/or the number
of turns it will burn if applied.  The later in a game a potion got
converted into oil, the longer it would burn.  Not mentioned:  reverse
situation was also the case, although that didn't have any noticeable
effect since incorrect absolute age of former oil doesn't matter.

Not thoroughly tested.  I got a potion of oil from a horn of plenty
and it burned for 400 turns, but it might have been created directly
rather than be a rejected magic potion that was converted into oil.

Closes #1191
This commit is contained in:
PatR
2024-01-03 13:29:15 -08:00
parent db4a44735e
commit c6897bf331
5 changed files with 51 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 extern.h $NHDT-Date: 1703716146 2023/12/27 22:29:06 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1356 $ */
/* NetHack 3.7 extern.h $NHDT-Date: 1704316439 2024/01/03 21:13:59 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1359 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1595,6 +1595,7 @@ extern struct obj *mksobj(int, boolean, boolean) NONNULL;
extern int bcsign(struct obj *) NONNULLARG1;
extern int weight(struct obj *) NONNULLARG1;
extern struct obj *mkgold(long, coordxy, coordxy);
extern void fixup_oil(struct obj *, struct obj *) NONNULLARG1;
extern struct obj *mkcorpstat(int, struct monst *, struct permonst *,
coordxy, coordxy, unsigned);
extern int corpse_revive_type(struct obj *) NONNULLARG1;