MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / getMonthTotalDay

Function getMonthTotalDay

src/OpenLoco/src/Date.cpp:529–547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

527 }
528
529 uint8_t getMonthTotalDay(uint16_t year, MonthId month)
530 {
531 static constexpr std::pair<MonthId, uint8_t> month_table[] = {
532 { MonthId::january, 31 },
533 { MonthId::february, 28 },
534 { MonthId::march, 31 },
535 { MonthId::april, 30 },
536 { MonthId::may, 31 },
537 { MonthId::june, 30 },
538 { MonthId::july, 31 },
539 { MonthId::august, 31 },
540 { MonthId::september, 30 },
541 { MonthId::october, 31 },
542 { MonthId::november, 30 },
543 { MonthId::december, 31 },
544 };
545 bool extraDay = month == MonthId::february && isLeapYear(year);
546 return month_table[(uint8_t)month].second + extraDay;
547 }
548}

Callers 3

calcDaysFunction · 0.85
clampDayToMonthFunction · 0.85
onMouseDownFunction · 0.85

Calls 1

isLeapYearFunction · 0.85

Tested by

no test coverage detected