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.
This commit is contained in:

committed by
Michael Lutz

parent
f4e2a462fe
commit
bda602f4b0
@@ -3910,11 +3910,11 @@ Money Train::GetRunningCost() const
|
|||||||
*/
|
*/
|
||||||
bool Train::Tick()
|
bool Train::Tick()
|
||||||
{
|
{
|
||||||
PerformanceAccumulator framerate(PFE_GL_TRAINS);
|
|
||||||
|
|
||||||
this->tick_counter++;
|
this->tick_counter++;
|
||||||
|
|
||||||
if (this->IsFrontEngine()) {
|
if (this->IsFrontEngine()) {
|
||||||
|
PerformanceAccumulator framerate(PFE_GL_TRAINS);
|
||||||
|
|
||||||
if (!(this->vehstatus & VS_STOPPED) || this->cur_speed > 0) this->running_ticks++;
|
if (!(this->vehstatus & VS_STOPPED) || this->cur_speed > 0) this->running_ticks++;
|
||||||
|
|
||||||
this->current_order_time++;
|
this->current_order_time++;
|
||||||
|
Reference in New Issue
Block a user