mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-12-11 16:42:41 +01:00
DroidFish: Optional second title line with captured piece information and time control information. Implemented by Leo Mayer, with some changes by me.
This commit is contained in:
Binary file not shown.
@@ -15,6 +15,11 @@
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:paddingLeft="1dp">
|
||||
<include
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
layout="@layout/title">
|
||||
</include>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
<include
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
layout="@layout/title">
|
||||
</include>
|
||||
<view
|
||||
class="org.petero.droidfish.ChessBoardPlay"
|
||||
android:id="@+id/chessboard"
|
||||
|
||||
@@ -10,6 +10,11 @@
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="fill_parent">
|
||||
<include
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
layout="@layout/title">
|
||||
</include>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
|
||||
@@ -1,32 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="@android:drawable/title_bar">
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical">
|
||||
<TextView
|
||||
style="?android:attr/windowTitleStyle"
|
||||
android:id="@+id/white_clock"
|
||||
android:layout_weight="1"
|
||||
style="?android:attr/windowTitleStyle"
|
||||
android:layout_width="fill_parent"
|
||||
android:gravity="left"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="marquee"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:gravity="left|center_vertical"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:scrollHorizontally="true"
|
||||
android:singleLine="true">
|
||||
</TextView>
|
||||
<TextView
|
||||
style="?android:attr/windowTitleStyle"
|
||||
android:id="@+id/title_text"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/app_name"
|
||||
style="?android:attr/windowTitleStyle"
|
||||
android:layout_width="fill_parent"
|
||||
android:gravity="center"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center|center_vertical"
|
||||
android:text="@string/app_name">
|
||||
</TextView>
|
||||
<TextView
|
||||
style="?android:attr/windowTitleStyle"
|
||||
android:id="@+id/black_clock"
|
||||
android:layout_weight="1"
|
||||
style="?android:attr/windowTitleStyle"
|
||||
android:layout_width="fill_parent"
|
||||
android:gravity="right"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="marquee"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:gravity="right|center_vertical"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:scrollHorizontally="true"
|
||||
android:singleLine="true">
|
||||
</TextView>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/second_title_line"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical">
|
||||
<TextView
|
||||
android:id="@+id/white_pieces"
|
||||
style="?android:attr/windowTitleStyle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="marquee"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:gravity="center|center_vertical"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:scrollHorizontally="true"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textStyle="bold">
|
||||
</TextView>
|
||||
<TextView
|
||||
android:id="@+id/title_text_summary"
|
||||
style="?android:attr/windowTitleStyle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center|center_vertical"
|
||||
android:text="">
|
||||
</TextView>
|
||||
<TextView
|
||||
android:id="@+id/black_pieces"
|
||||
style="?android:attr/windowTitleStyle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="marquee"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:gravity="center|center_vertical"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:scrollHorizontally="true"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textStyle="bold">
|
||||
</TextView>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -200,6 +200,8 @@ you are not actively using the program.\
|
||||
<string name="start_new_game">Start New Game?</string>
|
||||
<string name="strength_cuckoo_hint">Use the CuckooChess engine for even lower strength.</string>
|
||||
<string name="piece_names">P N B R Q K</string>
|
||||
<string name="material_diff_summary">Displays an additional subtitle for captured pieces</string>
|
||||
<string name="material_diff_title">Show Material Difference</string>
|
||||
<string name="err_too_few_spaces">Too few spaces</string>
|
||||
<string name="err_invalid_piece">Invalid piece</string>
|
||||
<string name="err_invalid_side">Invalid side</string>
|
||||
|
||||
@@ -196,6 +196,11 @@
|
||||
android:entries="@array/viewPieceType_texts"
|
||||
android:defaultValue="@string/viewPieceType_default">
|
||||
</ListPreference>
|
||||
<CheckBoxPreference
|
||||
android:key="materialDiff"
|
||||
android:summary="@string/material_diff_summary"
|
||||
android:title="@string/material_diff_title" >
|
||||
</CheckBoxPreference>
|
||||
<PreferenceScreen
|
||||
android:key="buttonSettings"
|
||||
android:title="@string/prefs_buttonSettings_title"
|
||||
|
||||
@@ -140,9 +140,9 @@ public class ChessBoardPlay extends ChessBoard {
|
||||
int p = pos.getPiece(sq);
|
||||
if (myColor(p)) {
|
||||
String msg = getContext().getString(R.string.piece_can_not_be_moved);
|
||||
boolean localized = (pgnOptions != null) &&
|
||||
(pgnOptions.view.pieceType != PGNOptions.PT_ENGLISH);
|
||||
msg += ": " + TextIO.pieceAndSquareToString(localized, p, sq);
|
||||
int pieceType = (pgnOptions == null) ? PGNOptions.PT_LOCAL
|
||||
: pgnOptions.view.pieceType;
|
||||
msg += ": " + TextIO.pieceAndSquareToString(pieceType, p, sq);
|
||||
Toast.makeText(getContext(), msg, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
DroidFish - An Android chess program.
|
||||
Copyright (C) 2011-2012 Peter Österlund, peterosterlund2@gmail.com
|
||||
Copyright (C) 2012 Leo Mayer
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -47,6 +48,7 @@ import org.petero.droidfish.gamelogic.DroidChessController;
|
||||
import org.petero.droidfish.gamelogic.ChessParseError;
|
||||
import org.petero.droidfish.gamelogic.Move;
|
||||
import org.petero.droidfish.gamelogic.Pair;
|
||||
import org.petero.droidfish.gamelogic.Piece;
|
||||
import org.petero.droidfish.gamelogic.Position;
|
||||
import org.petero.droidfish.gamelogic.TextIO;
|
||||
import org.petero.droidfish.gamelogic.PgnToken;
|
||||
@@ -177,6 +179,8 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||
private ImageButton modeButton, undoButton, redoButton;
|
||||
private ButtonActions custom1ButtonActions, custom2ButtonActions, custom3ButtonActions;
|
||||
private TextView whiteTitleText, blackTitleText, engineTitleText;
|
||||
private View secondTitleLine;
|
||||
private TextView whiteFigText, blackFigText, summaryTitleText;
|
||||
|
||||
SharedPreferences settings;
|
||||
|
||||
@@ -187,6 +191,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||
private MediaPlayer moveSound;
|
||||
private boolean vibrateEnabled;
|
||||
private boolean animateMoves;
|
||||
private boolean showMaterialDiff;
|
||||
|
||||
private final static String bookDir = "DroidFish";
|
||||
private final static String pgnDir = "DroidFish" + File.separator + "pgn";
|
||||
@@ -357,8 +362,10 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||
custom3ButtonActions = new ButtonActions("custom3", CUSTOM3_BUTTON_DIALOG,
|
||||
R.string.select_action);
|
||||
|
||||
figNotation = Typeface.createFromAsset(getAssets(), "fonts/DroidFishChessNotationDark.otf");
|
||||
setPieceNames(PGNOptions.PT_LOCAL);
|
||||
initUI(true);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
initUI();
|
||||
|
||||
gameTextListener = new PgnScreenText(pgnOptions);
|
||||
if (ctrl != null)
|
||||
@@ -393,10 +400,17 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||
}
|
||||
}
|
||||
|
||||
// Unicode code points for chess pieces
|
||||
private static final String figurinePieceNames = Piece.NOTATION_PAWN + " " +
|
||||
Piece.NOTATION_KNIGHT + " " +
|
||||
Piece.NOTATION_BISHOP + " " +
|
||||
Piece.NOTATION_ROOK + " " +
|
||||
Piece.NOTATION_QUEEN + " " +
|
||||
Piece.NOTATION_KING;
|
||||
|
||||
private final void setPieceNames(int pieceType) {
|
||||
if (pieceType == PGNOptions.PT_FIGURINE) {
|
||||
// Unicode code points for chess pieces
|
||||
TextIO.setPieceNames("\u2659 \u2658 \u2657 \u2656 \u2655 \u2654");
|
||||
TextIO.setPieceNames(figurinePieceNames);
|
||||
} else {
|
||||
TextIO.setPieceNames(getString(R.string.piece_names));
|
||||
}
|
||||
@@ -481,7 +495,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
ChessBoardPlay oldCB = cb;
|
||||
String statusStr = status.getText().toString();
|
||||
initUI(false);
|
||||
initUI();
|
||||
readPrefs();
|
||||
cb.cursorX = oldCB.cursorX;
|
||||
cb.cursorY = oldCB.cursorY;
|
||||
@@ -496,20 +510,35 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||
setStatusString(statusStr);
|
||||
moveListUpdated();
|
||||
updateThinkingInfo();
|
||||
ctrl.updateRemainingTime();
|
||||
ctrl.updateMaterialDiffList();
|
||||
}
|
||||
|
||||
private final void initUI(boolean initTitle) {
|
||||
if (initTitle)
|
||||
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
|
||||
private final void initUI() {
|
||||
Configuration config = getResources().getConfiguration();
|
||||
// The Android app title is removed with the style, but remains
|
||||
// individually in the Layout cause we need it to have in 2 lines +
|
||||
// landscape and portrait differ quite much
|
||||
boolean leftHanded = this.leftHanded && (config.orientation == Configuration.ORIENTATION_LANDSCAPE);
|
||||
setContentView(leftHanded ? R.layout.main_left_handed : R.layout.main);
|
||||
if (initTitle) {
|
||||
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title);
|
||||
|
||||
// title lines need to be regenerated every time due to layout changes (rotations)
|
||||
secondTitleLine = findViewById(R.id.second_title_line);
|
||||
whiteTitleText = (TextView)findViewById(R.id.white_clock);
|
||||
whiteTitleText.setSelected(true);
|
||||
blackTitleText = (TextView)findViewById(R.id.black_clock);
|
||||
blackTitleText.setSelected(true);
|
||||
engineTitleText = (TextView)findViewById(R.id.title_text);
|
||||
}
|
||||
whiteFigText = (TextView)findViewById(R.id.white_pieces);
|
||||
whiteFigText.setTypeface(figNotation);
|
||||
whiteFigText.setSelected(true);
|
||||
whiteFigText.setTextColor(whiteTitleText.getTextColors());
|
||||
blackFigText = (TextView)findViewById(R.id.black_pieces);
|
||||
blackFigText.setTypeface(figNotation);
|
||||
blackFigText.setSelected(true);
|
||||
blackFigText.setTextColor(blackTitleText.getTextColors());
|
||||
summaryTitleText = (TextView)findViewById(R.id.title_text_summary);
|
||||
|
||||
status = (TextView)findViewById(R.id.status);
|
||||
moveListScroll = (ScrollView)findViewById(R.id.scrollView);
|
||||
moveList = (TextView)findViewById(R.id.moveList);
|
||||
@@ -778,6 +807,7 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||
int movesPerSession = getIntSetting("movesPerSession", 60);
|
||||
int timeIncrement = getIntSetting("timeIncrement", 0);
|
||||
ctrl.setTimeLimit(timeControl, movesPerSession, timeIncrement);
|
||||
setSummaryTitle();
|
||||
|
||||
scrollSensitivity = Float.parseFloat(settings.getString("scrollSensitivity", "2"));
|
||||
invertScrollDirection = settings.getBoolean("invertScrollDirection", false);
|
||||
@@ -788,7 +818,6 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||
setWakeLock(useWakeLock);
|
||||
|
||||
int fontSize = getIntSetting("fontSize", 12);
|
||||
figNotation = Typeface.createFromAsset(getAssets(), "fonts/DroidFishChessNotationDark.otf");
|
||||
int statusFontSize = fontSize;
|
||||
Configuration config = getResources().getConfiguration();
|
||||
if (config.orientation == Configuration.ORIENTATION_PORTRAIT)
|
||||
@@ -853,6 +882,9 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||
// update the typeset in case of a change anyway, cause it could occur
|
||||
// as well in rotation
|
||||
setFigurineNotation(pgnOptions.view.pieceType == PGNOptions.PT_FIGURINE, fontSize);
|
||||
|
||||
showMaterialDiff = settings.getBoolean("materialDiff", false);
|
||||
secondTitleLine.setVisibility(showMaterialDiff ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -953,6 +985,25 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||
}
|
||||
}
|
||||
|
||||
/** Update center field in second header line. */
|
||||
private final void setSummaryTitle() {
|
||||
int[] tmpInfo = ctrl.getTimeLimit();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int tc = tmpInfo[0];
|
||||
int mps = tmpInfo[1];
|
||||
int inc = tmpInfo[2];
|
||||
if (mps > 0) {
|
||||
sb.append(mps);
|
||||
sb.append(" / ");
|
||||
}
|
||||
sb.append(timeToString(tc));
|
||||
if ((inc > 0) || (mps <= 0)) {
|
||||
sb.append(" + ");
|
||||
sb.append(tmpInfo[2] / 1000);
|
||||
}
|
||||
summaryTitleText.setText(sb.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEngineTitle() {
|
||||
String engine = settings.getString("engine", "stockfish");
|
||||
@@ -960,6 +1011,13 @@ public class DroidFish extends Activity implements GUIInterface {
|
||||
setEngineTitle(engine, strength);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMaterialDifferenceTitle(CharSequence whitePieces,
|
||||
CharSequence blackPieces) {
|
||||
whiteFigText.setText(whitePieces);
|
||||
blackFigText.setText(blackPieces);
|
||||
}
|
||||
|
||||
private final void setFullScreenMode(boolean fullScreenMode) {
|
||||
WindowManager.LayoutParams attrs = getWindow().getAttributes();
|
||||
if (fullScreenMode) {
|
||||
|
||||
@@ -80,6 +80,10 @@ public interface GUIInterface {
|
||||
/** Update engine title text. */
|
||||
public void updateEngineTitle();
|
||||
|
||||
/** Update title with the material difference. */
|
||||
public void updateMaterialDifferenceTitle(CharSequence whitePieces,
|
||||
CharSequence blackPieces);
|
||||
|
||||
/** Report a move made that is a candidate for GUI animation. */
|
||||
public void setAnimMove(Position sourcePos, Move move, boolean forward);
|
||||
|
||||
|
||||
@@ -111,6 +111,17 @@ public class DroidChessController {
|
||||
game.timeController.setTimeControl(timeControl, movesPerSession, timeIncrement);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Array containing time control, moves per session and time increment.
|
||||
*/
|
||||
public final int[] getTimeLimit() {
|
||||
int[] ret = new int[3];
|
||||
ret[0] = timeControl;
|
||||
ret[1] = movesPerSession;
|
||||
ret[2] = timeIncrement;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** The chess clocks are stopped when the GUI is paused. */
|
||||
public final synchronized void setGuiPaused(boolean paused) {
|
||||
guiPaused = paused;
|
||||
@@ -1020,6 +1031,25 @@ public class DroidChessController {
|
||||
gui.setPosition(game.currPos(), sb.toString(), game.tree.variations());
|
||||
|
||||
updateRemainingTime();
|
||||
updateMaterialDiffList();
|
||||
}
|
||||
|
||||
public final void updateMaterialDiffList() {
|
||||
Position pos = game.currPos();
|
||||
StringBuilder whiteString = new StringBuilder();
|
||||
StringBuilder blackString = new StringBuilder();
|
||||
for (int p = Piece.WPAWN; p >= Piece.WQUEEN; p--) {
|
||||
int diff = pos.nPieces(p) - pos.nPieces(Piece.swapColor(p));
|
||||
while (diff < 0) {
|
||||
whiteString.append(Piece.toUniCode(Piece.swapColor(p)));
|
||||
diff++;
|
||||
}
|
||||
while (diff > 0) {
|
||||
blackString.append(Piece.toUniCode(p));
|
||||
diff--;
|
||||
}
|
||||
}
|
||||
gui.updateMaterialDifferenceTitle(whiteString, blackString);
|
||||
}
|
||||
|
||||
private final synchronized void setThinkingInfo(int id, ArrayList<ArrayList<Move>> pvMoves, String pvStr,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
DroidFish - An Android chess program.
|
||||
Copyright (C) 2011 Peter Österlund, peterosterlund2@gmail.com
|
||||
Copyright (C) 2012 Leo Mayer
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -41,6 +42,30 @@ public class Piece {
|
||||
|
||||
public static final int nPieceTypes = 13;
|
||||
|
||||
// Unicode for color neutral chess pieces
|
||||
public static final char NOTATION_KING = 0xe050;
|
||||
public static final char NOTATION_QUEEN = 0xe051;
|
||||
public static final char NOTATION_ROOK = 0xe052;
|
||||
public static final char NOTATION_BISHOP = 0xe053;
|
||||
public static final char NOTATION_KNIGHT = 0xe054;
|
||||
public static final char NOTATION_PAWN = 0xe055;
|
||||
|
||||
// Unicode for white chess pieces
|
||||
public static final char WHITE_KING = 0x2654;
|
||||
public static final char WHITE_QUEEN = 0x2655;
|
||||
public static final char WHITE_ROOK = 0x2656;
|
||||
public static final char WHITE_BISHOP = 0x2657;
|
||||
public static final char WHITE_KNIGHT = 0x2658;
|
||||
public static final char WHITE_PAWN = 0x2659;
|
||||
|
||||
// Unicode for black chess pieces
|
||||
public static final char BLACK_KING = 0x265A;
|
||||
public static final char BLACK_QUEEN = 0x265B;
|
||||
public static final char BLACK_ROOK = 0x265C;
|
||||
public static final char BLACK_BISHOP = 0x265D;
|
||||
public static final char BLACK_KNIGHT = 0x265E;
|
||||
public static final char BLACK_PAWN = 0x265F;
|
||||
|
||||
/**
|
||||
* Return true if p is a white piece, false otherwise.
|
||||
* Note that if p is EMPTY, an unspecified value is returned.
|
||||
@@ -59,4 +84,10 @@ public class Piece {
|
||||
return EMPTY;
|
||||
return isWhite(pType) ? pType + (BKING - WKING) : pType - (BKING - WKING);
|
||||
}
|
||||
|
||||
/** Converts the piece into a character for the material diff. */
|
||||
public final static char toUniCode(int p) {
|
||||
// As we assume, the coding of the pieces is sequential, lets do some math.
|
||||
return (char)(WHITE_KING + p - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ package org.petero.droidfish.gamelogic;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.petero.droidfish.PGNOptions;
|
||||
import org.petero.droidfish.R;
|
||||
|
||||
|
||||
@@ -729,14 +730,19 @@ public class TextIO {
|
||||
}
|
||||
|
||||
/** Convert a piece and a square to a string, such as Nf3. */
|
||||
public final static String pieceAndSquareToString(boolean localized, int p, int sq) {
|
||||
String ret;
|
||||
public final static String pieceAndSquareToString(int currentPieceType, int p, int sq) {
|
||||
StringBuilder ret = new StringBuilder();
|
||||
if (currentPieceType == PGNOptions.PT_FIGURINE) {
|
||||
ret.append(Piece.toUniCode(p));
|
||||
} else {
|
||||
boolean localized = (currentPieceType != PGNOptions.PT_ENGLISH);
|
||||
if ((p == Piece.WPAWN) || (p == Piece.BPAWN))
|
||||
ret = localized ? pieceNames[0] : "P";
|
||||
ret.append(localized ? pieceNames[0] : "P");
|
||||
else
|
||||
ret = localized ? pieceToCharLocalized(p) : pieceToChar(p);
|
||||
ret += squareToString(sq);
|
||||
return ret;
|
||||
ret.append(localized ? pieceToCharLocalized(p) : pieceToChar(p));
|
||||
}
|
||||
ret.append(squareToString(sq));
|
||||
return ret.toString();
|
||||
}
|
||||
|
||||
private final static String pieceToChar(int p) {
|
||||
|
||||
Reference in New Issue
Block a user