Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ofWhichRound"></param>
        private void NotifyClientAboutLeavingGuests(SimulationRound ofWhichRound)
        {
            if (!this.initialized)
            {
                throw new DssException("DssSimulationMgr is uninitialized!");
            }

            int[] leavingGuests = ofWhichRound.LeavingGuests;
            for (int i = 0; i < leavingGuests.Length; i++)
            {
                this.root.SimulatorIface.GuestLeftDssDuringSim(leavingGuests[i] - 1);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Jumps to the first frame of the next round.
        /// </summary>
        /// <remarks>
        /// Call this function only if the next round has been committed, and the current round has been finished.
        /// </remarks>
        private void SwapRounds()
        {
            if (!this.initialized)
            {
                throw new DssException("DssSimulationMgr is uninitialized!");
            }
            if (this.currentRound.StepNextFrame())
            {
                throw new DssException("DssSimulationMgr.SwapRounds() denied!");
            }
            if (!this.nextRound.IsCommitted)
            {
                throw new DssException("DssSimulationMgr.SwapRounds() denied!");
            }

            StopCommitTimeoutClock();
            this.commitTimeoutClock = this.root.AlarmClkMgr.SetAlarmClock(DssRoot.Time + DssConstants.COMMIT_TIMEOUT,
                                                                          this.CommitTimeout);

            SimulationRound tmpRound = this.currentRound;

            this.currentRound = this.nextRound;
            this.currentRound.ComputeSpeedControl();
            this.nextRound         = this.nextNextRound;
            this.nextNextRound     = this.nextNextNextRound;
            this.nextNextNextRound = tmpRound;
            this.nextNextNextRound.Reset(false, this.nextNextRound.RoundIndex + 1);

            TraceManager.WriteAllTrace(string.Format("DssSimulationMgr.SwapRounds: {0}-{1}-{2}-{3}",
                                                     this.currentRound.RoundIndex,
                                                     this.nextRound.RoundIndex,
                                                     this.nextNextRound.RoundIndex,
                                                     this.nextNextNextRound.RoundIndex),
                                       DssTraceFilters.SIMULATION_INFO);

            /// Indicate the registered operator leave events to the ISimulator interface of the client module
            NotifyClientAboutLeavingGuests(this.currentRound);
        }