mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 12:49:18 +02:00
revert to frequent log flushing, fix for fiz parsing on linux, unify brake_speed interpretation as full rotations per second
This commit is contained in:
2
EU07.cpp
2
EU07.cpp
@@ -36,12 +36,10 @@ int main( int argc, char *argv[] )
|
|||||||
result = Application.run();
|
result = Application.run();
|
||||||
}
|
}
|
||||||
Application.exit();
|
Application.exit();
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
catch( std::bad_alloc const &Error )
|
catch( std::bad_alloc const &Error )
|
||||||
{
|
{
|
||||||
ErrorLog( "Critical error, memory allocation failure: " + std::string( Error.what() ) );
|
ErrorLog( "Critical error, memory allocation failure: " + std::string( Error.what() ) );
|
||||||
}
|
}
|
||||||
LogsFlush();
|
|
||||||
std::_Exit(0); // skip destructors, there are ordering errors which causes segfaults
|
std::_Exit(0); // skip destructors, there are ordering errors which causes segfaults
|
||||||
}
|
}
|
||||||
|
|||||||
9
Logs.cpp
9
Logs.cpp
@@ -81,6 +81,7 @@ void WriteLog( const char *str, logtype const Type ) {
|
|||||||
}
|
}
|
||||||
output << str << "\n";
|
output << str << "\n";
|
||||||
}
|
}
|
||||||
|
output.flush();
|
||||||
|
|
||||||
UILayer.log.emplace_back(std::string(str));
|
UILayer.log.emplace_back(std::string(str));
|
||||||
if (UILayer.log.size() > 100)
|
if (UILayer.log.size() > 100)
|
||||||
@@ -119,14 +120,6 @@ void ErrorLog( const char *str, logtype const Type ) {
|
|||||||
errors.flush();
|
errors.flush();
|
||||||
};
|
};
|
||||||
|
|
||||||
void LogsFlush()
|
|
||||||
{
|
|
||||||
if (output.is_open())
|
|
||||||
output.flush();
|
|
||||||
if (errors.is_open())
|
|
||||||
errors.flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Error(const std::string &asMessage, bool box)
|
void Error(const std::string &asMessage, bool box)
|
||||||
{
|
{
|
||||||
// if (box)
|
// if (box)
|
||||||
|
|||||||
1
Logs.h
1
Logs.h
@@ -27,4 +27,3 @@ void ErrorLog( const std::string &str, logtype const Type = logtype::generic );
|
|||||||
void WriteLog( const std::string &str, logtype const Type = logtype::generic );
|
void WriteLog( const std::string &str, logtype const Type = logtype::generic );
|
||||||
void CommLog( const char *str );
|
void CommLog( const char *str );
|
||||||
void CommLog( const std::string &str );
|
void CommLog( const std::string &str );
|
||||||
void LogsFlush();
|
|
||||||
|
|||||||
@@ -7286,6 +7286,11 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
// guard against malformed config files with leading spaces
|
// guard against malformed config files with leading spaces
|
||||||
inputline.erase( 0, inputline.find_first_not_of( ' ' ) );
|
inputline.erase( 0, inputline.find_first_not_of( ' ' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// trim CR at end (mainly for linux)
|
||||||
|
if (!inputline.empty() && inputline.back() == '\r')
|
||||||
|
inputline.pop_back();
|
||||||
|
|
||||||
if( inputline.length() == 0 ) {
|
if( inputline.length() == 0 ) {
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -1002,14 +1002,14 @@ void TTrain::OnCommand_independentbrakebailoff( TTrain *Train, command_data cons
|
|||||||
|
|
||||||
void TTrain::OnCommand_trainbrakeincrease( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_trainbrakeincrease( TTrain *Train, command_data const &Command ) {
|
||||||
if (Command.action == GLFW_REPEAT && Train->mvOccupied->BrakeHandle == TBrakeHandle::FV4a)
|
if (Command.action == GLFW_REPEAT && Train->mvOccupied->BrakeHandle == TBrakeHandle::FV4a)
|
||||||
Train->mvOccupied->BrakeLevelAdd( Global.brake_speed * Command.time_delta );
|
Train->mvOccupied->BrakeLevelAdd( Global.brake_speed * Command.time_delta * Train->mvOccupied->BrakeCtrlPosNo );
|
||||||
else if (Command.action == GLFW_PRESS && Train->mvOccupied->BrakeHandle != TBrakeHandle::FV4a)
|
else if (Command.action == GLFW_PRESS && Train->mvOccupied->BrakeHandle != TBrakeHandle::FV4a)
|
||||||
Train->set_train_brake( Train->mvOccupied->fBrakeCtrlPos + Global.fBrakeStep );
|
Train->set_train_brake( Train->mvOccupied->fBrakeCtrlPos + Global.fBrakeStep );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTrain::OnCommand_trainbrakedecrease( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_trainbrakedecrease( TTrain *Train, command_data const &Command ) {
|
||||||
if (Command.action == GLFW_REPEAT && Train->mvOccupied->BrakeHandle == TBrakeHandle::FV4a)
|
if (Command.action == GLFW_REPEAT && Train->mvOccupied->BrakeHandle == TBrakeHandle::FV4a)
|
||||||
Train->mvOccupied->BrakeLevelAdd( -Global.brake_speed * Command.time_delta );
|
Train->mvOccupied->BrakeLevelAdd( -Global.brake_speed * Command.time_delta * Train->mvOccupied->BrakeCtrlPosNo );
|
||||||
else if (Command.action == GLFW_PRESS && Train->mvOccupied->BrakeHandle != TBrakeHandle::FV4a)
|
else if (Command.action == GLFW_PRESS && Train->mvOccupied->BrakeHandle != TBrakeHandle::FV4a)
|
||||||
Train->set_train_brake( Train->mvOccupied->fBrakeCtrlPos - Global.fBrakeStep );
|
Train->set_train_brake( Train->mvOccupied->fBrakeCtrlPos - Global.fBrakeStep );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user