Angband Forums

Angband Forums (http://angband.oook.cz/forum/index.php)
-   Sil (http://angband.oook.cz/forum/forumdisplay.php?f=12)
-   -   sil 1.1.1: minor bug (?) with chest generation (http://angband.oook.cz/forum/showthread.php?t=5907)

bron February 18, 2013 21:14

sil 1.1.1: minor bug (?) with chest generation
 
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.

half March 6, 2013 21:02

Quote:

Originally Posted by bron (Post 77370)
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).


All times are GMT +1. The time now is 13:23.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.