Fix a couple latent bugs with initial rings/other charged items
These bugs are currently latent only because no role's starting inventory happens to satisfy the conditions under which it would show up. This commit contains the xNetHack fixes for them. Bug 1: if a role received a specific charged ring (versus a random ring), it would be possible for that ring's charge to be <= 0, since the code currently only caught this case for random rings. Move that clause outside the if (UNDEF_TYP) clause. Bug 2: non-ring oc_charged items of UNDEF_TYP that randomly rolled a starting charge/enchantment <= 0 would always be enchanted, sometimes very highly, because their enchantment was getting set to rne(3) by hitting this case, which is only intended for rings as a comment indicates. In particular, Archeologists' starting pick-axe would hit this case after moving it out of the UNDEF_TYP block, but it would also apply to any role receiving a random tool or weapon-tool at the start of the game.
This commit is contained in:
committed by
Pasi Kallinen
parent
f156b0f660
commit
7d27dca47f
11
src/u_init.c
11
src/u_init.c
@@ -1050,10 +1050,6 @@ ini_inv(struct trobj *trop)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Don't start with +0 or negative rings */
|
||||
if (objects[otyp].oc_charged && obj->spe <= 0)
|
||||
obj->spe = rne(3);
|
||||
|
||||
/* Heavily relies on the fact that 1) we create wands
|
||||
* before rings, 2) that we create rings before
|
||||
* spellbooks, and that 3) not more than 1 object of a
|
||||
@@ -1075,6 +1071,13 @@ ini_inv(struct trobj *trop)
|
||||
if (obj->oclass == RING_CLASS || obj->oclass == SPBOOK_CLASS)
|
||||
g.nocreate4 = otyp;
|
||||
}
|
||||
/* Put post-creation object adjustments that don't depend on whether it
|
||||
* was UNDEF_TYP or not after this. */
|
||||
|
||||
/* Don't start with +0 or negative rings */
|
||||
if (objects[otyp].oc_class == RING_CLASS && objects[otyp].oc_charged
|
||||
&& obj->spe <= 0)
|
||||
obj->spe = rne(3);
|
||||
|
||||
if (g.urace.mnum != PM_HUMAN) {
|
||||
/* substitute race-specific items; this used to be in
|
||||
|
||||
Reference in New Issue
Block a user