mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-08 11:34:19 +01:00
refactor: the Sonar remarks on the small fixes taken care of
- the log stops through a flag kept in a function, not a global one - the messages are put together with std::format - a vehicle dropped on a trainset in the launcher goes in once the trainset is drawn, so the vehicles are gone through with a plain loop again; the drop split into a new vehicle and a moved one - the scenario that can't be opened is caught as the runtime error it is, a file name outside of the code page as the system error it is - a track of an unknown type is left out through the pointer owning it - the keyword of a track type written out by a function of its own - the picked node forgotten with ranges::replace_if, the empty Forget_Node of the base renderer told why it is empty - FileCased takes the path it works on
This commit is contained in:
@@ -696,8 +696,8 @@ void eu07_application::exit()
|
||||
Global.applicationQuitOrder = true;
|
||||
// each step of the closing in the log, to tell from it where a closing that hangs stops
|
||||
auto const closing{std::chrono::steady_clock::now()};
|
||||
auto const step = [&](char const *What) {
|
||||
WriteLog(std::string{"Closing: "} + What + " at " + std::to_string(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - closing).count()) + " ms");
|
||||
auto const step = [closing](char const *What) {
|
||||
WriteLog(std::format("Closing: {} at {} ms", What, std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - closing).count()));
|
||||
};
|
||||
step("the modes");
|
||||
for (auto &mode : m_modes)
|
||||
|
||||
@@ -21,6 +21,8 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "utilities/translation.h"
|
||||
#include "audio/audiorenderer.h"
|
||||
|
||||
#include <format>
|
||||
|
||||
scenarioloader_mode::scenarioloader_mode() {
|
||||
m_userinterface = std::make_shared<scenarioloader_ui>();
|
||||
}
|
||||
@@ -52,8 +54,9 @@ bool scenarioloader_mode::update() {
|
||||
try {
|
||||
state = simulation::State.deserialize_begin(Global.SceneryFile);
|
||||
}
|
||||
catch (std::exception const &e) {
|
||||
ErrorLog("Bad init: scenario \"" + Global.SceneryFile + "\" couldn't be opened (" + e.what() + ")");
|
||||
// the file it can't read, as the parser and the scenery opening it report it
|
||||
catch (std::runtime_error const &e) {
|
||||
ErrorLog(std::format("Bad init: scenario \"{}\" couldn't be opened ({})", Global.SceneryFile, e.what()));
|
||||
state.reset();
|
||||
Global.SceneryFile.clear();
|
||||
Application.pop_mode();
|
||||
|
||||
Reference in New Issue
Block a user