v0.7.2a: added a safety check to buying an item
This commit is contained in:
+2
-2
@@ -259,13 +259,13 @@ public class WndTradeItem extends Window {
|
|||||||
|
|
||||||
private void buy( Heap heap ) {
|
private void buy( Heap heap ) {
|
||||||
|
|
||||||
Hero hero = Dungeon.hero;
|
|
||||||
Item item = heap.pickUp();
|
Item item = heap.pickUp();
|
||||||
|
if (item == null) return;
|
||||||
|
|
||||||
int price = price( item );
|
int price = price( item );
|
||||||
Dungeon.gold -= price;
|
Dungeon.gold -= price;
|
||||||
|
|
||||||
if (!item.doPickUp( hero )) {
|
if (!item.doPickUp( Dungeon.hero )) {
|
||||||
Dungeon.level.drop( item, heap.pos ).sprite.drop();
|
Dungeon.level.drop( item, heap.pos ).sprite.drop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user