mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-08 17:26:22 +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:
@@ -36,6 +36,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "utilities/utilities.h"
|
||||
#include "editor/editorTerrainStreamer.hpp"
|
||||
|
||||
#include <format>
|
||||
|
||||
namespace simulation {
|
||||
|
||||
@@ -542,13 +543,14 @@ state_serializer::deserialize_node( cParser &Input, scene::scratch_data &Scratch
|
||||
}
|
||||
else if( nodedata.type == "track" ) {
|
||||
|
||||
auto *path { deserialize_path( Input, Scratchpad, nodedata ) };
|
||||
if( path->eType == tt_Unknown ) {
|
||||
// with no path made it can't be joined nor drawn, and nothing could run on it
|
||||
ErrorLog( "Bad scenario: track \"" + path->name() + "\" of an unknown type defined in file \"" + Input.Name() + "\" (line " + std::to_string( inputline ) + ") left out" );
|
||||
delete path;
|
||||
std::unique_ptr<TTrack> made { deserialize_path( Input, Scratchpad, nodedata ) };
|
||||
if( made->eType == tt_Unknown ) {
|
||||
// with no path made it can't be joined nor drawn, and nothing could run on it: it goes with its holder
|
||||
ErrorLog( std::format( "Bad scenario: track \"{}\" of an unknown type defined in file \"{}\" (line {}) left out", made->name(), Input.Name(), inputline ) );
|
||||
return;
|
||||
}
|
||||
// from here on the scene owns it
|
||||
auto *path { made.release() };
|
||||
// duplicates of named tracks are currently experimentally allowed
|
||||
if( false == simulation::Paths.insert( path ) ) {
|
||||
ErrorLog( "Bad scenario: duplicate track name \"" + path->name() + "\" defined in file \"" + Input.Name() + "\" (line " + std::to_string( inputline ) + ")" );
|
||||
|
||||
Reference in New Issue
Block a user