summaryrefslogtreecommitdiff
path: root/src/engine.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2021-01-03 15:05:34 +0100
committerCharles Pigott <charlespigott@googlemail.com>2021-01-03 14:56:43 +0000
commitd24a9a9df5502735bf607f2dda3ed99d9d0e7859 (patch)
tree71f5fe5bd7369000e1624855f66e1890b2ee688d /src/engine.cpp
parent21a45168bda49331a74d4dfc3147757afcd20b13 (diff)
downloadopenttd-d24a9a9df5502735bf607f2dda3ed99d9d0e7859.tar.xz
Cleanup 8139b14: Move a comment back to the line it belongs to, and add a comment for new code.
Diffstat (limited to 'src/engine.cpp')
-rw-r--r--src/engine.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index f4737cf59..575995f86 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -643,9 +643,8 @@ void StartupOneEngine(Engine *e, Date aging_date)
e->company_avail = 0;
e->company_hidden = 0;
- /* Don't randomise the start-date in the first two years after gamestart to ensure availability
- * of engines in early starting games.
- * Note: TTDP uses fixed 1922 */
+ /* Vehicles with the same base_intro date shall be introduced at the same time.
+ * Make sure they use the same randomisation of the date. */
SavedRandomSeeds saved_seeds;
SaveRandomSeeds(&saved_seeds);
SetRandomSeed(_settings_game.game_creation.generation_seed ^
@@ -654,6 +653,9 @@ void StartupOneEngine(Engine *e, Date aging_date)
e->GetGRFID());
uint32 r = Random();
+ /* Don't randomise the start-date in the first two years after gamestart to ensure availability
+ * of engines in early starting games.
+ * Note: TTDP uses fixed 1922 */
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;