engine.c
changeset 2875 8d939bcf7784
parent 2862 d4a82eb6f913
child 2951 2de6d3a59743
equal deleted inserted replaced
2874:3dcc067a7946 2875:8d939bcf7784
   207 		e->age = 0;
   207 		e->age = 0;
   208 		e->railtype = ei->railtype;
   208 		e->railtype = ei->railtype;
   209 		e->flags = 0;
   209 		e->flags = 0;
   210 		e->player_avail = 0;
   210 		e->player_avail = 0;
   211 
   211 
       
   212 		// The magic value of 729 days below comes from the NewGRF spec. If the
       
   213 		// base intro date is before 1922 then the random number of days is not
       
   214 		// added.
   212 		r = Random();
   215 		r = Random();
   213 		e->intro_date = ei->base_intro == 0 ? 0 : GB(r, 0, 9) + ei->base_intro;
   216 		e->intro_date = ei->base_intro <= 729 ? ei->base_intro : GB(r, 0, 9) + ei->base_intro;
   214 		if (e->intro_date <= _date) {
   217 		if (e->intro_date <= _date) {
   215 			e->age = (_date - e->intro_date) >> 5;
   218 			e->age = (_date - e->intro_date) >> 5;
   216 			e->player_avail = (byte)-1;
   219 			e->player_avail = (byte)-1;
   217 			e->flags |= ENGINE_AVAILABLE;
   220 			e->flags |= ENGINE_AVAILABLE;
   218 		}
   221 		}