MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / localStartGame

Function localStartGame

test/tests/PlayTests.cpp:41–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39};
40
41static std::unique_ptr<IContext> localStartGame(const std::string& parkPath)
42{
43 gOpenRCT2Headless = true;
44 gOpenRCT2NoGraphics = true;
45
46 auto context = CreateContext();
47 if (!context->Initialise())
48 return {};
49
50 auto importer = ParkImporter::CreateS6(context->GetObjectRepository());
51 auto loadResult = importer->LoadSavedGame(parkPath.c_str(), false);
52 context->GetObjectManager().LoadObjects(loadResult.RequiredObjects);
53
54 MapAnimations::ClearAll();
55 // TODO: Have a separate GameState and exchange once loaded.
56 auto& gameState = getGameState();
57 importer->Import(gameState);
58
59 gameState.entities.ResetEntitySpatialIndices();
60
61 ResetAllSpriteQuadrantPlacements();
62 LoadPalette();
63 EntityTweener::Get().Reset();
64 MapAnimations::MarkAllTiles();
65 FixInvalidVehicleSpriteSizes();
66
67 gGameSpeed = 1;
68
69 return context;
70}
71
72template<class Fn>
73static bool updateUntil(int maxSteps, Fn&& fn)

Callers 1

TEST_FFunction · 0.85

Calls 10

CreateContextFunction · 0.85
LoadPaletteFunction · 0.85
LoadObjectsMethod · 0.80
InitialiseMethod · 0.45
LoadSavedGameMethod · 0.45
ImportMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected