diff --git a/source/graphics/GameView.cpp b/source/graphics/GameView.cpp index ff485df67a..f4a3db0469 100644 --- a/source/graphics/GameView.cpp +++ b/source/graphics/GameView.cpp @@ -206,17 +206,17 @@ CMiniMapTexture& CGameView::GetMiniMapTexture() void CGameView::RegisterInit() { // CGameView init - LDR_Register([this](const double) + LDR_Register([this] { m->CameraController->LoadConfig(); return 0; }, L"CGameView init", 1); - LDR_Register([](const double) + LDR_Register([] { return g_TexMan.StartTerrainTextures(); }, L"StartTerrainTextures", 1); - LDR_Register([](const double) + LDR_Register([] { return g_TexMan.PollTerrainTextures(); }, L"PollTerrainTextures", 60); diff --git a/source/graphics/MapReader.cpp b/source/graphics/MapReader.cpp index 44315637bd..2845611ff2 100644 --- a/source/graphics/MapReader.cpp +++ b/source/graphics/MapReader.cpp @@ -150,55 +150,55 @@ void CMapReader::LoadMap(const VfsPath& pathname, const ScriptContext& cx, JS:: // load map or script settings script if (settings.isUndefined()) - LDR_Register([this](const double) + LDR_Register([this] { return LoadScriptSettings(); }, L"CMapReader::LoadScriptSettings", 50); else - LDR_Register([this](const double) + LDR_Register([this] { return LoadRMSettings(); }, L"CMapReader::LoadRMSettings", 50); // load player settings script (must be done before reading map) - LDR_Register([this](const double) + LDR_Register([this] { return LoadPlayerSettings(); }, L"CMapReader::LoadPlayerSettings", 50); // unpack the data if (!only_xml) - LDR_Register([this](const double) + LDR_Register([this] { return UnpackTerrain(); }, L"CMapReader::UnpackMap", 1200); // read the corresponding XML file - LDR_Register([this](const double) + LDR_Register([this] { return ReadXML(); }, L"CMapReader::ReadXML", 50); // apply terrain data to the world - LDR_Register([this](const double) + LDR_Register([this] { return ApplyTerrainData(); }, L"CMapReader::ApplyTerrainData", 5); // read entities - LDR_Register([this](const double) + LDR_Register([this] { return ReadXMLEntities(); }, L"CMapReader::ReadXMLEntities", 5800); // apply misc data to the world - LDR_Register([this](const double) + LDR_Register([this] { return ApplyData(); }, L"CMapReader::ApplyData", 5); // load map settings script (must be done after reading map) - LDR_Register([this](const double) + LDR_Register([this] { return LoadMapSettings(); }, L"CMapReader::LoadMapSettings", 5); @@ -232,70 +232,70 @@ void CMapReader::LoadRandomMap(const CStrW& scriptFile, const ScriptContext& cx, only_xml = false; // copy random map settings (before entity creation) - LDR_Register([this](const double) + LDR_Register([this] { return LoadRMSettings(); }, L"CMapReader::LoadRMSettings", 50); // load player settings script (must be done before reading map) - LDR_Register([this](const double) + LDR_Register([this] { return LoadPlayerSettings(); }, L"CMapReader::LoadPlayerSettings", 50); // load map generator with random map script - LDR_Register([this, scriptFile](const double) + LDR_Register([this, scriptFile] { return StartMapGeneration(scriptFile); }, L"CMapReader::StartMapGeneration", 1); - LDR_Register([this](const double) + LDR_Register([this] { return PollMapGeneration(); }, L"CMapReader::PollMapGeneration", 19999); // parse RMS results into terrain structure - LDR_Register([this](const double) + LDR_Register([this] { return ParseTerrain(); }, L"CMapReader::ParseTerrain", 500); // parse RMS results into environment settings - LDR_Register([this](const double) + LDR_Register([this] { return ParseEnvironment(); }, L"CMapReader::ParseEnvironment", 5); // parse RMS results into camera settings - LDR_Register([this](const double) + LDR_Register([this] { return ParseCamera(); }, L"CMapReader::ParseCamera", 5); // apply terrain data to the world - LDR_Register([this](const double) + LDR_Register([this] { return ApplyTerrainData(); }, L"CMapReader::ApplyTerrainData", 5); // parse RMS results into entities - LDR_Register([this](const double) + LDR_Register([this] { return StartParseEntities(); }, L"CMapReader::StartParseEntities", 10); - LDR_Register([this](const double) + LDR_Register([this] { return PollParseEntities(); }, L"CMapReader::PollParseEntities", 1000); // apply misc data to the world - LDR_Register([this](const double) + LDR_Register([this] { return ApplyData(); }, L"CMapReader::ApplyData", 5); // load map settings script (must be done after reading map) - LDR_Register([this](const double) + LDR_Register([this] { return LoadMapSettings(); }, L"CMapReader::LoadMapSettings", 5); diff --git a/source/ps/Game.cpp b/source/ps/Game.cpp index e8bbcf6ac4..2e9d6c9457 100644 --- a/source/ps/Game.cpp +++ b/source/ps/Game.cpp @@ -253,7 +253,7 @@ void CGame::RegisterInit(const JS::HandleValue attribs, const std::string& saved LDR_BeginRegistering(); - LDR_Register([this](const double) + LDR_Register([this] { return m_Simulation2->ProgressiveLoad(); }, L"Simulation init", 1000); @@ -282,19 +282,19 @@ void CGame::RegisterInit(const JS::HandleValue attribs, const std::string& saved m_World->RegisterInit(mapFile, scriptInterface.GetContext(), settings, m_PlayerID); } if (m_GameView) - LDR_Register([&waterManager = g_Renderer.GetSceneRenderer().GetWaterManager()](const double) + LDR_Register([&waterManager = g_Renderer.GetSceneRenderer().GetWaterManager()] { return waterManager.LoadWaterTextures(); }, L"LoadWaterTextures", 80); if (m_IsSavedGame) - LDR_Register([this, savedState](const double) + LDR_Register([this, savedState] { return LoadInitialState(savedState); }, L"Loading game", 1000); if (m_IsVisualReplay) - LDR_Register([this](const double) + LDR_Register([this] { return LoadVisualReplayData(); }, L"Loading visual replay data", 1000); diff --git a/source/ps/Loader.cpp b/source/ps/Loader.cpp index 56277a5497..b29c2a12ca 100644 --- a/source/ps/Loader.cpp +++ b/source/ps/Loader.cpp @@ -200,7 +200,7 @@ LDR_ProgressiveLoadResult LDR_ProgressiveLoad(double time_budget) // call this task's function and bill elapsed time. const double t0 = timer_Time(); - const int status = lr.func(time_left); + const int status = lr.func(); const bool timed_out = ldr_was_interrupted(status); const double elapsed_time = timer_Time() - t0; time_left -= elapsed_time; diff --git a/source/ps/Loader.h b/source/ps/Loader.h index 2a841393f5..91a1fa7c67 100644 --- a/source/ps/Loader.h +++ b/source/ps/Loader.h @@ -106,7 +106,6 @@ extern void LDR_BeginRegistering(); // callback function of a task; performs the actual work. -// it receives the time remaining [s]. // // return semantics: // - if the entire task was successfully completed, return 0; @@ -117,7 +116,7 @@ extern void LDR_BeginRegistering(); // != 0, or it's treated as "finished") // - on failure, return a negative error code or 'warning' (see above); // LDR_ProgressiveLoad will abort immediately and return that. -using LoadFunc = std::function; +using LoadFunc = std::function; // register a task (later processed in FIFO order). // : function that will perform the actual work; see LoadFunc. diff --git a/source/ps/World.cpp b/source/ps/World.cpp index 7e86f636da..6b468bbdfe 100644 --- a/source/ps/World.cpp +++ b/source/ps/World.cpp @@ -86,7 +86,7 @@ void CWorld::RegisterInit(const CStrW& mapFile, const ScriptContext& cx, JS::Han m_Game.GetSimulation2(), &m_Game.GetSimulation2()->GetSimContext(), playerID, false); // fails immediately, or registers for delay loading - LDR_Register([this](const double) + LDR_Register([this] { return DeleteMapReader(); }, L"CWorld::DeleteMapReader", 5); @@ -111,7 +111,7 @@ void CWorld::RegisterInitRMS(const CStrW& scriptFile, const ScriptContext& cx, J pTriggerManager, CRenderer::IsInitialised() ? &g_Renderer.GetPostprocManager() : nullptr, m_Game.GetSimulation2(), playerID); // registers for delay loading - LDR_Register([this](const double) + LDR_Register([this] { return DeleteMapReader(); }, L"CWorld::DeleteMapReader", 5);