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

Function loadAndStart

src/OpenLoco/src/Scenario/Scenario.cpp:377–392  ·  view source on GitHub ↗

0x0044400C

Source from the content-addressed store, hash-verified

375
376 // 0x0044400C
377 bool loadAndStart(const fs::path& path)
378 {
379 // Set new rng seed based on current rng and current time
380 // TODO do we really need to use the current rng? seems unnecessary, keeping with vanilla logic for now
381 auto& gameState = getGameState();
382 auto oldRng = gameState.rng;
383
384 if (!load(path))
385 {
386 return false;
387 }
388
389 gameState.rng = Core::Prng(Platform::getTime() ^ oldRng.srand_0(), oldRng.srand_1());
390 std::strncpy(gameState.scenarioFileName, path.u8string().c_str(), std::size(gameState.scenarioFileName) - 1);
391 start();
392 }
393
394 // this will prepare _commonFormatArgs array before drawing the StringIds::challenge_value
395 // after that for example it will draw this string: Achieve a performance index of 10.0% ("Engineer")

Callers 2

loadFileFunction · 0.85
onScrollMouseDownFunction · 0.85

Calls 6

PrngClass · 0.85
srand_0Method · 0.80
srand_1Method · 0.80
loadFunction · 0.70
startFunction · 0.70
getTimeFunction · 0.50

Tested by

no test coverage detected