Fixed UCI combo GUI type to support multiple predefined values
This commit is contained in:
parent
1d37a23f2f
commit
bce35fc950
@ -1,5 +1,6 @@
|
||||
package dev.kske.chess.game;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import dev.kske.chess.uci.UCIListener;
|
||||
@ -86,7 +87,7 @@ class UCIPlayerListener implements UCIListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOption(String name, GUIType type, String defaultVal, String minVal, String maxVal, String var) {
|
||||
public void onOption(String name, GUIType type, String defaultVal, String minVal, String maxVal, List<String> var) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package dev.kske.chess.uci;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -96,7 +97,7 @@ public interface UCIListener {
|
||||
* @param maxVal The maximum value of this parameter
|
||||
* @param var A predefined value of this parameter
|
||||
*/
|
||||
void onOption(String name, GUIType type, String defaultVal, String minVal, String maxVal, String var);
|
||||
void onOption(String name, GUIType type, String defaultVal, String minVal, String maxVal, List<String> var);
|
||||
|
||||
public static enum GUIType {
|
||||
CHECK, SPIN, COMBO, BUTTON, STRING
|
||||
|
@ -4,8 +4,10 @@ import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import dev.kske.chess.uci.UCIListener.GUIType;
|
||||
@ -151,12 +153,12 @@ public class UCIReceiver implements Runnable {
|
||||
private void parseOption(String line) {
|
||||
String[] tokens = line.split(" ");
|
||||
|
||||
String name = "";
|
||||
GUIType type = null;
|
||||
String defaultVal = null;
|
||||
String minVal = null;
|
||||
String maxVal = null;
|
||||
String var = null;
|
||||
String name = "";
|
||||
GUIType type = null;
|
||||
String defaultVal = null;
|
||||
String minVal = null;
|
||||
String maxVal = null;
|
||||
List<String> var = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < tokens.length; i++)
|
||||
switch (tokens[i]) {
|
||||
@ -176,7 +178,7 @@ public class UCIReceiver implements Runnable {
|
||||
maxVal = tokens[++i];
|
||||
break;
|
||||
case "var":
|
||||
var = tokens[++i];
|
||||
var.add(tokens[++i]);
|
||||
break;
|
||||
default:
|
||||
System.err.printf("Unknown parameter '%s' for command 'option' found!%n", tokens[i]);
|
||||
|
Reference in New Issue
Block a user