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

Function dateTick

src/OpenLoco/src/OpenLoco.cpp:576–634  ·  view source on GitHub ↗

0x004968C7

Source from the content-addressed store, hash-verified

574
575 // 0x004968C7
576 static void dateTick()
577 {
578 if (Game::hasFlags(GameStateFlags::tileManagerLoaded) && !SceneManager::isEditorMode())
579 {
580 if (updateDayCounter())
581 {
582 StationManager::updateDaily();
583 VehicleManager::updateDaily();
584 IndustryManager::updateDaily();
585 MessageManager::updateDaily();
586 WindowManager::updateDaily();
587
588 auto yesterday = calcDate(getCurrentDay() - 1);
589 auto today = calcDate(getCurrentDay());
590 setDate(today);
591 Scenario::updateSnowLine(today.dayOfYear);
592 Ui::Windows::TimePanel::invalidateFrame();
593
594 if (today.month != yesterday.month)
595 {
596 // End of every month
597 Scenario::getObjectiveProgress().monthsInChallenge++;
598 TownManager::updateMonthly();
599 IndustryManager::updateMonthly();
600 CompanyManager::updateMonthly1();
601 CompanyManager::updateMonthlyHeadquarters();
602 VehicleManager::updateMonthly();
603
604 if (today.year <= 2029)
605 {
606 Economy::updateMonthly();
607 }
608
609 // clang-format off
610 if (today.month == MonthId::january ||
611 today.month == MonthId::april ||
612 today.month == MonthId::july ||
613 today.month == MonthId::october)
614 // clang-format on
615 {
616 CompanyManager::updateQuarterly();
617 }
618
619 if (today.year != yesterday.year)
620 {
621 // End of every year
622 CompanyManager::updateYearly();
623 ObjectManager::updateDefaultLevelCrossingType();
624 ObjectManager::updateYearly2();
625 World::TileManager::updateYearly();
626 }
627
628 autosaveCheck();
629 }
630
631 CompanyManager::updateDaily();
632 }
633 }

Callers 1

tickLogicFunction · 0.85

Calls 15

isEditorModeFunction · 0.85
updateDayCounterFunction · 0.85
calcDateFunction · 0.85
getCurrentDayFunction · 0.85
setDateFunction · 0.85
updateSnowLineFunction · 0.85
updateMonthly1Function · 0.85
updateQuarterlyFunction · 0.85
updateYearly2Function · 0.85
autosaveCheckFunction · 0.85

Tested by

no test coverage detected