Fix: reduce framerate overhead on train ticks

Tick() is a noop for all but front-engine / crashed vehicles. Starting a framerate is rather cheap, but not free, and introduces a lot of overhead for such close loops.
pull/444/head
Bouke Haarsma 2 years ago committed by Michael Lutz
parent f4e2a462fe
commit bda602f4b0

@ -3910,11 +3910,11 @@ Money Train::GetRunningCost() const
*/
bool Train::Tick()
{
PerformanceAccumulator framerate(PFE_GL_TRAINS);
this->tick_counter++;
if (this->IsFrontEngine()) {
PerformanceAccumulator framerate(PFE_GL_TRAINS);
if (!(this->vehstatus & VS_STOPPED) || this->cur_speed > 0) this->running_ticks++;
this->current_order_time++;

Loading…
Cancel
Save