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

Function update

src/OpenLoco/src/World/CompanyManager.cpp:223–247  ·  view source on GitHub ↗

0x00430319

Source from the content-addressed store, hash-verified

221
222 // 0x00430319
223 void update()
224 {
225 if (!SceneManager::isEditorMode() && !Config::get().companyAIDisabled)
226 {
227 CompanyId id = CompanyId(ScenarioManager::getScenarioTicks() & 0x0F);
228 auto company = get(id);
229 if (company != nullptr && !isPlayerCompany(id) && !company->empty())
230 {
231 // Only the host should update AI, AI will run game commands
232 // which will be sent to all the clients
233 if (!SceneManager::isNetworked() || SceneManager::isNetworkHost())
234 {
235 GameCommands::setUpdatingCompanyId(id);
236 aiThink(id);
237 }
238 }
239
240 getGameState().produceAICompanyTimeout++;
241 if (getGameState().produceAICompanyTimeout >= 192)
242 {
243 getGameState().produceAICompanyTimeout = 0;
244 produceCompanies();
245 }
246 }
247 }
248
249 // 0x00437FB8
250 void updateDaily()

Callers

nothing calls this directly

Calls 11

isEditorModeFunction · 0.85
CompanyIdEnum · 0.85
getScenarioTicksFunction · 0.85
isPlayerCompanyFunction · 0.85
isNetworkedFunction · 0.85
isNetworkHostFunction · 0.85
setUpdatingCompanyIdFunction · 0.85
aiThinkFunction · 0.85
produceCompaniesFunction · 0.85
getFunction · 0.70
emptyMethod · 0.45

Tested by

no test coverage detected