src/newgrf.cpp
changeset 9570 8b9c1cbb0077
parent 9556 0cfc541c4d38
child 9619 9cf5022932aa
equal deleted inserted replaced
9569:7697ab949b12 9570:8b9c1cbb0077
  3564 
  3564 
  3565 		case 0x01: // current year
  3565 		case 0x01: // current year
  3566 			*value = Clamp(_cur_year, ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR;
  3566 			*value = Clamp(_cur_year, ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR;
  3567 			return true;
  3567 			return true;
  3568 
  3568 
  3569 		case 0x02: // current month
  3569 		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)
  3570 			*value = _cur_month;
  3570 			YearMonthDay ymd;
       
  3571 			ConvertDateToYMD(_date, &ymd);
       
  3572 			Date start_of_year = ConvertYMDToDate(ymd.year, 0, 1);
       
  3573 			*value = ymd.month | (ymd.day - 1) << 8 | (IsLeapYear(ymd.year) ? 1 << 15 : 0) | (_date - start_of_year) << 16;
  3571 			return true;
  3574 			return true;
       
  3575 		}
  3572 
  3576 
  3573 		case 0x03: // current climate, 0=temp, 1=arctic, 2=trop, 3=toyland
  3577 		case 0x03: // current climate, 0=temp, 1=arctic, 2=trop, 3=toyland
  3574 			*value = _settings_game.game_creation.landscape;
  3578 			*value = _settings_game.game_creation.landscape;
  3575 			return true;
  3579 			return true;
  3576 
  3580