V0.2.0: Fixed a bug with the item sprite sheet and hard-coded values(ooh, another PC-classes tweak)

This commit is contained in:
Evan Debenham 2014-08-31 03:42:31 -04:00
parent 9034325963
commit e731f6f71d
2 changed files with 15 additions and 8 deletions

View File

@ -133,6 +133,8 @@ public class Dungeon {
public static boolean nightMode; public static boolean nightMode;
public static int version;
public static void init() { public static void init() {
Actor.clear(); Actor.clear();
@ -400,7 +402,7 @@ public class Dungeon {
try { try {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.put( VERSION, Game.version ); bundle.put( VERSION, Game.versionCode );
bundle.put( HERO, hero ); bundle.put( HERO, hero );
bundle.put( GOLD, gold ); bundle.put( GOLD, gold );
bundle.put( DEPTH, depth ); bundle.put( DEPTH, depth );
@ -556,8 +558,7 @@ public class Dungeon {
quickslot = null; quickslot = null;
} }
@SuppressWarnings("unused") version = bundle.getInt( VERSION );
String version = bundle.getString( VERSION );
hero = null; hero = null;
hero = (Hero)bundle.get( HERO ); hero = (Hero)bundle.get( HERO );

View File

@ -22,6 +22,7 @@ import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.watabou.utils.Bundle; import com.watabou.utils.Bundle;
import com.watabou.utils.Random; import com.watabou.utils.Random;
@ -92,7 +93,7 @@ public class ItemStatusHandler<T extends Item> {
Class<? extends T> item = (Class<? extends T>)(items[i]); Class<? extends T> item = (Class<? extends T>)(items[i]);
String itemName = item.toString(); String itemName = item.toString();
if (bundle.contains( itemName + PFX_LABEL )) { if (bundle.contains( itemName + PFX_LABEL ) && Dungeon.version > 3) {
String label = bundle.getString( itemName + PFX_LABEL ); String label = bundle.getString( itemName + PFX_LABEL );
labels.put( item, label ); labels.put( item, label );
@ -106,6 +107,8 @@ public class ItemStatusHandler<T extends Item> {
known.add( item ); known.add( item );
} }
//if there's a new item, give it a random image
//or.. if we're loading from an untrusted version, randomize the image to be safe.
} else { } else {
int index = Random.Int( labelsLeft.size() ); int index = Random.Int( labelsLeft.size() );
@ -116,6 +119,9 @@ public class ItemStatusHandler<T extends Item> {
images.put( item, imagesLeft.get( index ) ); images.put( item, imagesLeft.get( index ) );
imagesLeft.remove( index ); imagesLeft.remove( index );
if (bundle.contains( itemName + PFX_KNOWN ) && bundle.getBoolean( itemName + PFX_KNOWN )) {
known.add( item );
}
} }
} }
} }