src/newgrf.cpp
changeset 11038 d253e0dfa688
parent 11020 e5f91b9e33f8
child 11117 cb9c1d913f92
--- a/src/newgrf.cpp	Fri Jun 20 20:40:47 2008 +0000
+++ b/src/newgrf.cpp	Fri Jun 20 21:14:10 2008 +0000
@@ -3566,9 +3566,13 @@
 			*value = Clamp(_cur_year, ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR;
 			return true;
 
-		case 0x02: // current month
-			*value = _cur_month;
+		case 0x02: { // detailed date information: month of year (bit 0-7), day of month (bit 8-12), leap year (bit 15), day of year (bit 16-24)
+			YearMonthDay ymd;
+			ConvertDateToYMD(_date, &ymd);
+			Date start_of_year = ConvertYMDToDate(ymd.year, 0, 1);
+			*value = ymd.month | (ymd.day - 1) << 8 | (IsLeapYear(ymd.year) ? 1 << 15 : 0) | (_date - start_of_year) << 16;
 			return true;
+		}
 
 		case 0x03: // current climate, 0=temp, 1=arctic, 2=trop, 3=toyland
 			*value = _settings_game.game_creation.landscape;