summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2005-01-10 14:43:00 +0000
committerdarkvater <darkvater@openttd.org>2005-01-10 14:43:00 +0000
commit29b4ab04c319f6b88e724ff79d73ca49f5676eaa (patch)
treee114f254bcb59432fd9b8e483ca4ef7c4ef8ec89 /misc.c
parentfae367ab31433c0987a2e042fb7cea40952d5ff0 (diff)
downloadopenttd-29b4ab04c319f6b88e724ff79d73ca49f5676eaa.tar.xz
(svn r1465) -Fix: [1099101] starting year patch goes out of range. Clamped year between 1920-2090 as wel as adding defines for it.
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c10
1 files changed, 5 insertions, 5 deletions
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