public override void HandleBidDone(Seats source, Bid bid) { this.host.ThinkTime[source.Direction()].Stop(); #if syncTrace Log.Trace(4, "HostBoardResult.HandleBidDone"); #endif if (this.BidMayBeAlerted(bid)) { //if (!bid.Alert || string.IsNullOrWhiteSpace(bid.Explanation)) { #if syncTrace Log.Trace(2, "HostBoardResult.HandleBidDone explain opponents bid"); #endif this.host.ExplainBid(source, bid); if (bid.Alert //&& string.IsNullOrWhiteSpace(bid.Explanation) ) { // the operator has indicated this bid needs an explanation Log.Trace(2, "HostBoardResult.HandleBidDone host operator wants an alert"); if (this.host.clients[source].CanAskForExplanation) { // client implements this new part of the protocol var answer = this.host.clients[source.Next()].WriteAndWait("Explain {0}'s {1}", source, ProtocolHelper.Translate(bid)); bid.Explanation = answer; } } else { Log.Trace(2, "HostBoardResult.HandleBidDone host operator does not want an alert"); } } } base.HandleBidDone(source, bid); for (Seats s = Seats.North; s <= Seats.West; s++) { this.host.clients[s].state = TableManagerProtocolState.WaitForMyCards; if (s != source) { if (bid.Alert && s.IsSameDirection(source)) { // remove alert info for his partner var unalerted = new Bid(bid.Index, "", false, ""); this.host.clients[s].WriteData(ProtocolHelper.Translate(unalerted, source)); } else { this.host.clients[s].WriteData(ProtocolHelper.Translate(bid, source)); } } } lock (this.host.clients) for (Seats s = Seats.North; s <= Seats.West; s++) { this.host.clients[s].Pause = this.Auction.Ended; } }
public override void HandleBidDone(Seats source, Bid bid) { //Log.Trace("BoardResultEventPublisher.HandleBidDone: {0} bids {1}", source, bid); if (this.currentTournament != null && !this.currentTournament.AllowOvercalls && this.Auction.Opened && !source.IsSameDirection(this.Auction.Opener) && !bid.IsPass) { Log.Trace(1, "TournamentController overcall in bid contest: change to pass"); bid.SetPass(); bid.Explanation = ""; bid.HumanExplanation = ""; } base.HandleBidDone(source, bid); if (this.Auction.Ended) { //Log.Trace("BoardResultEventPublisher.HandleBidDone: auction finished"); if (this.Contract.Bid.IsRegular && !(this.currentTournament != null && this.currentTournament.BidContest) ) { this.EventBus.HandleAuctionFinished(this.Auction.Declarer, this.Play.Contract); this.NeedCard(); } else { //Log.Trace("BoardResultEventPublisher.HandleBidDone: all passed"); this.EventBus.HandlePlayFinished(this); } } else { //Log.Trace("BoardResultEventPublisher.HandleBidDone: next bid needed from {0}", this.Auction.WhoseTurn); this.EventBus.HandleBidNeeded(this.Auction.WhoseTurn, this.Auction.LastRegularBid, this.Auction.AllowDouble, this.Auction.AllowRedouble); } }