View Single Post
Old March 6, 2013, 21:02   #2
half's Avatar
Join Date: Jan 2009
Posts: 904
half is on a distinguished road
Originally Posted by bron View Post
So I was hacking the source as part of the "no-magic" challenge (to change things so that magic items are not generated), and I ran across something that looks to me like a bug.

In "choose_chest_contents" in file object2.c, a random number between 1 and 13 is generated to decide on the "theme" of the chest. The comments in the routine enumerate what each of the 13 numbers is supposed to mean. However, this value is passed un-changed into the routine make_object, and in that routine, the themes that were numbered 1 - 13 in choose_chest_contents are actually numbered 2 - 14, with the value 1 reserved to mean "not useless" (i.e. anything except skeletons). This means that occasionally chests do have un-themed-but-not-useless stuff (theme == 1), and chests never have the DROP_TYPE_JEWELRY theme (theme == 14).

Now. it is of course possible that this was the intent, but it certainly doesn't look that way from the source. The simple hack-ish thing to do would be to add one to the value generated in choose_chest_contents (and to change the comments in that routine). The simplest thing to do would be to ignore it and declare it a feature.
You are completely right and this is an absolutely perfect bug-report! I've fixed it for the next version (adding one to the value as you suggested).
half is offline   Reply With Quote