Bug fixes
parent
b028b7bce5
commit
00b3c1c09e
|
@ -219,7 +219,8 @@ object Event {
|
|||
def data = Json.obj(
|
||||
"winner" -> game.winnerColor,
|
||||
"status" -> game.status
|
||||
).add("ratingDiff" -> ratingDiff.map { rds =>
|
||||
).add("clock" -> game.clock.map { c => Clock(c).data })
|
||||
.add("ratingDiff" -> ratingDiff.map { rds =>
|
||||
Json.obj(
|
||||
Color.White.name -> rds.white,
|
||||
Color.Black.name -> rds.black
|
||||
|
|
|
@ -375,35 +375,43 @@ case class Game(
|
|||
else history.reset(color).record(color, newClock)
|
||||
})
|
||||
).updatePlayer(color, _.goBerserk)) ++
|
||||
List(Event.Clock(newClock), Event.Berserk(color))
|
||||
List(
|
||||
Event.ClockInc(color, -c.config.berserkPenalty),
|
||||
Event.Clock(newClock), // BC
|
||||
Event.Berserk(color)
|
||||
)
|
||||
}
|
||||
|
||||
def resignable = playable && !abortable
|
||||
def drawable = playable && !abortable
|
||||
|
||||
def finish(status: Status, winner: Option[Color]) = Progress(
|
||||
this,
|
||||
copy(
|
||||
status = status,
|
||||
whitePlayer = whitePlayer.finish(winner contains White),
|
||||
blackPlayer = blackPlayer.finish(winner contains Black),
|
||||
clock = clock map (_.stop),
|
||||
clockHistory = for {
|
||||
clk <- clock
|
||||
history <- clockHistory
|
||||
} yield {
|
||||
// If not already finished, we're ending due to an event
|
||||
// in the middle of a turn, such as resignation or draw
|
||||
// acceptance. In these cases, record a final clock time
|
||||
// for the active color. This ensures the end time in
|
||||
// clockHistory always matches the final clock time on
|
||||
// the board.
|
||||
if (!finished) history.record(turnColor, clk)
|
||||
else history
|
||||
}
|
||||
),
|
||||
List(Event.End(winner)) ::: clock.??(c => List(Event.Clock(c)))
|
||||
)
|
||||
def finish(status: Status, winner: Option[Color]) = {
|
||||
val newClock = clock map { _.stop }
|
||||
Progress(
|
||||
this,
|
||||
copy(
|
||||
status = status,
|
||||
whitePlayer = whitePlayer.finish(winner contains White),
|
||||
blackPlayer = blackPlayer.finish(winner contains Black),
|
||||
clock = newClock,
|
||||
clockHistory = for {
|
||||
clk <- clock
|
||||
history <- clockHistory
|
||||
} yield {
|
||||
// If not already finished, we're ending due to an event
|
||||
// in the middle of a turn, such as resignation or draw
|
||||
// acceptance. In these cases, record a final clock time
|
||||
// for the active color. This ensures the end time in
|
||||
// clockHistory always matches the final clock time on
|
||||
// the board.
|
||||
if (!finished) history.record(turnColor, clk)
|
||||
else history
|
||||
}
|
||||
),
|
||||
// Events here for BC.
|
||||
List(Event.End(winner)) ::: newClock.??(c => List(Event.Clock(c)))
|
||||
)
|
||||
}
|
||||
|
||||
def rated = mode.rated
|
||||
def casual = !rated
|
||||
|
|
|
@ -53,9 +53,6 @@ object Rewind {
|
|||
clock = newClock,
|
||||
movedAt = DateTime.now
|
||||
)
|
||||
Progress(game, newGame, List(
|
||||
newGame.clock.map(Event.Clock.apply),
|
||||
newGame.playableCorrespondenceClock.map(Event.CorrespondenceClock.apply)
|
||||
).flatten)
|
||||
Progress(game, newGame)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -225,7 +225,10 @@ private[round] final class Round(
|
|||
messenger.system(game, (_.untranslated(
|
||||
"%s + %d seconds".format(color, duration.toSeconds)
|
||||
)))
|
||||
(game withClock newClock) ++ List(Event.ClockInc(color, centis), Event.Clock(newClock))
|
||||
(game withClock newClock) ++ List(
|
||||
Event.ClockInc(color, centis),
|
||||
Event.Clock(newClock) // BC
|
||||
)
|
||||
}
|
||||
|
||||
private def reportNetworkLag(pov: Pov) =
|
||||
|
|
|
@ -455,6 +455,7 @@ export default class RoundController {
|
|||
this.moveOn.next();
|
||||
this.setQuietMode();
|
||||
this.setLoading(false);
|
||||
if (this.clock) this.clock.setClock(d, d.clock!.white, d.clock!.black);
|
||||
this.redraw();
|
||||
this.autoScroll();
|
||||
this.onChange();
|
||||
|
|
Loading…
Reference in New Issue