The impetus for this was to avoid ugly constructions such as the one below (none of which currently appear in vanilla NetHack): mongets(mtmp, LONG_SWORD); struct obj* sword = m_carrying(mtmp, LONG_SWORD); if (sword) /* do thing to sword */ Most cases where mongets is used discard the returned value (which used to be the created object's spe); the only places that do use it are the series of statements that give various human monsters armor and prevent them from getting too much armor. These statements included hardcoded constants representing the base AC of the armor, which would have caused discrepancies if armor's base AC were ever changed. With mongets now returning a pointer to the created object, it can just be passed into ARM_BONUS instead, which covers both the base AC and the enchantment. (It will also cover erosion, if anyone ever decides that armor should rarely generate as pre-eroded). The overall algorithm is not changed by this; human monsters should receive armor with the same probabilities as before.
117 KiB
117 KiB