xboard.git
13 years agoAllow arbitrary nesting of sub-variations in PGN input
H.G. Muller [Sat, 6 Nov 2010 13:43:54 +0000]
Allow arbitrary nesting of sub-variations in PGN input

The parsing of subvariations is moved out of the state-machine parsing,
to allow arbitrary nesting. In stead of the entire sub-variation being
parsed by lex as Comment, it now returns Open and Close for the
corresponding parentheses, which are then handled in a wrapper routine
for yylex(): Myylex(). Problem was that yy_text is supposed to return
the entire parsed text of the returned symbol, which thus has to be
collected. To make this possible, yylex has to return everything that it
parses, (even white space!), and a symbol "Nothing" was added to return
in parsing rules that before just ate away irrelevant text without
returning anything.

13 years agoImplement setup (engine-GUI) command
H.G. Muller [Sat, 6 Nov 2010 20:48:47 +0000]
Implement setup (engine-GUI) command

This allows the frst engine (when legality testing is off) to overrule
the default opening position, in reply to the variant command. Syntax is
"setup (PIECE_TO_CHAR_TABLE) FEN_STRING"
where the FEN string is interpreted in the context of the given
pieceToCharTable (which is optional, and only delimeted by parethesis if
it is present).
Sendng the position to the second engine is delayed until the first
engine has responded to the ping after the new-game sequence, to make
sure it gets the chance to alter the position before it is sent to the
second engine. This feature is useful for playing variants that WinBoard
does not even know the opening positon for, and can be used even if they
are shuffle variants.

13 years agoRestrict use of a2a3 kludge
H.G. Muller [Sat, 6 Nov 2010 13:19:56 +0000]
Restrict use of a2a3 kludge

The kudge to send "a2a3" in stead of "black" to get black to move is
fatally flawed in varants that have no Pawn on a2. So in that case we
revert to use of the deprecated "black" command.

13 years agoRemember values set by -firstOptions, -secondOptions
H.G. Muller [Tue, 2 Nov 2010 12:06:58 +0000]
Remember values set by -firstOptions, -secondOptions

When an engine announces its option features, and the option name
matches that of a setting given in -first/secondOptions, the engine is
sent hte specified value, but this value was not remembered as current
value (but the latter  was left at the engine-announced default),
leading to inconsistent behavior in the Engine #N Settings dialog.

13 years agoMake test for valid promotion piece color-dependent
H.G. Muller [Mon, 1 Nov 2010 18:26:19 +0000]
Make test for valid promotion piece color-dependent

This is needed to make it work in variants where white and black have
different armies; quite likely white will promote to pieces that do not
exist in the black army, so we really have to make sure we test if the
white (upper-case) piece exists in this case.

13 years agoRemove validity test on promochar from parser
H.G. Muller [Mon, 1 Nov 2010 18:23:43 +0000]
Remove validity test on promochar from parser

The backend routines Disambiguate() and LegalityTest() will catch
invalid promotions, so no need to do it here.

13 years agoAdd the actual size-33 Shogi bitmaps
H.G. Muller [Sun, 31 Oct 2010 22:37:06 +0000]
Add the actual size-33 Shogi bitmaps

These were forgotten in the original commit that fixed the .rc file.

13 years agoDelete some stale promotion code
H.G. Muller [Sun, 31 Oct 2010 12:20:08 +0000]
Delete some stale promotion code

The correction of the promotion piece to Ferz in Shatran-like variants
in ApplyMove() was no longer needed, as the new promotion code already
does this in the move parser.

13 years agoAugment moves of some fairy pieces
H.G. Muller [Sun, 31 Oct 2010 12:08:52 +0000]
Augment moves of some fairy pieces

To get better disambiguation in variants that have to be played with
legality testing off, the Elephant is given also one-step moves (making
it a so-called Modern Elephant) in -variant fairy and great. The Dragon
King (Crowned Rook), which had no moves defined for it outside Shogi at
all, has been given Rook moves plus an orthogonal 2-jump, so that it
can get SAN moves when used as Dababba or Short Rook. (Illegal moves
currently aways force long algebraic notation...)

13 years agoBugfix safeStrCpy patch, WinBoard
H.G. Muller [Mon, 8 Nov 2010 21:57:56 +0000]
Bugfix safeStrCpy patch, WinBoard

The use of sizeof on pointers was detected through the same method as
the previous patches, this time while compiling WinBoard. A typo in
jaws.c was fixed as well.

13 years agoBugfix for safeStrCpy patch for XBoard
H.G. Muller [Mon, 8 Nov 2010 22:03:13 +0000]
Bugfix for safeStrCpy patch for XBoard

By a trick (temporarily redefining safeStrCpy in common.h as
((char*) (a=1/(4-3rdArgument))) ) a compile-time warning (division by 0)
could be generated for every occurrence where the size argument was equal
to 4, i.e. where the 1st argument was likely a pointer rather than an
array. These cases are now fixed. The file xoptions.c, which is the
only ne that does not #include common.h had to be fixed by making
the #define in the file itself.

13 years agoFix spurious promotions with legality testing off
H.G. Muller [Sun, 31 Oct 2010 12:16:01 +0000]
Fix spurious promotions with legality testing off

The recent promotion patch had broken playing without legality testing
completely: without legality testing one always gets the piece that was
asked for, but a NULLCHAR should not be taken as a request for a piece!
But it was, and this resulted in any moved piece turning into a white
Pawn! For true promotions the piece was always black, which was also not
very useful.

Also revert to the use of '+' as internal Shogi promoChar, because
pre-processing turns out not to be possible when reading a game file.
In stead parse any trailing '+' on moves as promoChar. Downside: '++'
can no longer be recognized as checkmate symbol.

13 years agoMake deferral default in Shogi promotions
H.G. Muller [Fri, 29 Oct 2010 20:54:18 +0000]
Make deferral default in Shogi promotions

Because '+' is intercepted by the parser as check indicator, Shogi moves
are pre-processed to change a trailing '+' into an internally used
alternative '^'. The testing if a promotion character is OK is now done
in LegalityTest() and Disambiguate(), which return ImpossibleMove when
the character does not correspond to any piece, and IllegalMove when in
Shogi anything other than '^' or '=' is used. (Except for the ICS
notations.) On output, in CoordsToComputerAlgebraic() and
CoordsToAlgebraic(), the '^' is translated back to '+'.

13 years agoAnimate piece explosions in drag-drop moves and in XB
H.G. Muller [Thu, 28 Oct 2010 15:51:34 +0000]
Animate piece explosions in drag-drop moves and in XB

This required some code restructuring: the decision if an explosion is
needed is now taken in a new routine Explode() in the backend. This then
calls the front-end driver, and it returns the info if there was an
explosion or not, so the caller (AnimateMove() or the mouse driver) can
take action to repair the damage to the board caused by the blast wave.
A front-end driver for XBoard is provided as well, so that both
click-click (and replay, which is the same) and drag-drop atomic
captures are animated in XB as well as WB.
Explosions on rejected moves are suppressed.

13 years agoSuppress promotion popup if piece will explode
H.G. Muller [Thu, 28 Oct 2010 11:53:51 +0000]
Suppress promotion popup if piece will explode

In atomic, a Pawn capture to last rank is not really a promotion.
Fix choice to Queen.

13 years agoMake Knight hop first straight, then diagonal
H.G. Muller [Thu, 28 Oct 2010 16:42:25 +0000]
Make Knight hop first straight, then diagonal

It used to be the other way around, which looked pretty illogical in
Xiangqi: to see Horses, which are blockable pieces there, move over an
occupied square.

13 years agoLet -oneClickMove also work in EditGame mode
H.G. Muller [Wed, 27 Oct 2010 18:04:01 +0000]
Let -oneClickMove also work in EditGame mode

There is really no reason why people that lke one-clcik moves enough to
switch them on would not want to use them too when editing a game.
This solves a nast inconsistency, as before it used to work in -ncp mode
on the _first_ move, as the mode is then BeginningOfGame, and not yet
EditGame, and we do want it to work for BeginningOfGame, as this is
also the game mode when you start playing as white.

13 years agoMake -flipBlack and -allWhite option volatile
H.G. Muller [Wed, 27 Oct 2010 17:40:22 +0000]
Make -flipBlack and -allWhite option volatile

As these options are very Shogi specific, and the variant is volatile,
it seems logical to make them also volatile. Not completely sure about
-allWhite, though. It cold be useful if you want, for example, to play
wth dark-brown pieces for black, as any color but black looks much
better with outline pieces than with solid pieces.

13 years agoProvide some sample board-texture pixmaps
H.G. Muller [Wed, 27 Oct 2010 17:33:44 +0000]
Provide some sample board-texture pixmaps

Wood and marble themes are provided as textures for light and dark
squares, plus two complete Xiangqi boards (wood and evenly colored).
These should probably not goint the distro tar ball.

13 years agoThe -overrideLineGap option is made to work in XBoard
H.G. Muller [Wed, 27 Oct 2010 17:25:56 +0000]
The -overrideLineGap option is made to work in XBoard

Although XBoard already allowed this in the -boardSize specification,
it is still seful to globally disable grid lines, e.g. for an
oriental Xiangqi board. And it converges XB and WB.

13 years agoImplement board textures in XBoard
H.G. Muller [Wed, 27 Oct 2010 17:18:41 +0000]
Implement board textures in XBoard

The -darkBackTextureFile and -liteBackTextureFile options now wrk in
XBoard too, for loading a pixmap that will be used to cut out the dark
and light square backgrounds. The cutting algorithm is such that the
pixmap image is completely restored if the size was that of the total
board (e.g. a drawing of a Xiangqi board).

13 years agoComplete WB (western) bitmaps for Shogi at size 33
H.G. Muller [Wed, 27 Oct 2010 10:11:02 +0000]
Complete WB (western) bitmaps for Shogi at size 33

The Lance was not replacing Queen in some sizes where the bitmaps were
already available, and new bitmaps for the promotion Golds were added.

13 years agoMake starting new variation dependent on shift key
H.G. Muller [Fri, 22 Oct 2010 18:30:06 +0000]
Make starting new variation dependent on shift key

The shift key is read during mouse events, and posted in a global
variable, which can then be used by the back-end. The decision to start
a new variation (pushing the game tail rather than clipping it off) when
entring a move in Edit Game or Analyze mode is made dependent on this.
The move-typein also records the shift-key state.

13 years agoFix merging bug
H.G. Muller [Fri, 22 Oct 2010 18:25:06 +0000]
Fix merging bug

A %g format was used to print an int in sending the level command,
because decimal points were dropped when merging patches. Also an unused
variable was removed to suppress a warning.

13 years agoAdd set of shogi pixmaps for XBoard
H.G. Muller [Mon, 18 Oct 2010 17:50:09 +0000]
Add set of shogi pixmaps for XBoard

The -size 64 pieces from gShogi (and originally XShogi) are made
suitable for loading by XBoard, through redefining the transparent
background color as either light or dark square color. These bitmaps are
not included in the XBoard build, and perhaps should not even be
included in the source distribution, but made available in a separate
distribution?

13 years agoImplement -flipBlack in XBoard
H.G. Muller [Mon, 18 Oct 2010 17:46:33 +0000]
Implement -flipBlack in XBoard

When -flipBlack is true, the white and back piece pixmaps are swapped in
flipView. The idea is that the black pieces are upside-down versions of
the white (Shogi) pieces, so that swapping white and black in effect
turns all pieces upside down, which is what should happen in flipView.

13 years agoDisable some very verbose debug printing
H.G. Muller [Mon, 11 Oct 2010 19:06:41 +0000]
Disable some very verbose debug printing

The internationalization seems debugged enough to do without them.

13 years agoAdd option -variations to control variation-tree walking
H.G. Muller [Mon, 11 Oct 2010 18:52:10 +0000]
Add option -variations to control variation-tree walking

Just so that users can switch it off if the find it annoying.

13 years agoAllow full promotion suffixes on SAN piece moves
H.G. Muller [Mon, 11 Oct 2010 19:01:00 +0000]
Allow full promotion suffixes on SAN piece moves

This facilitates the parsing of (non-standard) Shogi moves in ICS
protocol. It can also be useful for Seirawan Chess, where a future
implementation of it can use promotion suffixes to indicate gating.

13 years agoAllow lower-case piece indicator in drop-move notation
H.G. Muller [Mon, 11 Oct 2010 12:07:02 +0000]
Allow lower-case piece indicator in drop-move notation

As it seems that XBoard also sends such moves in zippy play, it seems
more fair to recognize them from the engine as well.

13 years agoFix bug in ICS variant switch for Shogi
H.G. Muller [Sun, 10 Oct 2010 19:26:11 +0000]
Fix bug in ICS variant switch for Shogi

Because a test for 8x8 variants was done by <= VariantShogi,
rather than <, spurious move-list fetching occurred in Shogi.

13 years agoFix WinBoard Lance bug
H.G. Muller [Sun, 10 Oct 2010 19:23:09 +0000]
Fix WinBoard Lance bug

The choice between Lance and Queen was made on appData.variant, in stead
of gameInfo.variant. Because of this it was not always up-to-date in ICS
games.

13 years agoAdapt WinBoard to Shogi implementation on Variant ICS
H.G. Muller [Sun, 10 Oct 2010 19:15:06 +0000]
Adapt WinBoard to Shogi implementation on Variant ICS

The Variant ICS does not use the '+P' notation for promoted pieces,
neither in the board, nor in SAN, but simply indicates any Gold by 'G',
and uses 'H' and 'D' for +B  and +R. The Shogi promotion code in
LegalityTest() and Disambiguate(), which are used in move Parsing, are
adapted to handle this. Deferred promotions sent to the ICS now use an
== suffix.

13 years agoInherit promoted-info that ICS does not give from previous board
H.G. Muller [Sun, 10 Oct 2010 19:07:18 +0000]
Inherit promoted-info that ICS does not give from previous board

The ICS does not tell us in Crazyhouse (or Shogi) if a piece is
primordial or a promoted pawn (or a promoted other piece). We now derive
this info from the previous board. The option -disguisePromotedPieces
controls this feature.

13 years agoLimit multi-session clock handling to non-ICS games
H.G. Muller [Sun, 10 Oct 2010 19:03:29 +0000]
Limit multi-session clock handling to non-ICS games

In ICS games a time forfeit crashed XBoard, apparently because the
fullTimeControl string is not properly set when we try to use it to see
if a sudden-death session is indeed the last session.

13 years agoChange evalgraph scale in drop games
H.G. Muller [Fri, 8 Oct 2010 09:47:34 +0000]
Change evalgraph scale in drop games

Score swings tend to be much larger in Crazyhouse and Shogi, so the
vertical rangee in those games is doubled to (-14, 14).

13 years agobugfix: fixed readline support with icslogon option
Arun Persaud [Thu, 14 Oct 2010 06:05:05 +0000]
bugfix: fixed readline support with icslogon option

The icslogon option sends the login and password, so we don't need to handle
special cases for the readline buffer.

13 years agofixed some typos that were introduced during the sprintf->snprintf changes
Arun Persaud [Fri, 8 Oct 2010 03:35:26 +0000]
fixed some typos that were introduced during the sprintf->snprintf changes

13 years agoFix uninitialized variable in book code
H.G. Muller [Thu, 7 Oct 2010 09:59:33 +0000]
Fix uninitialized variable in book code

The variable ' power' was used uninitialized in case -bookVariation was
set to 0, which can be an error even if it was only multiplied by zero.

13 years agoFix menu translation bug
H.G. Muller [Wed, 6 Oct 2010 12:20:03 +0000]
Fix menu translation bug

The menuText array was declared too small, so that the last entry of the
File menu got out of bounds and was overwritten by the first of the Mode
menu.

13 years agoAllow -timeIncrement to be a float
H.G. Muller [Tue, 5 Oct 2010 19:14:08 +0000]
Allow -timeIncrement to be a float

The increment can now be fractional seconds. The printing in
ParseTimeControl() and SendTimeControl() is done with %g format, so that
for integer increment there is backward compatibility with the old level
command.

13 years agoadding gnu-readline support
Arun Persaud [Wed, 31 Mar 2010 03:24:49 +0000]
adding gnu-readline support

should make the user interface for xboard a bit nicer. In the end we want to have a separate input window, but this probably will have to wait until the GTK version.

13 years agoadded warning if icsLogon file couldn't be opened
Arun Persaud [Sat, 25 Sep 2010 04:17:50 +0000]
added warning if icsLogon file couldn't be opened

13 years agosecurity fix: replaced some strcat with strncat
Arun Persaud [Sat, 25 Sep 2010 04:10:28 +0000]
security fix: replaced some strcat with strncat

there is still more to do

13 years agoadd option for silent builds
Arun Persaud [Mon, 20 Sep 2010 03:55:01 +0000]
add option for silent builds

this can be enabled for automake versions >1.11 by calling ./configure --enable-silent-rules.
It should still work for older automake versions too

13 years agobugfix: missing array index
Arun Persaud [Sun, 19 Sep 2010 20:16:40 +0000]
bugfix: missing array index

13 years agoadded new case for (Chessmove) 0 in common.h
Arun Persaud [Sun, 19 Sep 2010 19:19:44 +0000]
added new case for (Chessmove) 0 in common.h

this cleans up a few more -Wall messages

13 years agocleaned up -Wall warnings (apart from settings some parentheses)
Arun Persaud [Sat, 18 Sep 2010 04:47:22 +0000]
cleaned up -Wall warnings (apart from settings some parentheses)

removed unsused variables, etc mostly everything from -Wall -Wno-parenthesis

13 years agosizedefaults has 9 members, the last line of the array (NULL) only set 7.
Arun Persaud [Sat, 18 Sep 2010 03:36:54 +0000]
sizedefaults has 9 members, the last line of the array (NULL) only set 7.

13 years agosecurity fix: replaced sprintf with snprintf
Arun Persaud [Mon, 13 Sep 2010 03:04:03 +0000]
security fix: replaced sprintf with snprintf

replaced most sprintf with snprintf. There are still some left where for example a pointer is used and is allocated in the line before, which should be fine... and some others.

13 years agosecurity fix: replaced strcpy with safeStrCpy from backend.c
Arun Persaud [Sat, 11 Sep 2010 06:36:23 +0000]
security fix: replaced strcpy with safeStrCpy from backend.c

see comment in backend.c on how to use safeStrCpy. This was already added by AS, but only used in 3 places.

13 years agoEnhance multi-session TC clock handling
H.G. Muller [Mon, 4 Oct 2010 09:50:38 +0000]
Enhance multi-session TC clock handling

Some new TC types are introduced: Bronstein and free sessions. The
former is implemented by letting an exclamation point '!' in front of an
increment (in the -tc string) indicate that the increment is limited to
the time actually used on the previous move. The latter is an interval
of given duraton in which you can do any number of moves (even zero),
before the next session starts. This is needed for implementing Shogi
byoyomi-type TC, as a first session, followed by a session of fixed-time
per move. The latter can now be specified with the -tc argument as a
degenerate case of Bronstein, where the time on the clock is <= the
increment (so that it is never possible to think longer than the
increment). A TC of 5 min + 10 sec byoyomi can then be indicated as
300:10+!10.

The sessions are now separated by ':' in stead of '+', and all times in
the TC string are converted to seconds first (in ParseTimeControl), so
the fullTCstring can now be directly used in a PGN tag.

Note that this patch only addresses clock handling; the engine will not
be informed yet if the TC type or parameters change at the start of new
session!

13 years agoRemove promotion-piece encoding from ChessMove type
H.G. Muller [Mon, 4 Oct 2010 07:32:18 +0000]
Remove promotion-piece encoding from ChessMove type

The shizophrenic way to indcate promotion pieces in the XBoard code
(sometimes using a promoChar, at other times relying on moveType) was
cured by combining all promotion move types (such as WhitePromotionRook)
into a single one (WhitePromotion), and relying on promoChar to specify
the piece. This solves the problem of promoting to new piece types in
variants, which formerly also required addition of new move types.

In Shogi the '+' character is now consistently used to indicate
promotions (and recognized in ApplyMove), rather than 'q' or
PieeToChar(BlackQueen), as the latter did not work in minivariants where
the Queen (representng the Lance) did not partcipate.

13 years agoPass promoChar to SendMoveToICS
H.G. Muller [Sun, 3 Oct 2010 18:50:01 +0000]
Pass promoChar to SendMoveToICS

SendMoveToICS was the only place where the promotion piece was derived
from moveType, rather than an explicity passed promoChar.

13 years agoSuppress spurious use of SAN castling in mini variants
H.G. Muller [Mon, 4 Oct 2010 07:41:11 +0000]
Suppress spurious use of SAN castling in mini variants

King moves from a central file to the king-side-castled position (1
square away from the right corner) were intercepted and printed as O-O
in CoordsToAlgebraic. But on a 5x5 board (mini-Shogi!) this caught the
normal King move Kc1-d1 as well. The castling notation is now reserved
for King moves larger than one step.

13 years agoMake Shogi promotion zone board-size dependent
H.G. Muller [Mon, 4 Oct 2010 06:21:19 +0000]
Make Shogi promotion zone board-size dependent

In stead of using a fixed size of 3 ranks, we use BOARD_HEIGHT/3, which
would translate to 1 rank for mini-Shogi (5x5) and 2 ranks for Judgkin's
Shogi (6x6), which are indeed what these variants need.

13 years agoMake board-size overrule options volatile
H.G. Muller [Sun, 3 Oct 2010 17:58:00 +0000]
Make board-size overrule options volatile

The options -boardWidth, -boardHeight and -holdingSize were legacies
from the day choosing a variant would not automatically set a board
size. As a result they are seldomly used anymore. The first real
application is mini-Shogi (on 5x5 board), and it turned out very
annoying if the 5x5 settings persisted to the next session, where you
almost certainly want to play another variant.

13 years agoStrip DOS line endings from parser.l
H.G. Muller [Mon, 4 Oct 2010 07:16:47 +0000]
Strip DOS line endings from parser.l

13 years agoExtend mate test to drop games
H.G. Muller [Thu, 16 Sep 2010 16:58:37 +0000]
Extend mate test to drop games

MateTest() in case of no legal moves now also looks if there are legal
drops that can resolve the check. This provides reliable mate testing in
Crazyhouse and Shogi, so these are now made subject to adjudications too.

13 years agoExtend legality testing to drop moves
H.G. Muller [Thu, 16 Sep 2010 16:48:29 +0000]
Extend legality testing to drop moves

LegalityTest() can nowbe called with (internal-format) drop moves, and
delegates their testing to a new routine LegalDrop(). This routine
performs the 'no-pawn-on-back-rank' test that used to be in
UserMoveTest (which now calls LegalityTest also for drop moves).
The more complex Shogi case is also handled (except for Pawn mate
drops) in LegalDrop().

13 years agoRevert splitting of UserMoveEvent
H.G. Muller [Thu, 16 Sep 2010 16:25:21 +0000]
Revert splitting of UserMoveEvent

This splitting into UserMoveTest and FinishMove was no longer needed,
now that the new mouse driver no longer calls UserMoveTest to figure out
if a move is a promotion, and XBoard and WinBoard are unified in this
respect. It was counter-productive, because UserMoveTest was not able to
change the fromX, fromY (call-by-value) parameters for passing them to
FinishMove, so it had to defer the conversion of drop moves to internal
format to the latter, while it did not belong there. (Because
DropMenuEvent already delivers the moves in internal format.) This
whole kludgy construction was therefore abandoned, by going back
to the original 4.2.7 calling scheme, where UserMoveEvent completely
pre-processes the move, and when it is valid, calls FinishMove directly.

13 years agoFix silent bug in drop moves
H.G. Muller [Thu, 16 Sep 2010 16:02:40 +0000]
Fix silent bug in drop moves

In ApplyMove() the piece on the from square was accessed and used before
we tested for drop moves. As drop moves have off-board from-squares this
led to out-of-bound array access, which apparently was usually harmless.

13 years agoAllow parsing of upper-case machine moves
H.G. Muller [Thu, 16 Sep 2010 15:43:59 +0000]
Allow parsing of upper-case machine moves

Dubious patch, as it caters to non-compliancy. Some variant engines are
very non-compliant, though.

13 years agoPrevent transmission of spurious promo char to other engine
H.G. Muller [Thu, 16 Sep 2010 15:38:35 +0000]
Prevent transmission of spurious promo char to other engine

The parser now strps off spurious promotion characters.
New move types "White/BlackNonPromotion" had to be introduced for this,
to indicate NormalMoves that could have been a promotion, to make sure
the '=' suffix of Shogi deferred promotions survives.

13 years agofixed internationalization for winboard
Arun Persaud [Fri, 17 Sep 2010 03:44:37 +0000]
fixed internationalization for winboard

in the original commit some files were forgotten. This should fix it.

13 years agoFix JAWS bug saying side to move in ICS play
H.G. Muller [Sun, 29 Aug 2010 19:07:12 +0000]
Fix JAWS bug saying side to move in ICS play

This was done the wrong way around.

13 years agoMake WB run-time language switch possible from menu
H.G. Muller [Fri, 27 Aug 2010 12:08:39 +0000]
Make WB run-time language switch possible from menu

This is a rather involved patch that might not be worth it. It is
difficult, because translation of things that live forever is not easy
to invert (menus, the auxiliary windows). We hae to remember all
original, English texts there to be able to put them back,or
re-translate. Still does not fully work, although the menus and
temporary dialogs now are all OK.

13 years agoUpdate WB translation template
H.G. Muller [Fri, 27 Aug 2010 12:35:46 +0000]
Update WB translation template

The language.txt file now also contains all translatable strings from
the C source files, rather than jsut the resource.

13 years agoUpdate docs
H.G. Muller [Fri, 27 Aug 2010 12:14:51 +0000]
Update docs

Add descriptions for machine-match menu support and enhanced book
control, nick-name options and language.

13 years agoAdd some forgotten translation hooks
H.G. Muller [Fri, 27 Aug 2010 11:59:09 +0000]
Add some forgotten translation hooks

The general-options, file-browse dialogs and the about box did not call
Translate() yet. Also translate contents of combo boxes. Some small bug
fixes.

13 years agoDo not translate game-end messages in PGN
H.G. Muller [Fri, 27 Aug 2010 11:28:33 +0000]
Do not translate game-end messages in PGN

The messages themselves are not subjected to _(), but in stead their
displaying in DisplayMove is subjected to T_().

13 years agoInternationalization for WinBoard
H.G. Muller [Mon, 23 Aug 2010 11:23:22 +0000]
Internationalization for WinBoard

A function Translate() was added, which uses a list of item dialogs,
reads their value, and replaces it by a translation (if available). It
also reads the window title and sets a translation. Calls to this
routine are added in the initialization code of every dialog callback.
In addition all translatable strings in the WnBoard front end are marked
by the gettext macro _(). Because WB is not gettexted yet, a hard
re-definition of this macro is added in each file using it, to the
string-translation routine T_() supplied in winboard.c.
Code to read the translation file, and translate the menu texts is added
in winboard.c. In backend.c the meaning of the gettet macros is
redefined for the WIN32 case.

13 years agoMake the ID of all WB dialog items unique
H.G. Muller [Mon, 23 Aug 2010 11:07:40 +0000]
Make the ID of all WB dialog items unique

Mnany static dialog texts did share the ID -1 (IDC_STATIC). But to
replace tet at run-time for translation purposes, they need to be
addressed individually. So they were given new IDs, with symbols defined
for those.

13 years agoMark XBoard result messages for internationalization
H.G. Muller [Mon, 23 Aug 2010 10:48:07 +0000]
Mark XBoard result messages for internationalization

The GNU gettext macro _() is used with the game-end messages. This might
be controversial, as they will appear in the PGN as well. But only as a
comment. We can always decide not to supply a translation.

13 years agoDo not exit after match when match started from menu
H.G. Muller [Mon, 23 Aug 2010 10:43:27 +0000]
Do not exit after match when match started from menu

The codelooks weird, but matchMode == 2 in this case. We then use
DisplayNote() to report the match result.

13 years agoTrivial-draws recognition improved in Xiangqi
H.G. Muller [Mon, 23 Aug 2010 10:39:07 +0000]
Trivial-draws recognition improved in Xiangqi

Now based on a routine "SufficientDefence". If both have it, it is draw.

13 years agoUpdate .dev files
H.G. Muller [Fri, 20 Aug 2010 15:46:45 +0000]
Update .dev files

The relocation of parser.c and the addition of history.c was not yet
incorporated in the devcpp proect files.

13 years agoFix some MSVC compile errors
H.G. Muller [Thu, 19 Aug 2010 11:45:04 +0000]
Fix some MSVC compile errors

Some statements has moved up stream of declaratons, which is an error
that gcc is forgiving about, but where MSVC is strict.

13 years agoImproved patch for expansion of WB settings-file name
H.G. Muller [Sat, 14 Aug 2010 12:01:44 +0000]
Improved patch for expansion of WB settings-file name

The expansion of environment variables now allows multiple environment
variables in the path name. Tested on %HOMEDRIVE%%HOMEPATH%\winboard.ini
and %APPDATA%\winboard.ini.

13 years agoAdd -colorNickNames option
H.G. Muller [Sat, 7 Aug 2010 14:53:50 +0000]
Add -colorNickNames option

This option allows non-standard designation of side to move in FENs.
(Useful for Xiangqi, where white is indicated often as r(ed), and Shogi,
where white is s(ente) or b(lack), and black is g(ote) or w(hite).)
Can also be used for FENs in a local language. A match of theinput
character with the nick name translates it to the standard; this means
the standard will continue to be recognized, unless it was defined as a
nick name.

13 years agoTricked by the grossnes
H.G. Muller [Sat, 7 Aug 2010 14:39:16 +0000]
Tricked by the grossnes

Some WB menu items were referenced by a hard number. As items had been
added over the years, the wrong menu items were grayed. In particular
the Options -> Adjudication menu was grayed out, in -ncp mode, where
this was intended for the Sounds dialog. This accidentally proved
useful, until we started to apply adjudictions also to the Human moves.
Then it was suddenly undesirable, and a small mystery why it happened at
all, when I tried to change it. The numbers are now corrected to the new
locatons of the items in the menus.

13 years agoAllow match to be started from WB menu
H.G. Muller [Sat, 7 Aug 2010 14:35:23 +0000]
Allow match to be started from WB menu

A menu item Machine Match was added in the Mode menu to switch to
matchMode. A persistent option /defaultMatchGames determines the number
of games. A control was added to the Options -> Common Engine dialog to
set this option.

13 years agoAdd some book-control options
H.G. Muller [Sat, 7 Aug 2010 14:26:35 +0000]
Add some book-control options

Options /bookDepth and /bookVariation have been added to control the use
of the GUI book. In WinBoard the Optons -> Common Engine dialog now
contains fields to set them.

13 years agonew developer release
Arun Persaud [Sat, 7 Aug 2010 07:15:57 +0000]
new developer release

13 years agoRepair exit-popup deadlock patch
H.G. Muller [Fri, 6 Aug 2010 09:18:34 +0000]
Repair exit-popup deadlock patch

Relocating the exit popup call had made it lose access to the message it
should print, because it was declared only in an inner code block, by
the same name: buf[]. Deleting the inner declaration fixes it.

13 years agoFix erors when compiling with --disable-zippy
H.G. Muller [Wed, 4 Aug 2010 09:00:28 +0000]
Fix erors when compiling with --disable-zippy

The file args.h contained a codeblock in #ifdef ZIPPY, in stead of
fields.

13 years agoFix zippy handling of draw offers from ICS
H.G. Muller [Sun, 1 Aug 2010 11:27:23 +0000]
Fix zippy handling of draw offers from ICS

The patch by DM to fix the problem introduced by the coloration of
zippy-matched commands (namely that the coloration code beat the zippy
draw recognition to it, and ate the draw offer away) was only targeting
ICC. The new fix should work on any ICS (by using the same pattern in
zippy as in the colorization code).

13 years agoFix regression in colorization of zippy-matched commands
H.G. Muller [Sun, 1 Aug 2010 11:15:27 +0000]
Fix regression in colorization of zippy-matched commands

The patch by Daniel Mehrman from 4.2.pre8 was not properly merged, so
that in XBoard no coloration would take place of ICS commands that were
matched by zippy. (It was using &i as input pointer, rather than &backup.
The XBoard-specific code now has been deleted completely, to remove a
seemingly needless dependence on _WIN32_ of the back-end. Both WB and XB
now use the XBoard method, to only match zippy commands when logged in.

13 years agoSuggest default file name in browser dialog
H.G. Muller [Sat, 31 Jul 2010 20:48:45 +0000]
Suggest default file name in browser dialog

The argument 'def' to FileNamePopUp() was not passed through to the new
file-browser routine, which got NULL in stead, and thus started with an
empty input field.

13 years agoDefine /firstUCI and /secondUCI as synonyms for /fUCI, /sUCI
H.G. Muller [Fri, 30 Jul 2010 21:28:57 +0000]
Define /firstUCI and /secondUCI as synonyms for /fUCI, /sUCI

Because the %s expansion of WB options in the /fcp and /scp lines only
works for options that contain 'first' or 'second', and /fUCI thus did
not work, PSWBTM had to rely on the cumbersome /firstIsUCI=true to
install UCI engines. (The latter option should be deprecated really;
the UCI-ness of the engines is a volatile option, so it makes no sense
to supply a way to set them both to false or true. One only needs to be
able to set it to the non-default state.)

13 years agoAdd string option /pieceNickNames
H.G. Muller [Fri, 30 Jul 2010 21:21:50 +0000]
Add string option /pieceNickNames

This (volatile) option allows definition of alternate letters for the
pieces, which will be recognized next to the standard symbols as given
in the /pieceToCharTable on input. (Output always uses the standard.)
This can be useful for reading PGN from another language, or
non-compliant FENs (e.g. using B and N for E and H in Xiangqi).
  The format of the argument is the same as for /pieceToCharTable.
Because the nickNames are consulted before the standard table, it is
possible to redefine a standard name as a nick for another piece.

13 years agoFix deadlock in match-result display
H.G. Muller [Fri, 30 Jul 2010 21:10:42 +0000]
Fix deadlock in match-result display

At the end of a match, GameEnds() was recursively calling itself,
through DisplayFatalError() and ExitEvent(), and the latter was then
delaying until the calling GameEnds() terminated. (Which it would of
course never do before ExitEvent returned; fortunately there was a tim
limit to this delay, but in XBoard it was 10 sec in stead of 10 msec.)
 Now the calling of DisplayFatalError() (to show the result popup) is
delayed until after GameEnds completes (and resets the anti-recursion
flag 'endingGame'), so that it is simply executed a second time, unaware
of the earlier call. But this second time it does not do anything,
because the gameMode ws set to EndOfGame the first time, and the writing
of the PGN is blocked by the checksum being still the same.

13 years agoFix WinBoard game-list title
H.G. Muller [Mon, 12 Jul 2010 09:10:17 +0000]
Fix WinBoard game-list title

Number of displayed games and WDL stats were always appended to the
existing title, leading to an ever-growing title in the game-list
window. Now the old actual title is ignored, and the starts is appended
to the original title "Game List". (In the future we could use the
filename here?)

In addition, the title was not updated when re-opening the game-list
window, while the stats could change if filtering was active when the
window was closed. (In that case the filter is cleared on re-opening, so
the number of displayed games changes.) Now a title-update (after
recalculating the stats) is done every time the game-list window is
opened.

13 years agoRefactoring of material-draws adjudication code
H.G. Muller [Sun, 11 Jul 2010 09:06:27 +0000]
Refactoring of material-draws adjudication code

Insufficient mating material is now determined per side individually, by
testing for MatingPotential of each side. If both lack mating potential
the game is adjudicated as draw (if the -materialDraws option is set).

This way MatingPotential() can later also be used to correct losses by
forfeit to draws (which currently is only done when the opponent has a
bare King).

The accuracy of this type of adjudication in Xiangqi has been highly
improved.

13 years agoFix bug in sending cores command to engine
H.G. Muller [Sun, 11 Jul 2010 08:54:59 +0000]
Fix bug in sending cores command to engine

The cores command was alwas sent to the engine(s) when the user changed
it through the menu, even when the engine had sent feature smp=0 (which
is default anyway). NewSettingEvent() was patched to send the new
setting conditionally, based on the engine properties as recorded in
ChessProgramStates first, second; In this particular case it now
consults cps->maxCores. (Note the code for testing the second engine
contains some dirty pointer arithmetic.)

13 years agoFix oneClickMove bug
H.G. Muller [Sun, 11 Jul 2010 08:42:00 +0000]
Fix oneClickMove bug

When checking for unique captures, no attention was payed to the option
setting, so the capture was also made when the option was off.

13 years agoRemove duplicate testing for cores feature
H.G. Muller [Sun, 11 Jul 2010 08:39:28 +0000]
Remove duplicate testing for cores feature

The testing for this BooleanFeature occurred twice.

13 years agoRemove misspelled prototype
H.G. Muller [Sun, 11 Jul 2010 08:35:13 +0000]
Remove misspelled prototype

NewSettingEvent occurred, next to the correct one, in misspelled form.

13 years agoFix parsing of SAN shogi promotions
H.G. Muller [Mon, 5 Jul 2010 08:00:01 +0000]
Fix parsing of SAN shogi promotions

A missing promotion character defaults to promotion in the move type,
but the promotion character was not set when this happened in variant
shogi. And it is especially important there, as the promotion character
'+' will always be missing, as the parser will take it to be a 'check'
symbol, and strip it from the move.

13 years agoFix variant switch on PGN loading
H.G. Muller [Mon, 5 Jul 2010 07:55:14 +0000]
Fix variant switch on PGN loading

When the PGN specified an essentially different variant, the
piece bitmaps were not properly adapted, because the switch was done by
calling InitPosition(), rather than Reset(). (The latter would destroy
the PGN tags info.) We now added an explicit call to ResetFrontEnd(),
(which is normally done from Reset()).