mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 22:39:19 +02:00
Do not allow implicit cast for inline std::string to_string(bool Value) and change to_string to std::string for non boolean values
This commit is contained in:
@@ -10122,7 +10122,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
modernDimmerPosition = modernDimmerDefaultPosition;
|
modernDimmerPosition = modernDimmerDefaultPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteLog("CERROR: " + to_string(ConversionError) + ", SUCCES: " + to_string(result));
|
WriteLog("CERROR: " + std::to_string(ConversionError) + ", SUCCES: " + to_string(result));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10860,9 +10860,9 @@ void TMoverParameters::LoadFIZ_Cntrl(std::string const &line)
|
|||||||
void TMoverParameters::LoadFIZ_Blending(std::string const &line)
|
void TMoverParameters::LoadFIZ_Blending(std::string const &line)
|
||||||
{
|
{
|
||||||
|
|
||||||
extract_value(MED_Vmax, "MED_Vmax", line, to_string(Vmax));
|
extract_value(MED_Vmax, "MED_Vmax", line, std::to_string(Vmax));
|
||||||
extract_value(MED_Vmin, "MED_Vmin", line, "0");
|
extract_value(MED_Vmin, "MED_Vmin", line, "0");
|
||||||
extract_value(MED_Vref, "MED_Vref", line, to_string(Vmax));
|
extract_value(MED_Vref, "MED_Vref", line, std::to_string(Vmax));
|
||||||
extract_value(MED_amax, "MED_amax", line, "9.81");
|
extract_value(MED_amax, "MED_amax", line, "9.81");
|
||||||
extract_value(MED_EPVC, "MED_EPVC", line, "");
|
extract_value(MED_EPVC, "MED_EPVC", line, "");
|
||||||
extract_value(MED_Ncor, "MED_Ncor", line, "");
|
extract_value(MED_Ncor, "MED_Ncor", line, "");
|
||||||
@@ -11160,7 +11160,7 @@ void TMoverParameters::LoadFIZ_Engine(std::string const &Input)
|
|||||||
extract_value(eimc[eimc_f_DU], "DU", Input, "");
|
extract_value(eimc[eimc_f_DU], "DU", Input, "");
|
||||||
extract_value(eimc[eimc_f_I0], "I0", Input, "");
|
extract_value(eimc[eimc_f_I0], "I0", Input, "");
|
||||||
extract_value(eimc[eimc_f_cfu], "fcfu", Input, "");
|
extract_value(eimc[eimc_f_cfu], "fcfu", Input, "");
|
||||||
extract_value(eimc[eimc_f_cfuH], "fcfuH", Input, to_string(eimc[eimc_f_cfu]));
|
extract_value(eimc[eimc_f_cfuH], "fcfuH", Input, std::to_string(eimc[eimc_f_cfu]));
|
||||||
extract_value(eimc[eimc_p_F0], "F0", Input, "");
|
extract_value(eimc[eimc_p_F0], "F0", Input, "");
|
||||||
extract_value(eimc[eimc_p_a1], "a1", Input, "");
|
extract_value(eimc[eimc_p_a1], "a1", Input, "");
|
||||||
extract_value(eimc[eimc_p_Pmax], "Pmax", Input, "");
|
extract_value(eimc[eimc_p_Pmax], "Pmax", Input, "");
|
||||||
|
|||||||
@@ -421,11 +421,11 @@ timetable_panel::update() {
|
|||||||
.substr( 0, 34 - tableline->StationWare.size() ) };
|
.substr( 0, 34 - tableline->StationWare.size() ) };
|
||||||
auto const arrival { (
|
auto const arrival { (
|
||||||
tableline->Ah >= 0 ?
|
tableline->Ah >= 0 ?
|
||||||
to_string( int( 100 + tableline->Ah ) ).substr( 1, 2 ) + ":" + to_minutes_str( tableline->Am, true, 3 ) :
|
std::to_string( int( 100 + tableline->Ah ) ).substr( 1, 2 ) + ":" + to_minutes_str( tableline->Am, true, 3 ) :
|
||||||
" │ " ) };
|
" │ " ) };
|
||||||
auto const departure { (
|
auto const departure { (
|
||||||
tableline->Dh >= 0 ?
|
tableline->Dh >= 0 ?
|
||||||
to_string( int( 100 + tableline->Dh ) ).substr( 1, 2 ) + ":" + to_minutes_str( tableline->Dm, true, 3 ) :
|
std::to_string( int( 100 + tableline->Dh ) ).substr( 1, 2 ) + ":" + to_minutes_str( tableline->Dm, true, 3 ) :
|
||||||
" │ " ) };
|
" │ " ) };
|
||||||
auto const candepart { (
|
auto const candepart { (
|
||||||
( table.StationStart < table.StationIndex )
|
( table.StationStart < table.StationIndex )
|
||||||
@@ -721,9 +721,9 @@ debug_panel::render_section_scenario() {
|
|||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
auto time = simulation::Time.data().wHour * 60 + simulation::Time.data().wMinute;
|
auto time = simulation::Time.data().wHour * 60 + simulation::Time.data().wMinute;
|
||||||
auto const timestring {
|
auto const timestring {
|
||||||
std::string( to_string( int( 100 + simulation::Time.data().wHour ) ).substr( 1, 2 )
|
std::string( std::to_string( int( 100 + simulation::Time.data().wHour ) ).substr( 1, 2 )
|
||||||
+ ":"
|
+ ":"
|
||||||
+ std::string( to_string( int( 100 + simulation::Time.data().wMinute ) ).substr( 1, 2 ) ) ) };
|
+ std::string( std::to_string( int( 100 + simulation::Time.data().wMinute ) ).substr( 1, 2 ) ) ) };
|
||||||
if( ImGui::SliderInt( ( timestring + " (" + Global.Period + ")###simulationtime" ).c_str(), &time, 0, 1439, "Time of day" ) ) {
|
if( ImGui::SliderInt( ( timestring + " (" + Global.Period + ")###simulationtime" ).c_str(), &time, 0, 1439, "Time of day" ) ) {
|
||||||
command_relay relay;
|
command_relay relay;
|
||||||
relay.post(
|
relay.post(
|
||||||
@@ -1210,8 +1210,8 @@ debug_panel::update_section_ai( std::vector<text_line> &Output ) {
|
|||||||
+ ", corrected: " + to_string( mechanik.AccDesired * mechanik.BrakeAccFactor(), 2 )
|
+ ", corrected: " + to_string( mechanik.AccDesired * mechanik.BrakeAccFactor(), 2 )
|
||||||
+ "\n current: " + to_string( mechanik.AbsAccS + 0.001f, 2 )
|
+ "\n current: " + to_string( mechanik.AbsAccS + 0.001f, 2 )
|
||||||
+ ", slope: " + to_string( mechanik.fAccGravity + 0.001f, 2 ) + " (" + ( mechanik.fAccGravity > 0.01 ? "\\" : ( mechanik.fAccGravity < -0.01 ? "/" : "-" ) ) + ")"
|
+ ", slope: " + to_string( mechanik.fAccGravity + 0.001f, 2 ) + " (" + ( mechanik.fAccGravity > 0.01 ? "\\" : ( mechanik.fAccGravity < -0.01 ? "/" : "-" ) ) + ")"
|
||||||
+ "\n desired diesel percentage: " + to_string(mechanik.DizelPercentage)
|
+ "\n desired diesel percentage: " + std::to_string(mechanik.DizelPercentage)
|
||||||
+ "/" + to_string(mechanik.DizelPercentage_Speed)
|
+ "/" + std::to_string(mechanik.DizelPercentage_Speed)
|
||||||
+ "/" + to_string(100.4*mechanik.mvControlling->eimic_real, 0);
|
+ "/" + to_string(100.4*mechanik.mvControlling->eimic_real, 0);
|
||||||
|
|
||||||
Output.emplace_back( textline, Global.UITextColor );
|
Output.emplace_back( textline, Global.UITextColor );
|
||||||
@@ -1222,7 +1222,7 @@ debug_panel::update_section_ai( std::vector<text_line> &Output ) {
|
|||||||
+ "\n activation threshold: " + to_string( mechanik.fAccThreshold, 2 )
|
+ "\n activation threshold: " + to_string( mechanik.fAccThreshold, 2 )
|
||||||
+ ", delays: " + to_string( mechanik.fBrake_a0[ 0 ], 2 ) + " + " + to_string( mechanik.fBrake_a1[ 0 ], 2 )
|
+ ", delays: " + to_string( mechanik.fBrake_a0[ 0 ], 2 ) + " + " + to_string( mechanik.fBrake_a1[ 0 ], 2 )
|
||||||
+ "\n virtual brake position: " + to_string( mechanik.BrakeCtrlPosition, 2 )
|
+ "\n virtual brake position: " + to_string( mechanik.BrakeCtrlPosition, 2 )
|
||||||
+ "\n test stage: " + to_string( mechanik.DynamicBrakeTest )
|
+ "\n test stage: " + std::to_string( mechanik.DynamicBrakeTest )
|
||||||
+ ", applied at: " + to_string( mechanik.DBT_VelocityBrake, 0 )
|
+ ", applied at: " + to_string( mechanik.DBT_VelocityBrake, 0 )
|
||||||
+ ", release at: " + to_string( mechanik.DBT_VelocityRelease, 0 )
|
+ ", release at: " + to_string( mechanik.DBT_VelocityRelease, 0 )
|
||||||
+ ", done at: " + to_string( mechanik.DBT_VelocityFinish, 0 );
|
+ ", done at: " + to_string( mechanik.DBT_VelocityFinish, 0 );
|
||||||
@@ -1393,7 +1393,7 @@ debug_panel::update_section_powergrid( std::vector<text_line> &Output ) {
|
|||||||
+ " " + to_string( powerstation->FuseTimer, 1, 8 )
|
+ " " + to_string( powerstation->FuseTimer, 1, 8 )
|
||||||
+ ( powerstation->FuseCounter == 0 ?
|
+ ( powerstation->FuseCounter == 0 ?
|
||||||
"" :
|
"" :
|
||||||
" (x" + to_string( powerstation->FuseCounter ) + ")" );
|
" (x" + std::to_string( powerstation->FuseCounter ) + ")" );
|
||||||
|
|
||||||
Output.emplace_back(
|
Output.emplace_back(
|
||||||
textline,
|
textline,
|
||||||
@@ -1445,7 +1445,7 @@ debug_panel::update_section_renderer( std::vector<text_line> &Output ) {
|
|||||||
+ ", FPS: " + std::to_string( static_cast<int>(std::round(GfxRenderer->Framerate())) )
|
+ ", FPS: " + std::to_string( static_cast<int>(std::round(GfxRenderer->Framerate())) )
|
||||||
+ ( Global.VSync ? " (vsync on)" : "" );
|
+ ( Global.VSync ? " (vsync on)" : "" );
|
||||||
if( Global.iSlowMotion ) {
|
if( Global.iSlowMotion ) {
|
||||||
textline += " (slowmotion " + to_string( Global.iSlowMotion ) + ")";
|
textline += " (slowmotion " + std::to_string( Global.iSlowMotion ) + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
Output.emplace_back( textline, Global.UITextColor );
|
Output.emplace_back( textline, Global.UITextColor );
|
||||||
@@ -1548,8 +1548,8 @@ debug_panel::render_section_settings() {
|
|||||||
ImGui::TextUnformatted( "Graphics" );
|
ImGui::TextUnformatted( "Graphics" );
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
// reflection fidelity
|
// reflection fidelity
|
||||||
ImGui::SliderInt( ( to_string( Global.reflectiontune.fidelity ) + "###reflectionfidelity" ).c_str(), &Global.reflectiontune.fidelity, 0, 2, "Reflection fidelity" );
|
ImGui::SliderInt( ( std::to_string( Global.reflectiontune.fidelity ) + "###reflectionfidelity" ).c_str(), &Global.reflectiontune.fidelity, 0, 2, "Reflection fidelity" );
|
||||||
ImGui::SliderInt( ( to_string( Global.gfx_shadow_rank_cutoff ) + "###shadowrankcutoff" ).c_str(), &Global.gfx_shadow_rank_cutoff, 1, 3, "Shadow ranks" );
|
ImGui::SliderInt( ( std::to_string( Global.gfx_shadow_rank_cutoff ) + "###shadowrankcutoff" ).c_str(), &Global.gfx_shadow_rank_cutoff, 1, 3, "Shadow ranks" );
|
||||||
if( ImGui::SliderFloat( ( to_string( std::abs( Global.gfx_shadow_angle_min ), 2 ) + "###shadowanglecutoff" ).c_str(), &Global.gfx_shadow_angle_min, -1.0, -0.2, "Shadow angle cutoff" ) ) {
|
if( ImGui::SliderFloat( ( to_string( std::abs( Global.gfx_shadow_angle_min ), 2 ) + "###shadowanglecutoff" ).c_str(), &Global.gfx_shadow_angle_min, -1.0, -0.2, "Shadow angle cutoff" ) ) {
|
||||||
Global.gfx_shadow_angle_min = quantize( Global.gfx_shadow_angle_min, 0.05f );
|
Global.gfx_shadow_angle_min = quantize( Global.gfx_shadow_angle_min, 0.05f );
|
||||||
};
|
};
|
||||||
@@ -1569,19 +1569,19 @@ debug_panel::render_section_settings() {
|
|||||||
ImGui::TextUnformatted( "Sound" );
|
ImGui::TextUnformatted( "Sound" );
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
// audio volume sliders
|
// audio volume sliders
|
||||||
ImGui::SliderFloat( ( to_string( static_cast<int>( Global.AudioVolume * 100 ) ) + "%###volumemain" ).c_str(), &Global.AudioVolume, 0.0f, 2.0f, "Main audio volume" );
|
ImGui::SliderFloat( ( std::to_string( static_cast<int>( Global.AudioVolume * 100 ) ) + "%###volumemain" ).c_str(), &Global.AudioVolume, 0.0f, 2.0f, "Main audio volume" );
|
||||||
if( ImGui::SliderFloat( ( to_string( static_cast<int>( Global.VehicleVolume * 100 ) ) + "%###volumevehicle" ).c_str(), &Global.VehicleVolume, 0.0f, 1.0f, "Vehicle sounds" ) ) {
|
if( ImGui::SliderFloat( ( std::to_string( static_cast<int>( Global.VehicleVolume * 100 ) ) + "%###volumevehicle" ).c_str(), &Global.VehicleVolume, 0.0f, 1.0f, "Vehicle sounds" ) ) {
|
||||||
audio::event_volume_change = true;
|
audio::event_volume_change = true;
|
||||||
}
|
}
|
||||||
if( ImGui::SliderFloat( ( to_string( static_cast<int>( Global.EnvironmentPositionalVolume * 100 ) ) + "%###volumepositional" ).c_str(), &Global.EnvironmentPositionalVolume, 0.0f, 1.0f, "Positional sounds" ) ) {
|
if( ImGui::SliderFloat( ( std::to_string( static_cast<int>( Global.EnvironmentPositionalVolume * 100 ) ) + "%###volumepositional" ).c_str(), &Global.EnvironmentPositionalVolume, 0.0f, 1.0f, "Positional sounds" ) ) {
|
||||||
audio::event_volume_change = true;
|
audio::event_volume_change = true;
|
||||||
}
|
}
|
||||||
if( ImGui::SliderFloat( ( to_string( static_cast<int>( Global.EnvironmentAmbientVolume * 100 ) ) + "%###volumeambient" ).c_str(), &Global.EnvironmentAmbientVolume, 0.0f, 1.0f, "Ambient sounds" ) ) {
|
if( ImGui::SliderFloat( ( std::to_string( static_cast<int>( Global.EnvironmentAmbientVolume * 100 ) ) + "%###volumeambient" ).c_str(), &Global.EnvironmentAmbientVolume, 0.0f, 1.0f, "Ambient sounds" ) ) {
|
||||||
audio::event_volume_change = true;
|
audio::event_volume_change = true;
|
||||||
}
|
}
|
||||||
if (simulation::Train) {
|
if (simulation::Train) {
|
||||||
float val = simulation::Train->get_radiovolume();
|
float val = simulation::Train->get_radiovolume();
|
||||||
if( ImGui::SliderFloat( ( to_string( static_cast<int>( val * 100 ) ) + "%###volumeradio" ).c_str(), &val, 0.0f, 1.0f, "Vehicle radio volume" ) ) {
|
if( ImGui::SliderFloat( ( std::to_string( static_cast<int>( val * 100 ) ) + "%###volumeradio" ).c_str(), &val, 0.0f, 1.0f, "Vehicle radio volume" ) ) {
|
||||||
command_relay relay;
|
command_relay relay;
|
||||||
relay.post(user_command::radiovolumeset, val, 0.0, GLFW_PRESS, 0);
|
relay.post(user_command::radiovolumeset, val, 0.0, GLFW_PRESS, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ void itemproperties_panel::update(scene::basic_node const *Node)
|
|||||||
textline += '[';
|
textline += '[';
|
||||||
for (int lightidx = 0; lightidx < subnode->iNumLights; ++lightidx)
|
for (int lightidx = 0; lightidx < subnode->iNumLights; ++lightidx)
|
||||||
{
|
{
|
||||||
textline += to_string(subnode->lsLights[lightidx]);
|
textline += std::to_string(subnode->lsLights[lightidx]);
|
||||||
if (lightidx < subnode->iNumLights - 1)
|
if (lightidx < subnode->iNumLights - 1)
|
||||||
{
|
{
|
||||||
textline += ", ";
|
textline += ", ";
|
||||||
@@ -125,8 +125,8 @@ void itemproperties_panel::update(scene::basic_node const *Node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// basic attributes
|
// basic attributes
|
||||||
textline = "isolated: " + (!isolatedlist.empty() ? isolatedlist : "(none)") + "\nvelocity: " + to_string(subnode->SwitchExtension ? subnode->SwitchExtension->fVelocity : subnode->fVelocity) +
|
textline = "isolated: " + (!isolatedlist.empty() ? isolatedlist : "(none)") + "\nvelocity: " + std::to_string(subnode->SwitchExtension ? subnode->SwitchExtension->fVelocity : subnode->fVelocity) +
|
||||||
"\nwidth: " + to_string(subnode->fTrackWidth) + " m" + "\nfriction: " + to_string(subnode->fFriction, 2) + "\nquality: " + to_string(subnode->iQualityFlag);
|
"\nwidth: " + std::to_string(subnode->fTrackWidth) + " m" + "\nfriction: " + to_string(subnode->fFriction, 2) + "\nquality: " + std::to_string(subnode->iQualityFlag);
|
||||||
text_lines.emplace_back(textline, Global.UITextColor);
|
text_lines.emplace_back(textline, Global.UITextColor);
|
||||||
// textures
|
// textures
|
||||||
auto texturefile{((subnode->m_material1 != null_handle) ? GfxRenderer->Material(subnode->m_material1)->GetName() : "(none)")};
|
auto texturefile{((subnode->m_material1 != null_handle) ? GfxRenderer->Material(subnode->m_material1)->GetName() : "(none)")};
|
||||||
@@ -256,7 +256,7 @@ void itemproperties_panel::update_group()
|
|||||||
m_grouphandle = grouphandle;
|
m_grouphandle = grouphandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_grouplines.emplace_back("nodes: " + to_string(static_cast<int>(nodegroup.nodes.size())) + "\nevents: " + to_string(static_cast<int>(nodegroup.events.size())), Global.UITextColor);
|
m_grouplines.emplace_back("nodes: " + std::to_string(nodegroup.nodes.size()) + "\nevents: " + std::to_string(nodegroup.events.size()), Global.UITextColor);
|
||||||
m_grouplines.emplace_back("names prefix: " + (m_groupprefix.empty() ? "(none)" : m_groupprefix), Global.UITextColor);
|
m_grouplines.emplace_back("names prefix: " + (m_groupprefix.empty() ? "(none)" : m_groupprefix), Global.UITextColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ OnCommandGet(multiplayer::DaneRozkaz *pRozkaz)
|
|||||||
{
|
{
|
||||||
int i = int(pRozkaz->cString[8]); // długość pierwszego łańcucha (z przodu dwa floaty)
|
int i = int(pRozkaz->cString[8]); // długość pierwszego łańcucha (z przodu dwa floaty)
|
||||||
CommLog(
|
CommLog(
|
||||||
Now() + " " + to_string(pRozkaz->iComm) + " " +
|
Now() + " " + std::to_string(pRozkaz->iComm) + " " +
|
||||||
std::string(pRozkaz->cString + 11 + i, (unsigned)(pRozkaz->cString[10 + i])) +
|
std::string(pRozkaz->cString + 11 + i, (unsigned)(pRozkaz->cString[10 + i])) +
|
||||||
" rcvd");
|
" rcvd");
|
||||||
// nazwa pojazdu jest druga
|
// nazwa pojazdu jest druga
|
||||||
@@ -98,7 +98,7 @@ OnCommandGet(multiplayer::DaneRozkaz *pRozkaz)
|
|||||||
break;
|
break;
|
||||||
case 4: // badanie zajętości toru
|
case 4: // badanie zajętości toru
|
||||||
{
|
{
|
||||||
CommLog(Now() + " " + to_string(pRozkaz->iComm) + " " +
|
CommLog(Now() + " " + std::to_string(pRozkaz->iComm) + " " +
|
||||||
std::string(pRozkaz->cString + 1, (unsigned)(pRozkaz->cString[0])) + " rcvd");
|
std::string(pRozkaz->cString + 1, (unsigned)(pRozkaz->cString[0])) + " rcvd");
|
||||||
|
|
||||||
auto *track = simulation::Paths.find( std::string( pRozkaz->cString + 1, (unsigned)( pRozkaz->cString[ 0 ] ) ) );
|
auto *track = simulation::Paths.find( std::string( pRozkaz->cString + 1, (unsigned)( pRozkaz->cString[ 0 ] ) ) );
|
||||||
@@ -110,7 +110,7 @@ OnCommandGet(multiplayer::DaneRozkaz *pRozkaz)
|
|||||||
break;
|
break;
|
||||||
case 5: // ustawienie parametrów
|
case 5: // ustawienie parametrów
|
||||||
{
|
{
|
||||||
CommLog(Now() + " " + to_string(pRozkaz->iComm) + " params " + to_string(*pRozkaz->iPar) + " rcvd");
|
CommLog(Now() + " " + std::to_string(pRozkaz->iComm) + " params " + std::to_string(*pRozkaz->iPar) + " rcvd");
|
||||||
if (*pRozkaz->iPar == 0) // sprawdzenie czasu
|
if (*pRozkaz->iPar == 0) // sprawdzenie czasu
|
||||||
if (*pRozkaz->iPar & 1) // ustawienie czasu
|
if (*pRozkaz->iPar & 1) // ustawienie czasu
|
||||||
{
|
{
|
||||||
@@ -133,7 +133,7 @@ OnCommandGet(multiplayer::DaneRozkaz *pRozkaz)
|
|||||||
// Ra 2014-12: to ma działać również dla pojazdów bez obsady
|
// Ra 2014-12: to ma działać również dla pojazdów bez obsady
|
||||||
CommLog(
|
CommLog(
|
||||||
Now() + " "
|
Now() + " "
|
||||||
+ to_string( pRozkaz->iComm ) + " "
|
+ std::to_string( pRozkaz->iComm ) + " "
|
||||||
+ std::string{ pRozkaz->cString + 1, (unsigned)( pRozkaz->cString[ 0 ] ) }
|
+ std::string{ pRozkaz->cString + 1, (unsigned)( pRozkaz->cString[ 0 ] ) }
|
||||||
+ " rcvd" );
|
+ " rcvd" );
|
||||||
if (pRozkaz->cString[0]) {
|
if (pRozkaz->cString[0]) {
|
||||||
@@ -153,15 +153,15 @@ OnCommandGet(multiplayer::DaneRozkaz *pRozkaz)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 8: // ponowne wysłanie informacji o zajętych odcinkach toru
|
case 8: // ponowne wysłanie informacji o zajętych odcinkach toru
|
||||||
CommLog(Now() + " " + to_string(pRozkaz->iComm) + " all busy track" + " rcvd");
|
CommLog(Now() + " " + std::to_string(pRozkaz->iComm) + " all busy track" + " rcvd");
|
||||||
simulation::Paths.TrackBusyList();
|
simulation::Paths.TrackBusyList();
|
||||||
break;
|
break;
|
||||||
case 9: // ponowne wysłanie informacji o zajętych odcinkach izolowanych
|
case 9: // ponowne wysłanie informacji o zajętych odcinkach izolowanych
|
||||||
CommLog(Now() + " " + to_string(pRozkaz->iComm) + " all busy isolated" + " rcvd");
|
CommLog(Now() + " " + std::to_string(pRozkaz->iComm) + " all busy isolated" + " rcvd");
|
||||||
simulation::Paths.IsolatedBusyList();
|
simulation::Paths.IsolatedBusyList();
|
||||||
break;
|
break;
|
||||||
case 10: // badanie zajętości jednego odcinka izolowanego
|
case 10: // badanie zajętości jednego odcinka izolowanego
|
||||||
CommLog(Now() + " " + to_string(pRozkaz->iComm) + " " +
|
CommLog(Now() + " " + std::to_string(pRozkaz->iComm) + " " +
|
||||||
std::string(pRozkaz->cString + 1, (unsigned)(pRozkaz->cString[0])) + " rcvd");
|
std::string(pRozkaz->cString + 1, (unsigned)(pRozkaz->cString[0])) + " rcvd");
|
||||||
simulation::Paths.IsolatedBusy( std::string( pRozkaz->cString + 1, (unsigned)( pRozkaz->cString[ 0 ] ) ) );
|
simulation::Paths.IsolatedBusy( std::string( pRozkaz->cString + 1, (unsigned)( pRozkaz->cString[ 0 ] ) ) );
|
||||||
break;
|
break;
|
||||||
@@ -169,12 +169,12 @@ OnCommandGet(multiplayer::DaneRozkaz *pRozkaz)
|
|||||||
// Ground.IsolatedBusy(AnsiString(pRozkaz->cString+1,(unsigned)(pRozkaz->cString[0])));
|
// Ground.IsolatedBusy(AnsiString(pRozkaz->cString+1,(unsigned)(pRozkaz->cString[0])));
|
||||||
break;
|
break;
|
||||||
case 12: // skrocona ramka parametrow pojazdow AI (wszystkich!!)
|
case 12: // skrocona ramka parametrow pojazdow AI (wszystkich!!)
|
||||||
CommLog(Now() + " " + to_string(pRozkaz->iComm) + " obsadzone" + " rcvd");
|
CommLog(Now() + " " + std::to_string(pRozkaz->iComm) + " obsadzone" + " rcvd");
|
||||||
WyslijObsadzone();
|
WyslijObsadzone();
|
||||||
// Ground.IsolatedBusy(AnsiString(pRozkaz->cString+1,(unsigned)(pRozkaz->cString[0])));
|
// Ground.IsolatedBusy(AnsiString(pRozkaz->cString+1,(unsigned)(pRozkaz->cString[0])));
|
||||||
break;
|
break;
|
||||||
case 13: // ramka uszkodzenia i innych stanow pojazdu, np. wylaczenie CA, wlaczenie recznego itd.
|
case 13: // ramka uszkodzenia i innych stanow pojazdu, np. wylaczenie CA, wlaczenie recznego itd.
|
||||||
CommLog(Now() + " " + to_string(pRozkaz->iComm) + " " +
|
CommLog(Now() + " " + std::to_string(pRozkaz->iComm) + " " +
|
||||||
std::string(pRozkaz->cString + 1, (unsigned)(pRozkaz->cString[0])) +
|
std::string(pRozkaz->cString + 1, (unsigned)(pRozkaz->cString[0])) +
|
||||||
" rcvd");
|
" rcvd");
|
||||||
if( pRozkaz->cString[ 1 ] ) // jeśli długość nazwy jest niezerowa
|
if( pRozkaz->cString[ 1 ] ) // jeśli długość nazwy jest niezerowa
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ basic_controller::log_error( std::string const &Error, int const Line ) const {
|
|||||||
"Bad plc program: \"" + m_programfilename + "\" "
|
"Bad plc program: \"" + m_programfilename + "\" "
|
||||||
+ Error
|
+ Error
|
||||||
+ ( Line > 0 ?
|
+ ( Line > 0 ?
|
||||||
" (line " + to_string( Line ) + ")" :
|
" (line " + std::to_string( Line ) + ")" :
|
||||||
"" ) );
|
"" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ std::string to_minutes_str(float const Minutes, bool const Leadingzero, int cons
|
|||||||
float minutesintegral;
|
float minutesintegral;
|
||||||
auto const minutesfractional{std::modf(Minutes, &minutesintegral)};
|
auto const minutesfractional{std::modf(Minutes, &minutesintegral)};
|
||||||
auto const width{Width - 1};
|
auto const width{Width - 1};
|
||||||
auto minutes = (std::string(width - 1, ' ') + (Leadingzero ? to_string(100 + minutesintegral).substr(1, 2) : to_string(minutesintegral, 0)));
|
auto minutes = (std::string(width - 1, ' ') + (Leadingzero ? std::to_string(100 + minutesintegral).substr(1, 2) : to_string(minutesintegral, 0)));
|
||||||
return (minutes.substr(minutes.size() - width, width) + fractionlabels[static_cast<int>(std::floor(minutesfractional * 10 + 0.1))]);
|
return (minutes.substr(minutes.size() - width, width) + fractionlabels[static_cast<int>(std::floor(minutesfractional * 10 + 0.1))]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,7 +123,8 @@ std::string to_string(double Value, int precision, int width);
|
|||||||
std::string to_hex_str(int const Value, int const width = 4);
|
std::string to_hex_str(int const Value, int const width = 4);
|
||||||
std::string to_minutes_str(float const Minutes, bool const Leadingzero, int const Width);
|
std::string to_minutes_str(float const Minutes, bool const Leadingzero, int const Width);
|
||||||
|
|
||||||
inline std::string to_string(bool Value)
|
template <std::same_as<bool> T> // Without this line this function can be used with other types implicit casted to boolean which may create hard to debug bugs.
|
||||||
|
inline std::string to_string(T Value)
|
||||||
{
|
{
|
||||||
return (Value == true ? "true" : "false");
|
return (Value == true ? "true" : "false");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -353,8 +353,8 @@ std::string TSpeedPos::GetName() const
|
|||||||
else if( iFlags & spEvent ) // jeśli event
|
else if( iFlags & spEvent ) // jeśli event
|
||||||
return
|
return
|
||||||
evEvent->m_name
|
evEvent->m_name
|
||||||
+ " [" + to_string( static_cast<int>( evEvent->input_value( 1 ) ) )
|
+ " [" + std::to_string( static_cast<int>( evEvent->input_value( 1 ) ) )
|
||||||
+ ", " + to_string( static_cast<int>( evEvent->input_value( 2 ) ) )
|
+ ", " + std::to_string( static_cast<int>( evEvent->input_value( 2 ) ) )
|
||||||
+ "]";
|
+ "]";
|
||||||
else
|
else
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -2023,7 +2023,7 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
|
|||||||
if (ConversionError == 666)
|
if (ConversionError == 666)
|
||||||
ErrorLog( "Bad vehicle: failed to locate definition file \"" + BaseDir + "/" + Type_Name + ".fiz" + "\"" );
|
ErrorLog( "Bad vehicle: failed to locate definition file \"" + BaseDir + "/" + Type_Name + ".fiz" + "\"" );
|
||||||
else {
|
else {
|
||||||
ErrorLog( "Bad vehicle: failed to load definition from file \"" + BaseDir + "/" + Type_Name + ".fiz\" (error " + to_string( ConversionError ) + ")" );
|
ErrorLog( "Bad vehicle: failed to load definition from file \"" + BaseDir + "/" + Type_Name + ".fiz\" (error " + std::to_string( ConversionError ) + ")" );
|
||||||
}
|
}
|
||||||
return 0.0; // zerowa długość to brak pojazdu
|
return 0.0; // zerowa długość to brak pojazdu
|
||||||
}
|
}
|
||||||
@@ -2466,11 +2466,11 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
|
|||||||
if( mdModel ) {
|
if( mdModel ) {
|
||||||
// jeśli ma w czym szukać
|
// jeśli ma w czym szukać
|
||||||
for( int i = 0; i < 2; i++ ) {
|
for( int i = 0; i < 2; i++ ) {
|
||||||
asAnimName = std::string( "buffer_left0" ) + to_string( i + 1 );
|
asAnimName = std::string( "buffer_left0" ) + std::to_string( i + 1 );
|
||||||
smBuforLewy[ i ] = mdModel->GetFromName( asAnimName );
|
smBuforLewy[ i ] = mdModel->GetFromName( asAnimName );
|
||||||
if( smBuforLewy[ i ] )
|
if( smBuforLewy[ i ] )
|
||||||
smBuforLewy[ i ]->WillBeAnimated(); // ustawienie flagi animacji
|
smBuforLewy[ i ]->WillBeAnimated(); // ustawienie flagi animacji
|
||||||
asAnimName = std::string( "buffer_right0" ) + to_string( i + 1 );
|
asAnimName = std::string( "buffer_right0" ) + std::to_string( i + 1 );
|
||||||
smBuforPrawy[ i ] = mdModel->GetFromName( asAnimName );
|
smBuforPrawy[ i ] = mdModel->GetFromName( asAnimName );
|
||||||
if( smBuforPrawy[ i ] )
|
if( smBuforPrawy[ i ] )
|
||||||
smBuforPrawy[ i ]->WillBeAnimated();
|
smBuforPrawy[ i ]->WillBeAnimated();
|
||||||
@@ -3379,7 +3379,7 @@ bool TDynamicObject::Update(double dt, double dt1)
|
|||||||
if ((Fzad > 1) && (!MEDLogFile.is_open()) && (MoverParameters->Vel > 1))
|
if ((Fzad > 1) && (!MEDLogFile.is_open()) && (MoverParameters->Vel > 1))
|
||||||
{
|
{
|
||||||
MEDLogFile.open(
|
MEDLogFile.open(
|
||||||
"MEDLOGS/" + MoverParameters->Name + "_" + to_string( ++MEDLogCount ) + ".csv",
|
"MEDLOGS/" + MoverParameters->Name + "_" + std::to_string( ++MEDLogCount ) + ".csv",
|
||||||
std::ios::in | std::ios::out | std::ios::trunc );
|
std::ios::in | std::ios::out | std::ios::trunc );
|
||||||
MEDLogFile << "t\tVel\tMasa\tOsie\tFmaxPN\tFmaxED\tFfulED\tFrED\tFzad\tFzadED\tFzadPN";
|
MEDLogFile << "t\tVel\tMasa\tOsie\tFmaxPN\tFmaxED\tFfulED\tFrED\tFzad\tFzadED\tFzadPN";
|
||||||
for(int k=1;k<=np;k++)
|
for(int k=1;k<=np;k++)
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ bool TEventLauncher::Load(cParser *parser)
|
|||||||
WriteLog(
|
WriteLog(
|
||||||
"EventLauncher at "
|
"EventLauncher at "
|
||||||
+ std::to_string( iHour ) + ":"
|
+ std::to_string( iHour ) + ":"
|
||||||
+ ( iMinute < 10 ? "0" : "" ) + to_string( iMinute )
|
+ ( iMinute < 10 ? "0" : "" ) + std::to_string( iMinute )
|
||||||
+ " (" + asEvent1Name
|
+ " (" + asEvent1Name
|
||||||
+ ( asEvent2Name != "none" ? " / " + asEvent2Name : "" )
|
+ ( asEvent2Name != "none" ? " / " + asEvent2Name : "" )
|
||||||
+ ")" ); // wyświetlenie czasu
|
+ ")" ); // wyświetlenie czasu
|
||||||
@@ -316,8 +316,8 @@ TEventLauncher::export_as_text_( std::ostream &Output ) const {
|
|||||||
<< "condition "
|
<< "condition "
|
||||||
<< asMemCellName << ' '
|
<< asMemCellName << ' '
|
||||||
<< szText << ' '
|
<< szText << ' '
|
||||||
<< ( ( iCheckMask & basic_event::flags::value1 ) != 0 ? to_string( fVal1 ) : "*" ) << ' '
|
<< ( ( iCheckMask & basic_event::flags::value1 ) != 0 ? std::to_string( fVal1 ) : "*" ) << ' '
|
||||||
<< ( ( iCheckMask & basic_event::flags::value2 ) != 0 ? to_string( fVal2 ) : "*" ) << ' ';
|
<< ( ( iCheckMask & basic_event::flags::value2 ) != 0 ? std::to_string( fVal2 ) : "*" ) << ' ';
|
||||||
}
|
}
|
||||||
// footer
|
// footer
|
||||||
Output
|
Output
|
||||||
|
|||||||
@@ -275,8 +275,8 @@ basic_event::event_conditions::export_as_text( std::ostream &Output ) const {
|
|||||||
Output
|
Output
|
||||||
<< "memcompareex "
|
<< "memcompareex "
|
||||||
<< ( ( flags & flags::text ) == 0 ? "*" : memcompare_text + ' ' + to_string( memcompare_text_operator ) ) << ' '
|
<< ( ( flags & flags::text ) == 0 ? "*" : memcompare_text + ' ' + to_string( memcompare_text_operator ) ) << ' '
|
||||||
<< ( ( flags & flags::value1 ) == 0 ? "*" : to_string( memcompare_value1 ) + ' ' + to_string( memcompare_value1_operator ) ) << ' '
|
<< ( ( flags & flags::value1 ) == 0 ? "*" : std::to_string( memcompare_value1 ) + ' ' + to_string( memcompare_value1_operator ) ) << ' '
|
||||||
<< ( ( flags & flags::value2 ) == 0 ? "*" : to_string( memcompare_value2 ) + ' ' + to_string( memcompare_value2_operator ) ) << ' ';
|
<< ( ( flags & flags::value2 ) == 0 ? "*" : std::to_string( memcompare_value2 ) + ' ' + to_string( memcompare_value2_operator ) ) << ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -557,8 +557,8 @@ updatevalues_event::export_as_text_( std::ostream &Output ) const {
|
|||||||
|
|
||||||
Output
|
Output
|
||||||
<< ( ( m_input.flags & flags::text ) == 0 ? "*" : m_input.data_text ) << ' '
|
<< ( ( m_input.flags & flags::text ) == 0 ? "*" : m_input.data_text ) << ' '
|
||||||
<< ( ( m_input.flags & flags::value1 ) == 0 ? "*" : to_string( m_input.data_value_1 ) ) << ' '
|
<< ( ( m_input.flags & flags::value1 ) == 0 ? "*" : std::to_string( m_input.data_value_1 ) ) << ' '
|
||||||
<< ( ( m_input.flags & flags::value2 ) == 0 ? "*" : to_string( m_input.data_value_2 ) ) << ' ';
|
<< ( ( m_input.flags & flags::value2 ) == 0 ? "*" : std::to_string( m_input.data_value_2 ) ) << ' ';
|
||||||
|
|
||||||
m_conditions.export_as_text( Output );
|
m_conditions.export_as_text( Output );
|
||||||
}
|
}
|
||||||
@@ -1052,7 +1052,7 @@ whois_event::run_() {
|
|||||||
m_input.flags & ( flags::text | flags::value1 | flags::value2 ) );
|
m_input.flags & ( flags::text | flags::value1 | flags::value2 ) );
|
||||||
|
|
||||||
WriteLog(
|
WriteLog(
|
||||||
"Type: WhoIs (" + to_string( m_input.flags ) + ") - "
|
"Type: WhoIs (" + std::to_string( m_input.flags ) + ") - "
|
||||||
+ "[next station: " + nextstop + "], "
|
+ "[next station: " + nextstop + "], "
|
||||||
+ "[X], "
|
+ "[X], "
|
||||||
+ "[stop at next station: " + ( isstop != 0 ? "yes" : "no" ) + "]" );
|
+ "[stop at next station: " + ( isstop != 0 ? "yes" : "no" ) + "]" );
|
||||||
@@ -1066,7 +1066,7 @@ whois_event::run_() {
|
|||||||
m_input.flags & ( flags::text | flags::value1 | flags::value2 ) );
|
m_input.flags & ( flags::text | flags::value1 | flags::value2 ) );
|
||||||
|
|
||||||
WriteLog(
|
WriteLog(
|
||||||
"Type: WhoIs (" + to_string( m_input.flags ) + ") - "
|
"Type: WhoIs (" + std::to_string( m_input.flags ) + ") - "
|
||||||
+ "[name: " + m_activator->asName + "], "
|
+ "[name: " + m_activator->asName + "], "
|
||||||
+ "[X], "
|
+ "[X], "
|
||||||
+ "[X]" );
|
+ "[X]" );
|
||||||
@@ -1098,7 +1098,7 @@ whois_event::run_() {
|
|||||||
m_input.flags & ( flags::text | flags::value1 | flags::value2 ) );
|
m_input.flags & ( flags::text | flags::value1 | flags::value2 ) );
|
||||||
|
|
||||||
WriteLog(
|
WriteLog(
|
||||||
"Type: WhoIs (" + to_string( m_input.flags ) + ") - "
|
"Type: WhoIs (" + std::to_string( m_input.flags ) + ") - "
|
||||||
+ "[type: " + m_activator->MoverParameters->TypeName + "], "
|
+ "[type: " + m_activator->MoverParameters->TypeName + "], "
|
||||||
+ "[consist brake level: " + to_string( consistbrakelevel, 2 ) + "], "
|
+ "[consist brake level: " + to_string( consistbrakelevel, 2 ) + "], "
|
||||||
+ "[obstacle distance: " + to_string( collisiondistance, 2 ) + " m]" );
|
+ "[obstacle distance: " + to_string( collisiondistance, 2 ) + " m]" );
|
||||||
@@ -1112,7 +1112,7 @@ whois_event::run_() {
|
|||||||
m_input.flags & ( flags::text | flags::value1 | flags::value2 ) );
|
m_input.flags & ( flags::text | flags::value1 | flags::value2 ) );
|
||||||
|
|
||||||
WriteLog(
|
WriteLog(
|
||||||
"Type: WhoIs (" + to_string( m_input.flags ) + ") - "
|
"Type: WhoIs (" + std::to_string( m_input.flags ) + ") - "
|
||||||
+ "[load type: " + m_activator->MoverParameters->LoadType.name + "], "
|
+ "[load type: " + m_activator->MoverParameters->LoadType.name + "], "
|
||||||
+ "[current load: " + to_string( m_activator->MoverParameters->LoadAmount, 2 ) + "], "
|
+ "[current load: " + to_string( m_activator->MoverParameters->LoadAmount, 2 ) + "], "
|
||||||
+ "[max load: " + to_string( m_activator->MoverParameters->MaxLoad, 2 ) + "]" );
|
+ "[max load: " + to_string( m_activator->MoverParameters->MaxLoad, 2 ) + "]" );
|
||||||
@@ -1127,9 +1127,9 @@ whois_event::run_() {
|
|||||||
m_input.flags & ( flags::text | flags::value1 | flags::value2 ) );
|
m_input.flags & ( flags::text | flags::value1 | flags::value2 ) );
|
||||||
|
|
||||||
WriteLog(
|
WriteLog(
|
||||||
"Type: WhoIs (" + to_string( m_input.flags ) + ") - "
|
"Type: WhoIs (" + std::to_string( m_input.flags ) + ") - "
|
||||||
+ "[destination: " + m_activator->asDestination + "], "
|
+ "[destination: " + m_activator->asDestination + "], "
|
||||||
+ "[direction: " + to_string( m_activator->DirectionGet() ) + "], "
|
+ "[direction: " + std::to_string( m_activator->DirectionGet() ) + "], "
|
||||||
+ "[engine power: " + to_string( m_activator->MoverParameters->Power, 2 ) + "]" );
|
+ "[engine power: " + to_string( m_activator->MoverParameters->Power, 2 ) + "]" );
|
||||||
}
|
}
|
||||||
// +0
|
// +0
|
||||||
@@ -1143,9 +1143,9 @@ whois_event::run_() {
|
|||||||
0, // 1, gdy ma tu zatrzymanie
|
0, // 1, gdy ma tu zatrzymanie
|
||||||
m_input.flags & ( flags::text | flags::value1 | flags::value2 ) );
|
m_input.flags & ( flags::text | flags::value1 | flags::value2 ) );
|
||||||
WriteLog(
|
WriteLog(
|
||||||
"Type: WhoIs (" + to_string( m_input.flags ) + ") - "
|
"Type: WhoIs (" + std::to_string( m_input.flags ) + ") - "
|
||||||
+ "[train: " + m_activator->Mechanik->TrainName() + "], "
|
+ "[train: " + m_activator->Mechanik->TrainName() + "], "
|
||||||
+ "[stations left: " + to_string( m_activator->Mechanik->StationCount() - m_activator->Mechanik->StationIndex() ) + "], "
|
+ "[stations left: " + std::to_string( m_activator->Mechanik->StationCount() - m_activator->Mechanik->StationIndex() ) + "], "
|
||||||
+ "[stop at next station: " + ( m_activator->Mechanik->IsStop() ? "yes" : "no") + "]" );
|
+ "[stop at next station: " + ( m_activator->Mechanik->IsStop() ? "yes" : "no") + "]" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1395,7 +1395,7 @@ sound_event::run_() {
|
|||||||
|
|
||||||
WriteLog(
|
WriteLog(
|
||||||
"Type: Sound - [" + std::string( m_soundmode == 1 ? "play" : m_soundmode == -1 ? "loop" : "stop" ) + "]"
|
"Type: Sound - [" + std::string( m_soundmode == 1 ? "play" : m_soundmode == -1 ? "loop" : "stop" ) + "]"
|
||||||
+ ( m_soundradiochannel > 0 ? " [channel " + to_string( m_soundradiochannel ) + "]" : "" ) );
|
+ ( m_soundradiochannel > 0 ? " [channel " + std::to_string( m_soundradiochannel ) + "]" : "" ) );
|
||||||
for( auto &target : m_sounds ) {
|
for( auto &target : m_sounds ) {
|
||||||
auto *targetsound = std::get<sound_source *>( target );
|
auto *targetsound = std::get<sound_source *>( target );
|
||||||
if( targetsound == nullptr ) { continue; }
|
if( targetsound == nullptr ) { continue; }
|
||||||
@@ -1771,7 +1771,7 @@ lights_event::deserialize_( cParser &Input, scene::scratch_data &Scratchpad ) {
|
|||||||
Input >> m_lights[ lightidx++ ];
|
Input >> m_lights[ lightidx++ ];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ErrorLog( "Bad event: \"" + m_name + "\" (type: " + type() + ") with more than " + to_string( lightcountlimit ) + " parameters" );
|
ErrorLog( "Bad event: \"" + m_name + "\" (type: " + type() + ") with more than " + std::to_string( lightcountlimit ) + " parameters" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while( lightidx < lightcountlimit ) {
|
while( lightidx < lightcountlimit ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user