public void replaceBid(Bid oldBid, Bid bid) {
    if (getGameID() < 0) {
      throw new IllegalStateException("No game playing");
    }
    int auction = bid.getAuction();
    int oldAuction = oldBid.getAuction();
    if (oldBid.isPreliminary()) {
      throw new IllegalStateException("Old bid is still preliminary");
    }
    if (auction != oldAuction) {
      throw new IllegalArgumentException("Bids do not have same AuctionID");
    }
    bid.submitted();
    if (oldBid != bids[auction]) {
      bid.setRejectReason(Bid.ACTIVE_BID_CHANGED);
      bid.setProcessingState(Bid.REJECTED);
      try {
	agent.bidRejected(bid);
      } catch (Exception e) {
	log.log(Level.SEVERE, "agent could not handle bidRejected", e);
      }
    } else {
      TACMessage msg = new TACMessage("replaceBid");
      msg.setParameter("bidID", oldBid.getID());
      msg.setParameter("bidHash", oldBid.getBidHash());

      prepareBidMsg(msg, bid);
      updateBid(bid);
      sendMessage(msg, this);
    }
  }