| 39 | }; |
| 40 | |
| 41 | static 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 | |
| 72 | template<class Fn> |
| 73 | static bool updateUntil(int maxSteps, Fn&& fn) |
no test coverage detected