Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Sil

Reply
 
Thread Tools Display Modes
Old February 18, 2013, 22:14   #1
bron
Swordsman
 
Join Date: May 2008
Location: Saratoga, California (in the midst of Silicon Valley)
Posts: 450
bron is on a distinguished road
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.
bron is offline   Reply With Quote
Old March 6, 2013, 22:02   #2
half
Knight
 
half's Avatar
 
Join Date: Jan 2009
Posts: 901
half is on a distinguished road
Quote:
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
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
sil 1.1: minor bug with thrown weapons bron Sil 1 November 18, 2012 12:24
[3.3] Bug in cavern level generation PowerWyrm Development 10 July 30, 2011 05:19
Haha, chest in a chest Nightmarjoo AAR 5 January 22, 2010 04:49
r1415 bug - Item generation Sirridan Vanilla 3 June 1, 2009 09:23
3.1.0 Very minor bug perost Vanilla 0 January 9, 2009 22:48


All times are GMT +1. The time now is 05:45.


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