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

Function updateDaily

src/OpenLoco/src/World/StationManager.cpp:89–126  ·  view source on GitHub ↗

0x0048B244

Source from the content-addressed store, hash-verified

87
88 // 0x0048B244
89 void updateDaily()
90 {
91 for (auto& town : TownManager::towns())
92 {
93 town.flags &= ~TownFlags::ratingAdjusted;
94 }
95
96 for (auto& station : stations())
97 {
98 if (station.stationTileSize == 0)
99 {
100 station.noTilesTimeout++;
101 if (station.noTilesTimeout == 5 && CompanyManager::isPlayerCompany(station.owner))
102 {
103 companyEmotionEvent(station.owner, Emotion::disgusted);
104 }
105 if (station.noTilesTimeout >= 10)
106 {
107 Ui::Windows::Construction::Station::sub_49E1F1(station.id());
108 station.invalidate();
109 deallocateStation(station.id());
110 }
111 }
112 else
113 {
114 station.noTilesTimeout = 0;
115 }
116 if (station.updateCargo())
117 {
118 auto town = TownManager::get(station.town);
119 if (town != nullptr && (town->flags & TownFlags::ratingAdjusted) == TownFlags::none)
120 {
121 town->flags |= TownFlags::ratingAdjusted;
122 town->adjustCompanyRating(station.owner, 1);
123 }
124 }
125 }
126 }
127
128 // 0x048F988
129 StringId generateNewStationName(StationId stationId, TownId townId, World::Pos3 position, uint8_t mode)

Callers

nothing calls this directly

Calls 11

townsFunction · 0.85
stationsFunction · 0.85
isPlayerCompanyFunction · 0.85
companyEmotionEventFunction · 0.85
sub_49E1F1Function · 0.85
deallocateStationFunction · 0.85
updateCargoMethod · 0.80
adjustCompanyRatingMethod · 0.80
getFunction · 0.70
idMethod · 0.45
invalidateMethod · 0.45

Tested by

no test coverage detected