v0.8.1: bags now appear again in their own bag window

This commit is contained in:
Evan Debenham 2020-06-13 14:46:00 -04:00
parent d22d78255f
commit 225c194de8
5 changed files with 30 additions and 6 deletions

View File

@ -45,6 +45,10 @@ public class MagicalHolster extends Bag {
} }
} }
public int capacity(){
return 19;
}
@Override @Override
public boolean collect( Bag container ) { public boolean collect( Bag container ) {
if (super.collect( container )) { if (super.collect( container )) {

View File

@ -43,6 +43,10 @@ public class PotionBandolier extends Bag {
} }
} }
public int capacity(){
return 19;
}
@Override @Override
public int price() { public int price() {
return 40; return 40;

View File

@ -45,6 +45,10 @@ public class ScrollHolder extends Bag {
} }
} }
public int capacity(){
return 19;
}
@Override @Override
public void onDetach( ) { public void onDetach( ) {
super.onDetach(); super.onDetach();

View File

@ -46,6 +46,10 @@ public class VelvetPouch extends Bag {
} }
} }
public int capacity(){
return 19;
}
@Override @Override
public int price() { public int price() {
return 30; return 30;

View File

@ -221,9 +221,19 @@ public class WndBag extends WndTabbed {
placeItem( stuff.misc1 != null ? stuff.misc1 : new Placeholder( ItemSpriteSheet.RING_HOLDER ) ); placeItem( stuff.misc1 != null ? stuff.misc1 : new Placeholder( ItemSpriteSheet.RING_HOLDER ) );
placeItem( stuff.misc2 != null ? stuff.misc2 : new Placeholder( ItemSpriteSheet.RING_HOLDER ) ); placeItem( stuff.misc2 != null ? stuff.misc2 : new Placeholder( ItemSpriteSheet.RING_HOLDER ) );
// Items in the bag //the container itself if it's not the root backpack
if (container != Dungeon.hero.belongings.backpack){
placeItem(container);
count--; //don't count this one, as it's not actually inside of itself
}
// Items in the bag, except other containers (they have tags at the bottom)
for (Item item : container.items.toArray(new Item[0])) { for (Item item : container.items.toArray(new Item[0])) {
placeItem( item ); if (!(item instanceof Bag)) {
placeItem( item );
} else {
count++;
}
} }
// Free Space // Free Space
@ -236,8 +246,6 @@ public class WndBag extends WndTabbed {
count++; count++;
if (item instanceof Bag) return;
int x = col * (SLOT_WIDTH + SLOT_MARGIN); int x = col * (SLOT_WIDTH + SLOT_MARGIN);
int y = TITLE_HEIGHT + row * (SLOT_HEIGHT + SLOT_MARGIN); int y = TITLE_HEIGHT + row * (SLOT_HEIGHT + SLOT_MARGIN);
@ -346,7 +354,7 @@ public class WndBag extends WndTabbed {
super( item ); super( item );
this.item = item; this.item = item;
if (item instanceof Gold) { if (item instanceof Gold || item instanceof Bag) {
bg.visible = false; bg.visible = false;
} }
@ -433,7 +441,7 @@ public class WndBag extends WndTabbed {
@Override @Override
protected void onClick() { protected void onClick() {
if (!lastBag.contains(item) && !item.isEquipped(Dungeon.hero)){ if (lastBag != item && !lastBag.contains(item) && !item.isEquipped(Dungeon.hero)){
hide(); hide();