v0.6.0: switched to linked hash map to make rng deterministic

This commit is contained in:
Evan Debenham 2017-05-04 16:41:01 -04:00
parent 278c0d6b66
commit af90cb7f73
3 changed files with 7 additions and 4 deletions

View File

@ -151,6 +151,7 @@ import com.watabou.utils.Random;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap;
public class Generator { public class Generator {
@ -201,7 +202,7 @@ public class Generator {
{0, 2, 8, 20, 70} {0, 2, 8, 20, 70}
}; };
private static HashMap<Category,Float> categoryProbs = new HashMap<Generator.Category, Float>(); private static HashMap<Category,Float> categoryProbs = new LinkedHashMap<>();
private static final float[] INITIAL_ARTIFACT_PROBS = new float[]{ 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1}; private static final float[] INITIAL_ARTIFACT_PROBS = new float[]{ 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1};

View File

@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.watabou.utils.Random; import com.watabou.utils.Random;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap;
public abstract class ConnectionRoom extends Room { public abstract class ConnectionRoom extends Room {
@ -49,7 +50,7 @@ public abstract class ConnectionRoom extends Room {
else return 4; else return 4;
} }
private static HashMap<Class<?extends ConnectionRoom>, Float> chances = new HashMap<>(); private static HashMap<Class<?extends ConnectionRoom>, Float> chances = new LinkedHashMap<>();
static { static {
chances.put(TunnelRoom.class, 10f); chances.put(TunnelRoom.class, 10f);

View File

@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room;
import com.watabou.utils.Random; import com.watabou.utils.Random;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap;
public abstract class StandardRoom extends Room { public abstract class StandardRoom extends Room {
@ -72,12 +73,12 @@ public abstract class StandardRoom extends Room {
else return 4; else return 4;
} }
private static HashMap<Class<?extends StandardRoom>, Float> chances = new HashMap<>(); private static HashMap<Class<?extends StandardRoom>, Float> chances = new LinkedHashMap<>();
static { static {
chances.put(EmptyRoom.class, 24f); chances.put(EmptyRoom.class, 24f);
chances.put(PlatformRoom.class, 1f); chances.put(PlatformRoom.class, 1f);
chances.put(BurnedRoom.class, 1f); chances.put(BurnedRoom.class, 1f);
chances.put(FissureRoom.class, 1f); chances.put(FissureRoom.class, 1f);
chances.put(GrassyGraveRoom.class, 1f); chances.put(GrassyGraveRoom.class, 1f);