fix #2236 - bag of holding weight

From a bug report, the weight of a non-cursed bag
of holding would be off by 1 when the weight of contents was a multiple
of 2 (for uncursed) or of 4 (for blessed), since the round off handling
added 1 when it shouldn't in those cases.  Mainly noticeable when empty;
the extra 1 unit made it be twice as heavy as it should have been.

     Probably never noticed in actual play.  He has implemented a patch
which shows weights as part of an object's formatted description, making
this stand out.  Supposedly the Vulture's Eye interface also added a
patch like that a farily long time ago; I wonder why nobody using it ever
noticed.  (Maybe the weight was suppressed for bags of holding there?)
This commit is contained in:
nethack.rankin
2011-04-09 00:30:59 +00:00
parent 6df18e20be
commit 3e44a5fcdc
3 changed files with 6 additions and 9 deletions

View File

@@ -57,7 +57,7 @@ STATIC_DCL void FDECL(tipcontainer, (struct obj *));
*/
#define DELTA_CWT(cont,obj) \
((cont)->cursed ? (obj)->owt * 2 : \
1 + ((obj)->owt / ((cont)->blessed ? 4 : 2)))
(cont)->blessed ? ((obj)->owt + 3) / 4 : ((obj)->owt + 1) / 2)
#define GOLD_WT(n) (((n) + 50L) / 100L)
/* if you can figure this out, give yourself a hearty pat on the back... */
#define GOLD_CAPACITY(w,n) (((w) * -100L) - ((n) + 50L) - 1L)