# HG changeset patch # User rubidium # Date 1155846155 0 # Node ID 47ce9665b4afc679d20df36e2760f55c11b6f3ef # Parent efa8587bccfc0fb60521df2e895d1fc30ee538c0 (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 diff -r efa8587bccfc -r 47ce9665b4af currency.c --- a/currency.c Wed Aug 16 17:58:43 2006 +0000 +++ b/currency.c Thu Aug 17 20:22:35 2006 +0000 @@ -79,7 +79,7 @@ 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; diff -r efa8587bccfc -r 47ce9665b4af currency.h --- a/currency.h Wed Aug 16 17:58:43 2006 +0000 +++ b/currency.h Thu Aug 17 20:22:35 2006 +0000 @@ -11,7 +11,7 @@ typedef struct { uint16 rate; char separator; - uint16 to_euro; + Year to_euro; char prefix[16]; char suffix[16]; } CurrencySpec; diff -r efa8587bccfc -r 47ce9665b4af depot.h --- a/depot.h Wed Aug 16 17:58:43 2006 +0000 +++ b/depot.h Thu Aug 17 20:22:35 2006 +0000 @@ -53,7 +53,7 @@ * 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); } diff -r efa8587bccfc -r 47ce9665b4af engine.c --- a/engine.c Wed Aug 16 17:58:43 2006 +0000 +++ b/engine.c Thu Aug 17 20:22:35 2006 +0000 @@ -88,11 +88,10 @@ 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 @@ // 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; diff -r efa8587bccfc -r 47ce9665b4af industry_cmd.c --- a/industry_cmd.c Wed Aug 16 17:58:43 2006 +0000 +++ b/industry_cmd.c Thu Aug 17 20:22:35 2006 +0000 @@ -1647,8 +1647,8 @@ 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 (;;) { diff -r efa8587bccfc -r 47ce9665b4af newgrf.c --- a/newgrf.c Wed Aug 16 17:58:43 2006 +0000 +++ b/newgrf.c Thu Aug 17 20:22:35 2006 +0000 @@ -1060,10 +1060,6 @@ 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; } diff -r efa8587bccfc -r 47ce9665b4af openttd.h --- a/openttd.h Wed Aug 16 17:58:43 2006 +0000 +++ b/openttd.h Thu Aug 17 20:22:35 2006 +0000 @@ -267,7 +267,7 @@ typedef struct TileDesc { StringID str; byte owner; - uint16 build_date; + Date build_date; uint32 dparam[2]; } TileDesc; diff -r efa8587bccfc -r 47ce9665b4af yapf/yapf_costcache.hpp --- a/yapf/yapf_costcache.hpp Wed Aug 16 17:58:43 2006 +0000 +++ b/yapf/yapf_costcache.hpp Thu Aug 17 20:22:35 2006 +0000 @@ -148,11 +148,11 @@ 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; }