Changeset - r24542:d3a3a9454adc
[Not reviewed]
master
0 1 0
SamuXarick - 4 years ago 2020-12-31 16:06:48
43006711+SamuXarick@users.noreply.github.com
Change #8325: Make engine reliability independent of introduction date (#8470)
1 file changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/engine.cpp
Show inline comments
 
@@ -652,37 +652,38 @@ void StartupOneEngine(Engine *e, Date ag
 
	              ei->base_intro ^
 
	              e->type ^
 
	              e->GetGRFID());
 
	uint32 r = Random();
 

	
 
	e->intro_date = ei->base_intro <= ConvertYMDToDate(_settings_game.game_creation.starting_year + 2, 0, 1) ? ei->base_intro : (Date)GB(r, 0, 9) + ei->base_intro;
 
	if (e->intro_date <= _date) {
 
		e->age = (aging_date - e->intro_date) >> 5;
 
		e->company_avail = (CompanyMask)-1;
 
		e->flags |= ENGINE_AVAILABLE;
 
	}
 

	
 
	RestoreRandomSeeds(saved_seeds);
 

	
 
	e->reliability_start = GB(r, 16, 14) + 0x7AE0;
 
	r = Random();
 
	e->reliability_max   = GB(r,  0, 14) + 0xBFFF;
 
	e->reliability_final = GB(r, 16, 14) + 0x3FFF;
 

	
 
	r = Random();
 
	e->duration_phase_1 = GB(r, 0, 5) + 7;
 
	e->duration_phase_2 = GB(r, 5, 4) + ei->base_life * 12 - 96;
 
	e->duration_phase_3 = GB(r, 9, 7) + 120;
 

	
 
	e->reliability_spd_dec = ei->decay_speed << 2;
 

	
 
	RestoreRandomSeeds(saved_seeds);
 
	CalcEngineReliability(e);
 

	
 
	/* prevent certain engines from ever appearing. */
 
	if (!HasBit(ei->climates, _settings_game.game_creation.landscape)) {
 
		e->flags |= ENGINE_AVAILABLE;
 
		e->company_avail = 0;
 
	}
 
}
 

	
 
/**
 
 * Start/initialise all our engines. Must be called whenever there are changes
 
 * to the NewGRF config.
0 comments (0 inline, 0 general)