mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-12-03 17:01:05 +01:00
DroidFish: Added game numbers to the game list when loading/saving from PGN files and when loading from a Scid database.
This commit is contained in:
parent
dedb66beca
commit
ee494c50f6
|
@ -52,7 +52,11 @@ public class LoadScid extends ListActivity {
|
|||
String summary = "";
|
||||
int gameId = -1;
|
||||
public String toString() {
|
||||
return summary;
|
||||
StringBuilder sb = new StringBuilder(128);
|
||||
sb.append(gameId+1);
|
||||
sb.append(". ");
|
||||
sb.append(summary);
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -145,6 +145,7 @@ public class PGNFile {
|
|||
}
|
||||
|
||||
private final static class HeaderInfo {
|
||||
int gameNo;
|
||||
String event = "";
|
||||
String site = "";
|
||||
String date = "";
|
||||
|
@ -152,9 +153,15 @@ public class PGNFile {
|
|||
String white = "";
|
||||
String black = "";
|
||||
String result = "";
|
||||
|
||||
HeaderInfo(int gameNo) {
|
||||
this.gameNo = gameNo;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder info = new StringBuilder(128);
|
||||
info.append(gameNo);
|
||||
info.append(". ");
|
||||
info.append(white);
|
||||
info.append(" - ");
|
||||
info.append(black);
|
||||
|
@ -201,6 +208,7 @@ public class PGNFile {
|
|||
HeaderInfo hi = null;
|
||||
boolean inHeader = false;
|
||||
long filePos = 0;
|
||||
int gameNo = 1;
|
||||
while (true) {
|
||||
filePos = f.getFilePointer();
|
||||
String line = f.readLine();
|
||||
|
@ -238,7 +246,7 @@ public class PGNFile {
|
|||
gi = new GameInfo();
|
||||
gi.startPos = filePos;
|
||||
gi.endPos = -1;
|
||||
hi = new HeaderInfo();
|
||||
hi = new HeaderInfo(gameNo++);
|
||||
}
|
||||
if (line.startsWith("[Event ")) {
|
||||
if (len >= 10) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user