mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-04-27 14:25:42 +02:00
DroidFish: Don't reset MultiPV setting when restarting the app.
This commit is contained in:
parent
ddab55e064
commit
23511ee76d
DroidFish/src/org/petero/droidfish
@ -172,6 +172,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
private static DroidChessController ctrl = null;
|
private static DroidChessController ctrl = null;
|
||||||
private boolean mShowThinking;
|
private boolean mShowThinking;
|
||||||
private boolean mShowStats;
|
private boolean mShowStats;
|
||||||
|
private int numPV;
|
||||||
private boolean mWhiteBasedScores;
|
private boolean mWhiteBasedScores;
|
||||||
private boolean mShowBookHints;
|
private boolean mShowBookHints;
|
||||||
private int maxNumArrows;
|
private int maxNumArrows;
|
||||||
@ -994,6 +995,8 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
|
|
||||||
mShowThinking = settings.getBoolean("showThinking", false);
|
mShowThinking = settings.getBoolean("showThinking", false);
|
||||||
mShowStats = settings.getBoolean("showStats", true);
|
mShowStats = settings.getBoolean("showStats", true);
|
||||||
|
numPV = settings.getInt("numPV", 1);
|
||||||
|
ctrl.setMultiPVMode(numPV);
|
||||||
mWhiteBasedScores = settings.getBoolean("whiteBasedScores", false);
|
mWhiteBasedScores = settings.getBoolean("whiteBasedScores", false);
|
||||||
maxNumArrows = getIntSetting("thinkingArrows", 2);
|
maxNumArrows = getIntSetting("thinkingArrows", 2);
|
||||||
mShowBookHints = settings.getBoolean("bookHints", false);
|
mShowBookHints = settings.getBoolean("bookHints", false);
|
||||||
@ -2651,9 +2654,11 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
List<CharSequence> lst = new ArrayList<CharSequence>();
|
List<CharSequence> lst = new ArrayList<CharSequence>();
|
||||||
List<Integer> actions = new ArrayList<Integer>();
|
List<Integer> actions = new ArrayList<Integer>();
|
||||||
lst.add(getString(R.string.add_analysis)); actions.add(ADD_ANALYSIS);
|
lst.add(getString(R.string.add_analysis)); actions.add(ADD_ANALYSIS);
|
||||||
final int numPV = ctrl.getNumPV();
|
int numPV = this.numPV;
|
||||||
if (gameMode.analysisMode()) {
|
if (gameMode.analysisMode()) {
|
||||||
int maxPV = ctrl.maxPV();
|
int maxPV = ctrl.maxPV();
|
||||||
|
numPV = Math.min(numPV, maxPV);
|
||||||
|
numPV = Math.max(numPV, 1);
|
||||||
if (numPV > 1) {
|
if (numPV > 1) {
|
||||||
lst.add(getString(R.string.fewer_variations)); actions.add(MULTIPV_DEC);
|
lst.add(getString(R.string.fewer_variations)); actions.add(MULTIPV_DEC);
|
||||||
}
|
}
|
||||||
@ -2661,6 +2666,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
lst.add(getString(R.string.more_variations)); actions.add(MULTIPV_INC);
|
lst.add(getString(R.string.more_variations)); actions.add(MULTIPV_INC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
final int numPVF = numPV;
|
||||||
if (thinkingStr1.length() > 0) {
|
if (thinkingStr1.length() > 0) {
|
||||||
if (mShowStats) {
|
if (mShowStats) {
|
||||||
lst.add(getString(R.string.hide_statistics)); actions.add(HIDE_STATISTICS);
|
lst.add(getString(R.string.hide_statistics)); actions.add(HIDE_STATISTICS);
|
||||||
@ -2696,10 +2702,10 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MULTIPV_DEC:
|
case MULTIPV_DEC:
|
||||||
ctrl.setMultiPVMode(numPV - 1);
|
setMultiPVMode(numPVF - 1);
|
||||||
break;
|
break;
|
||||||
case MULTIPV_INC:
|
case MULTIPV_INC:
|
||||||
ctrl.setMultiPVMode(numPV + 1);
|
setMultiPVMode(numPVF + 1);
|
||||||
break;
|
break;
|
||||||
case HIDE_STATISTICS:
|
case HIDE_STATISTICS:
|
||||||
case SHOW_STATISTICS: {
|
case SHOW_STATISTICS: {
|
||||||
@ -2717,6 +2723,14 @@ public class DroidFish extends Activity implements GUIInterface {
|
|||||||
return alert;
|
return alert;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setMultiPVMode(int nPV) {
|
||||||
|
numPV = nPV;
|
||||||
|
Editor editor = settings.edit();
|
||||||
|
editor.putInt("numPV", numPV);
|
||||||
|
editor.commit();
|
||||||
|
ctrl.setMultiPVMode(numPV);
|
||||||
|
}
|
||||||
|
|
||||||
private final Dialog goBackMenuDialog() {
|
private final Dialog goBackMenuDialog() {
|
||||||
final int GOTO_START_GAME = 0;
|
final int GOTO_START_GAME = 0;
|
||||||
final int GOTO_START_VAR = 1;
|
final int GOTO_START_VAR = 1;
|
||||||
|
@ -175,8 +175,6 @@ public class DroidChessController {
|
|||||||
* @param strength Engine strength, 0 - 1000. */
|
* @param strength Engine strength, 0 - 1000. */
|
||||||
public final synchronized void setEngineStrength(String engine, int strength) {
|
public final synchronized void setEngineStrength(String engine, int strength) {
|
||||||
boolean newEngine = !engine.equals(this.engine);
|
boolean newEngine = !engine.equals(this.engine);
|
||||||
if (newEngine)
|
|
||||||
numPV = 1;
|
|
||||||
if (newEngine || (strength != this.strength)) {
|
if (newEngine || (strength != this.strength)) {
|
||||||
this.engine = engine;
|
this.engine = engine;
|
||||||
this.strength = strength;
|
this.strength = strength;
|
||||||
@ -565,17 +563,13 @@ public class DroidChessController {
|
|||||||
return computerPlayer.getMaxPV();
|
return computerPlayer.getMaxPV();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get multi-PV mode setting. */
|
|
||||||
public final synchronized int getNumPV() {
|
|
||||||
return numPV;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Set multi-PV mode. */
|
/** Set multi-PV mode. */
|
||||||
public final synchronized void setMultiPVMode(int numPV) {
|
public final synchronized void setMultiPVMode(int numPV) {
|
||||||
if (numPV < 1) numPV = 1;
|
int clampedNumPV = Math.min(numPV, maxPV());
|
||||||
if (numPV > maxPV()) numPV = maxPV();
|
clampedNumPV = Math.max(clampedNumPV, 1);
|
||||||
if (numPV != this.numPV) {
|
boolean modified = clampedNumPV != this.numPV;
|
||||||
this.numPV = numPV;
|
this.numPV = numPV;
|
||||||
|
if (modified) {
|
||||||
abortSearch();
|
abortSearch();
|
||||||
updateComputeThreads();
|
updateComputeThreads();
|
||||||
updateGUI();
|
updateGUI();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user