From 29b4ab04c319f6b88e724ff79d73ca49f5676eaa Mon Sep 17 00:00:00 2001 From: darkvater Date: Mon, 10 Jan 2005 14:43:00 +0000 Subject: (svn r1465) -Fix: [1099101] starting year patch goes out of range. Clamped year between 1920-2090 as wel as adding defines for it. --- misc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'misc.c') diff --git a/misc.c b/misc.c index 8e779bcb2..578b9b426 100644 --- a/misc.c +++ b/misc.c @@ -443,7 +443,7 @@ uint ConvertYMDToDay(uint year, uint month, uint day) } // convert a date on the form -// 1920 - 2090 +// 1920 - 2090 (MAX_YEAR_END_REAL) // 192001 - 209012 // 19200101 - 20901231 // or if > 2090 and below 65536, treat it as a daycount @@ -452,7 +452,7 @@ uint ConvertIntDate(uint date) { uint year, month = 0, day = 1; - if (IS_INT_INSIDE(date, 1920, 2090 + 1)) { + if (IS_INT_INSIDE(date, 1920, MAX_YEAR_END_REAL + 1)) { year = date - 1920; } else if (IS_INT_INSIDE(date, 192001, 209012+1)) { month = date % 100 - 1; @@ -700,10 +700,10 @@ void IncreaseDate() NetworkServerYearlyLoop(); #endif /* ENABLE_NETWORK */ - /* check if we reached 2090, that's the maximum year. */ - if (_cur_year == 171) { + /* check if we reached 2090 (MAX_YEAR_END_REAL), that's the maximum year. */ + if (_cur_year == (MAX_YEAR_END + 1)) { Vehicle *v; - _cur_year = 170; + _cur_year = MAX_YEAR_END; _date = 62093; FOR_ALL_VEHICLES(v) { v->date_of_last_service -= 365; // 1 year is 365 days long -- cgit v1.2.3-54-g00ecf