(svn r5934) -Cleanup: forgot some conversions to Year and to Date
-Cleanup: use _cur_year instead of _date for some (year based) comparisons -Cleanup: remove a magic number in favour of another (less) magic number
This commit is contained in:
		| @@ -79,7 +79,7 @@ uint GetMaskOfAllowedCurrencies(void) | ||||
| 	uint i; | ||||
|  | ||||
| 	for (i = 0; i != lengthof(_currency_specs); i++) { | ||||
| 		uint16 to_euro = _currency_specs[i].to_euro; | ||||
| 		Year to_euro = _currency_specs[i].to_euro; | ||||
|  | ||||
| 		if (to_euro != CF_NOEURO && to_euro != CF_ISEURO && _cur_year >= to_euro) continue; | ||||
| 		if (to_euro == CF_ISEURO && _cur_year < 2000) continue; | ||||
|   | ||||
| @@ -11,7 +11,7 @@ enum { | ||||
| typedef struct { | ||||
| 	uint16 rate; | ||||
| 	char separator; | ||||
| 	uint16 to_euro; | ||||
| 	Year to_euro; | ||||
| 	char prefix[16]; | ||||
| 	char suffix[16]; | ||||
| } CurrencySpec; | ||||
|   | ||||
							
								
								
									
										2
									
								
								depot.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								depot.h
									
									
									
									
									
								
							| @@ -53,7 +53,7 @@ static inline bool IsDepotIndex(uint index) | ||||
|  * within the given bounds. @see MIN_SERVINT_PERCENT ,etc. | ||||
|  * @param index proposed service interval | ||||
|  */ | ||||
| static inline uint16 GetServiceIntervalClamped(uint index) | ||||
| static inline Date GetServiceIntervalClamped(uint index) | ||||
| { | ||||
| 	return (_patches.servint_ispercent) ? clamp(index, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : clamp(index, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS); | ||||
| } | ||||
|   | ||||
							
								
								
									
										9
									
								
								engine.c
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								engine.c
									
									
									
									
									
								
							| @@ -88,11 +88,10 @@ static void SetupEngineNames(void) | ||||
|  | ||||
| static void AdjustAvailAircraft(void) | ||||
| { | ||||
| 	uint16 date = _date; | ||||
| 	byte avail = 0; | ||||
| 	if (date >= 12784) avail |= 2; // big airport | ||||
| 	if (date < 14610 || _patches.always_small_airport) avail |= 1;  // small airport | ||||
| 	if (date >= 15706) avail |= 4; // enable heliport | ||||
| 	if (_cur_year >= 1955) avail |= 2; // big airport | ||||
| 	if (_cur_year <  1960 || _patches.always_small_airport) avail |= 1;  // small airport | ||||
| 	if (_cur_year >= 1963) avail |= 4; // enable heliport | ||||
|  | ||||
| 	if (avail != _avail_aircraft) { | ||||
| 		_avail_aircraft = avail; | ||||
| @@ -151,7 +150,7 @@ void StartupEngines(void) | ||||
| 		// base intro date is before 1922 then the random number of days is not | ||||
| 		// added. | ||||
| 		r = Random(); | ||||
| 		e->intro_date = ei->base_intro <= 729 ? ei->base_intro : GB(r, 0, 9) + ei->base_intro; | ||||
| 		e->intro_date = ei->base_intro <= ConvertYMDToDate(1922, 0, 1) ? ei->base_intro : (Date)GB(r, 0, 9) + ei->base_intro; | ||||
| 		if (e->intro_date <= _date) { | ||||
| 			e->age = (_date - e->intro_date) >> 5; | ||||
| 			e->player_avail = (byte)-1; | ||||
|   | ||||
| @@ -1647,8 +1647,8 @@ static void MaybeNewIndustry(uint32 r) | ||||
|  | ||||
| 	type = _new_industry_rand[_opt.landscape][GB(r, 16, 5)]; | ||||
|  | ||||
| 	if (type == IT_OIL_WELL && _date > 10958) return; | ||||
| 	if (type == IT_OIL_RIG  && _date < 14610) return; | ||||
| 	if (type == IT_OIL_WELL && _cur_year > 1950) return; | ||||
| 	if (type == IT_OIL_RIG  && _cur_year < 1960) return; | ||||
|  | ||||
| 	j = 2000; | ||||
| 	for (;;) { | ||||
|   | ||||
							
								
								
									
										4
									
								
								newgrf.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								newgrf.c
									
									
									
									
									
								
							| @@ -1060,10 +1060,6 @@ static bool BridgeChangeInfo(uint brid, int numinfo, int prop, byte **bufp, int | ||||
| 			FOR_EACH_OBJECT _bridge[brid + i].flags = grf_load_byte(&buf); | ||||
| 			break; | ||||
|  | ||||
| 		case 0x0F: /* Long year -- must be set after property 8 */ | ||||
| 			FOR_EACH_OBJECT _bridge[brid + i].avail_year = grf_load_word(&buf); | ||||
| 			break; | ||||
|  | ||||
| 		default: | ||||
| 			ret = true; | ||||
| 	} | ||||
|   | ||||
| @@ -267,7 +267,7 @@ typedef uint AcceptedCargo[NUM_CARGO]; | ||||
| typedef struct TileDesc { | ||||
| 	StringID str; | ||||
| 	byte owner; | ||||
| 	uint16 build_date; | ||||
| 	Date build_date; | ||||
| 	uint32 dparam[2]; | ||||
| } TileDesc; | ||||
|  | ||||
|   | ||||
| @@ -148,11 +148,11 @@ protected: | ||||
| 	FORCEINLINE static Cache& stGetGlobalCache() | ||||
| 	{ | ||||
| 		static int last_rail_change_counter = 0; | ||||
| 		static uint32 last_day = 0; | ||||
| 		static Date last_date = 0; | ||||
|  | ||||
| 		// some statistics | ||||
| 		if (last_day != _date) { | ||||
| 			last_day = _date; | ||||
| 		if (last_date != _date) { | ||||
| 			last_date = _date; | ||||
| 			DEBUG(yapf, 1)("pf time today:%5d ms\n", _total_pf_time_us / 1000); | ||||
| 			_total_pf_time_us = 0; | ||||
| 		} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user