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