v0.4.2: adjusted logic for out of bounds integer preference values
This commit is contained in:
parent
d754f17edd
commit
6afff9f71b
|
@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon;
|
||||||
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import com.watabou.noosa.Game;
|
import com.watabou.noosa.Game;
|
||||||
|
import com.watabou.utils.GameMath;
|
||||||
|
|
||||||
enum Preferences {
|
enum Preferences {
|
||||||
|
|
||||||
|
@ -64,8 +65,9 @@ enum Preferences {
|
||||||
try {
|
try {
|
||||||
int i = get().getInt( key, defValue );
|
int i = get().getInt( key, defValue );
|
||||||
if (i < min || i > max){
|
if (i < min || i > max){
|
||||||
put(key, defValue);
|
int val = (int)GameMath.gate(min, i, max);
|
||||||
return defValue;
|
put(key, val);
|
||||||
|
return val;
|
||||||
} else {
|
} else {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user