Changeset - r26433:7064d8b8a1a8
[Not reviewed]
master
0 1 0
Bouke Haarsma - 2 years ago 2022-09-27 15:34:55
bouke@haarsma.eu
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.
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/train_cmd.cpp
Show inline comments
 
@@ -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++;
0 comments (0 inline, 0 general)