v0.2.4: corrected some quickslot errors

This commit is contained in:
Evan Debenham 2015-02-10 16:44:29 -05:00
parent 0ab5b8d18d
commit 0d78119ab7
2 changed files with 7 additions and 11 deletions

View File

@ -54,6 +54,10 @@ public class QuickSlot {
return getItem(slot) != null && getItem(slot).quantity() == 0;
}
public Boolean isNonePlaceholder(int slot){
return getItem(slot) != null && getItem(slot).quantity() > 0;
}
public void clearItem(Item item){
if (contains(item))
clearSlot(getSlot(item));

View File

@ -30,22 +30,19 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
//TODO: investigate targeting with multiple quickslots
public class QuickSlotButton extends Button implements WndBag.Listener {
private static final String TXT_SELECT_ITEM = "Select an item for the quickslot";
private static QuickSlotButton[] instance = new QuickSlotButton[4];
private int slotNum;
private Item itemInSlot;
private ItemSlot slot;
private static Image crossB;
private static Image crossM;
private static boolean targeting = false;
private Item lastItem = null;
private static Char lastTarget= null;
public QuickSlotButton( int slotNum ) {
@ -61,8 +58,7 @@ public class QuickSlotButton extends Button implements WndBag.Listener {
super.destroy();
instance = new QuickSlotButton[4];
lastItem = null;
lastTarget = null;
}
@ -140,7 +136,6 @@ public class QuickSlotButton extends Button implements WndBag.Listener {
public void item( Item item ) {
slot.item( item );
itemInSlot = item;
enableSlot();
}
@ -154,10 +149,7 @@ public class QuickSlotButton extends Button implements WndBag.Listener {
}
private void enableSlot() {
slot.enable(
itemInSlot != null &&
itemInSlot.quantity() > 0 &&
(Dungeon.hero.belongings.backpack.contains( itemInSlot ) || itemInSlot.isEquipped( Dungeon.hero )));
slot.enable(Dungeon.quickslot.isNonePlaceholder( slotNum ));
}
private void useTargeting() {