mplayer creation bestowing 0 gold pieces
Reported directly to devteam: a fake player monster was petrified and when creating its statue yielded "Calculating weight of 0 gold pieces?". Fake player monsters on the Astral Plane level were being created with rn2(1000) gold pieces so had a 1 in 1000 chance of that being 0. Gold gets created with a non-zero amount but the routine that gives it to a monster sets the amount to the requested value. That didn't update the weight so didn't notice the 0. Putting it into a container (the statue) did recalculate the weight and did notice. There was a choice between forcing a non-zero amount or allowing 0 and bypassing its creation and placement in monster's inventory. I went with the latter.
This commit is contained in:
@@ -1156,6 +1156,9 @@ wearing the Eyes of the Overworld overrides OPTIONS:blind; breaking the
|
|||||||
blindness stay cured after removing them was not
|
blindness stay cured after removing them was not
|
||||||
change helm of brilliance from iron to crystal so that it no longer needs to
|
change helm of brilliance from iron to crystal so that it no longer needs to
|
||||||
be a special case for metallic armor vs spell casting
|
be a special case for metallic armor vs spell casting
|
||||||
|
fake player monsters in endgame had a 1 in 1000 chance to be given a stack
|
||||||
|
of 0 gold pieces, eventually triggering an impossible warning (cited
|
||||||
|
one was "Calculating weight of 0 gold pieces?")
|
||||||
|
|
||||||
|
|
||||||
Fixes to 3.7.0-x General Problems Exposed Via git Repository
|
Fixes to 3.7.0-x General Problems Exposed Via git Repository
|
||||||
|
|||||||
@@ -558,16 +558,18 @@ m_initweap(register struct monst *mtmp)
|
|||||||
(void) mongets(mtmp, rnd_offensive_item(mtmp));
|
(void) mongets(mtmp, rnd_offensive_item(mtmp));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* create a new stack of gold in monster's inventory */
|
||||||
* Makes up money for monster's inventory.
|
|
||||||
*/
|
|
||||||
void
|
void
|
||||||
mkmonmoney(struct monst *mtmp, long amount)
|
mkmonmoney(struct monst *mtmp, long amount)
|
||||||
{
|
{
|
||||||
struct obj *gold = mksobj(GOLD_PIECE, FALSE, FALSE);
|
/* mk_mplayer() passes rn2(1000) so the amount might be 0 */
|
||||||
|
if (amount > 0L) {
|
||||||
|
struct obj *gold = mksobj(GOLD_PIECE, FALSE, FALSE);
|
||||||
|
|
||||||
gold->quan = amount;
|
gold->quan = amount;
|
||||||
add_to_minv(mtmp, gold);
|
gold->owt = weight(gold);
|
||||||
|
add_to_minv(mtmp, gold);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user