Clamped simulation time to +/- 2 billion years.

pull/3/head
Vincent Giangiulio 2008-01-07 20:25:24 +00:00
parent d139c17d81
commit 2f3a2aeaf3
1 changed files with 8 additions and 0 deletions

View File

@ -12,6 +12,9 @@
#include "observer.h"
#include "simulation.h"
static const double maximumSimTime = 730486721060.00073; // 2000000000 Jan 01 12:00:00 UTC
static const double minimumSimTime = -730498278941.99951; // -2000000000 Jan 01 12:00:00 UTC
using namespace std;
@ -238,6 +241,11 @@ void Observer::update(double dt, double timeScale)
realTime += dt;
simTime += (dt / 86400.0) * timeScale;
if (simTime >= maximumSimTime)
simTime = maximumSimTime;
if (simTime <= minimumSimTime)
simTime = minimumSimTime;
if (observerMode == Travelling)
{
// Compute the fraction of the trip that has elapsed; handle zero