v0.9.3: fixed various exploits caused by window stacking and multitaps
This commit is contained in:
parent
3429381d2a
commit
0095fe726d
|
@ -92,12 +92,14 @@ public class QuickSlotButton extends Button implements WndBag.Listener {
|
|||
}
|
||||
} else {
|
||||
Item item = select(slotNum);
|
||||
if (Dungeon.hero.belongings.contains(item)) {
|
||||
item.execute(Dungeon.hero);
|
||||
if (item.usesTargeting) {
|
||||
useTargeting();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameAction keyAction() {
|
||||
|
|
|
@ -35,10 +35,18 @@ public class WndInfoItem extends Window {
|
|||
private static final int WIDTH_MIN = 120;
|
||||
private static final int WIDTH_MAX = 220;
|
||||
|
||||
//only one WndInfoItem can appear at a time
|
||||
private static WndInfoItem INSTANCE;
|
||||
|
||||
public WndInfoItem( Heap heap ) {
|
||||
|
||||
super();
|
||||
|
||||
if (INSTANCE != null){
|
||||
INSTANCE.hide();
|
||||
}
|
||||
INSTANCE = this;
|
||||
|
||||
if (heap.type == Heap.Type.HEAP) {
|
||||
fillFields( heap.peek() );
|
||||
|
||||
|
@ -51,6 +59,11 @@ public class WndInfoItem extends Window {
|
|||
public WndInfoItem( Item item ) {
|
||||
super();
|
||||
|
||||
if (INSTANCE != null){
|
||||
INSTANCE.hide();
|
||||
}
|
||||
INSTANCE = this;
|
||||
|
||||
fillFields( item );
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,9 @@ public class WndUseItem extends WndInfoItem {
|
|||
protected void onClick() {
|
||||
hide();
|
||||
if (owner != null && owner.parent != null) owner.hide();
|
||||
if (Dungeon.hero.isAlive()) item.execute( Dungeon.hero, action );
|
||||
if (Dungeon.hero.isAlive() && Dungeon.hero.belongings.contains(item)){
|
||||
item.execute( Dungeon.hero, action );
|
||||
}
|
||||
}
|
||||
};
|
||||
btn.setSize( btn.reqWidth(), BUTTON_HEIGHT );
|
||||
|
|
|
@ -136,7 +136,11 @@ public class WndWandmaker extends Window {
|
|||
}
|
||||
@Override
|
||||
protected void onClick() {
|
||||
if (Dungeon.hero.belongings.contains(item)) {
|
||||
ShatteredPixelDungeon.scene().addToFront(new RewardWindow(item));
|
||||
} else {
|
||||
hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
add(slot);
|
||||
|
|
Loading…
Reference in New Issue
Block a user