summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-01-24 07:41:28 +0000
committerpeter1138 <peter1138@openttd.org>2006-01-24 07:41:28 +0000
commit098300cc7dbff4e57c4d7fc916be3b4d7e174bd3 (patch)
tree2b934c8ba92018ee6376674d99e6099b96baa2f8
parent0f28e74e3ea0fd5b3bd937dd09466d05eeace213 (diff)
downloadopenttd-098300cc7dbff4e57c4d7fc916be3b4d7e174bd3.tar.xz
(svn r3423) - NewGRF: Update the base_intro age at which an engine will have a randomized intro date, as per (the now updated) spec.
-rw-r--r--engine.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/engine.c b/engine.c
index b845934a7..ef916d5c7 100644
--- a/engine.c
+++ b/engine.c
@@ -209,8 +209,11 @@ void StartupEngines(void)
e->flags = 0;
e->player_avail = 0;
+ // The magic value of 729 days below comes from the NewGRF spec. If the
+ // base intro date is before 1922 then the random number of days is not
+ // added.
r = Random();
- e->intro_date = ei->base_intro == 0 ? 0 : GB(r, 0, 9) + ei->base_intro;
+ e->intro_date = ei->base_intro <= 729 ? ei->base_intro : GB(r, 0, 9) + ei->base_intro;
if (e->intro_date <= _date) {
e->age = (_date - e->intro_date) >> 5;
e->player_avail = (byte)-1;