OSDN Git Service

魅力が極端に低く, 店主との種族間相性が極端に悪く, 極端に価格の高いア
authornothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Tue, 20 May 2003 14:37:13 +0000 (14:37 +0000)
committernothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Tue, 20 May 2003 14:37:13 +0000 (14:37 +0000)
イテムがブラックマーケットで売られたオーバーフローして 1$ で買えてい
たバグを仮修正. u32bへのキャストに頼っており, その場しのぎ.

src/store.c

index 9354715..243dc0d 100644 (file)
@@ -953,7 +953,8 @@ static s32b price_item(object_type *o_ptr, int greed, bool flip)
        }
 
        /* Compute the final price (with rounding) */
-       price = (price * adjust + 50L) / 100L;
+       /* Hack -- prevent overflow */
+       price = (s32b)(((u32b)price * (u32b)adjust + 50UL) / 100UL);
 
        /* Note -- Never become "free" */
        if (price <= 0L) return (1L);