X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=gnushogi%2Ftcontrl.c;h=2ce441639b8d0f4e13349b502da627a955e2b389;hb=mini;hp=f8f15dc2eb2a88af1ba7d204f607311cbf029a03;hpb=9da823015c78c8e9131cf76f14598a1071d29192;p=gnushogi.git diff --git a/gnushogi/tcontrl.c b/gnushogi/tcontrl.c index f8f15dc..2ce4416 100644 --- a/gnushogi/tcontrl.c +++ b/gnushogi/tcontrl.c @@ -4,6 +4,7 @@ * ---------------------------------------------------------------------- * Copyright (c) 1993, 1994, 1995 Matthias Mutz * Copyright (c) 1999 Michael Vanier and the Free Software Foundation + * Copyright (c) 2008, 2013, 2014 Yann Dirson and the Free Software Foundation * * GNU SHOGI is based on GNU CHESS * @@ -413,3 +414,24 @@ ElapsedTime(ElapsedTime_mode iop) dsp->UpdateClocks(); } } + + +void +SetTimeControl(void) +{ + if (TCflag) + { + TimeControl.moves[black] = TimeControl.moves[white] = TCmoves; + TimeControl.clock[black] += 6000L * TCminutes + TCseconds * 100; + TimeControl.clock[white] += 6000L * TCminutes + TCseconds * 100; + } + else + { + TimeControl.moves[black] = TimeControl.moves[white] = 0; + TimeControl.clock[black] = TimeControl.clock[white] = 0; + } + + flag.onemove = (TCmoves == 1); + et = 0; + ElapsedTime(COMPUTE_AND_INIT_MODE); +}