mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 00:49:19 +02:00
reformat: remove redundant parentheses
This commit is contained in:
@@ -446,13 +446,13 @@ void eu07_application::queue_quit(bool direct)
|
||||
bool eu07_application::is_server() const
|
||||
{
|
||||
|
||||
return (m_network && m_network->servers);
|
||||
return m_network && m_network->servers;
|
||||
}
|
||||
|
||||
bool eu07_application::is_client() const
|
||||
{
|
||||
|
||||
return (m_network && m_network->client);
|
||||
return m_network && m_network->client;
|
||||
}
|
||||
|
||||
int eu07_application::run()
|
||||
@@ -649,7 +649,7 @@ bool eu07_application::request(python_taskqueue::task_request const &Task)
|
||||
{
|
||||
|
||||
auto const result{m_taskqueue.insert(Task)};
|
||||
if ((false == result) && (Task.input != nullptr))
|
||||
if (false == result && Task.input != nullptr)
|
||||
{
|
||||
// clean up allocated resources since the worker won't
|
||||
}
|
||||
@@ -913,7 +913,7 @@ GLFWwindow *eu07_application::window(int const Windowindex, bool visible, int wi
|
||||
|
||||
if (Windowindex >= 0)
|
||||
{
|
||||
return (Windowindex < m_windows.size() ? m_windows[Windowindex] : nullptr);
|
||||
return Windowindex < m_windows.size() ? m_windows[Windowindex] : nullptr;
|
||||
}
|
||||
// for index -1 create a new child window
|
||||
|
||||
@@ -1005,7 +1005,7 @@ void eu07_application::init_console()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
HWND consoleWnd = ::GetConsoleWindow();
|
||||
const bool hadConsole = (consoleWnd != nullptr);
|
||||
const bool hadConsole = consoleWnd != nullptr;
|
||||
|
||||
if (Global.ShowSystemConsole)
|
||||
{
|
||||
@@ -1279,7 +1279,7 @@ int eu07_application::init_glfw()
|
||||
Global.bFullScreen = true;
|
||||
}
|
||||
|
||||
auto *mainwindow = window(-1, true, Global.window_size.x, Global.window_size.y, (Global.bFullScreen ? monitor : nullptr), true, false);
|
||||
auto *mainwindow = window(-1, true, Global.window_size.x, Global.window_size.y, Global.bFullScreen ? monitor : nullptr, true, false);
|
||||
|
||||
if (mainwindow == nullptr)
|
||||
{
|
||||
@@ -1480,7 +1480,7 @@ bool eu07_application::init_network()
|
||||
tmp = std::gmtime(&utc_now);
|
||||
memcpy(&tm_utc, tmp, sizeof(tm));
|
||||
|
||||
int64_t offset = (tm_local.tm_hour * 3600 + tm_local.tm_min * 60 + tm_local.tm_sec) - (tm_utc.tm_hour * 3600 + tm_utc.tm_min * 60 + tm_utc.tm_sec);
|
||||
int64_t offset = tm_local.tm_hour * 3600 + tm_local.tm_min * 60 + tm_local.tm_sec - (tm_utc.tm_hour * 3600 + tm_utc.tm_min * 60 + tm_utc.tm_sec);
|
||||
|
||||
Global.starting_timestamp = utc_now + offset;
|
||||
Global.ready_to_load = true;
|
||||
|
||||
@@ -31,7 +31,7 @@ TController::update_hints() {
|
||||
|
||||
m_hints.remove_if(
|
||||
[]( auto const &Hint ) {
|
||||
return ( std::get<hintpredicate>( Hint )( std::get<float>( Hint ) ) ); } );
|
||||
return std::get<hintpredicate>(Hint)(std::get<float>(Hint)); } );
|
||||
}
|
||||
|
||||
void
|
||||
@@ -39,7 +39,7 @@ TController::remove_hint( driver_hint const Value ) {
|
||||
|
||||
m_hints.remove_if(
|
||||
[=]( auto const &Hint ) {
|
||||
return ( std::get<driver_hint>( Hint ) == Value ); } );
|
||||
return std::get<driver_hint>(Hint) == Value; } );
|
||||
}
|
||||
|
||||
void
|
||||
@@ -88,7 +88,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ( mvOccupied->BatteryStart != start_t::manual ) || ( mvOccupied->Power24vIsAvailable == true ) ); } );
|
||||
return mvOccupied->BatteryStart != start_t::manual || mvOccupied->Power24vIsAvailable == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::batteryoff: {
|
||||
@@ -99,7 +99,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ( mvOccupied->BatteryStart != start_t::manual ) || ( mvOccupied->Power24vIsAvailable == false ) ); } );
|
||||
return mvOccupied->BatteryStart != start_t::manual || mvOccupied->Power24vIsAvailable == false; } );
|
||||
break;
|
||||
}
|
||||
// battery
|
||||
@@ -112,7 +112,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ( mvOccupied->AutomaticCabActivation ) || ( mvOccupied->IsCabMaster() ) ); } );
|
||||
return mvOccupied->AutomaticCabActivation || mvOccupied->IsCabMaster(); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::cabdeactivation: {
|
||||
@@ -123,7 +123,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ( mvOccupied->AutomaticCabActivation ) || ( ( mvOccupied->CabMaster == false ) && ( mvOccupied->CabActive == 0 ) ) ); } );
|
||||
return mvOccupied->AutomaticCabActivation || (mvOccupied->CabMaster == false && mvOccupied->CabActive == 0); } );
|
||||
break;
|
||||
}
|
||||
// radio
|
||||
@@ -135,7 +135,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( mvOccupied->Radio == true ); } );
|
||||
return mvOccupied->Radio == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::radiochannel: {
|
||||
@@ -145,7 +145,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( iRadioChannel == static_cast<int>( Parameter ) ); },
|
||||
return iRadioChannel == static_cast<int>(Parameter); },
|
||||
Actionparameter );
|
||||
break;
|
||||
}
|
||||
@@ -157,7 +157,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( mvOccupied->Radio == false ); } );
|
||||
return mvOccupied->Radio == false; } );
|
||||
break;
|
||||
}
|
||||
// oil pump
|
||||
@@ -170,7 +170,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
auto const &device { mvOccupied->OilPump };
|
||||
return ( ( device.start_type != start_t::manual ) || ( device.is_enabled == true ) || ( device.is_active == true ) || ( mvOccupied->Mains ) ); } );
|
||||
return device.start_type != start_t::manual || device.is_enabled == true || device.is_active == true || mvOccupied->Mains; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::oilpumpoff: {
|
||||
@@ -182,7 +182,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
auto const &device { mvOccupied->OilPump };
|
||||
return ( ( device.start_type != start_t::manual ) || ( ( device.is_enabled == false ) && ( device.is_active == false ) ) ); } );
|
||||
return device.start_type != start_t::manual || (device.is_enabled == false && device.is_active == false); } );
|
||||
break;
|
||||
}
|
||||
// fuel pump
|
||||
@@ -195,7 +195,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
auto const &device { mvOccupied->FuelPump };
|
||||
return ( ( device.start_type != start_t::manual ) || ( device.is_enabled == true ) || ( device.is_active == true ) ); } );
|
||||
return device.start_type != start_t::manual || device.is_enabled == true || device.is_active == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::fuelpumpoff: {
|
||||
@@ -207,7 +207,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
auto const &device { mvOccupied->FuelPump };
|
||||
return ( ( device.start_type != start_t::manual ) || ( ( device.is_enabled == false ) && ( device.is_active == false ) ) ); } );
|
||||
return device.start_type != start_t::manual || (device.is_enabled == false && device.is_active == false); } );
|
||||
break;
|
||||
}
|
||||
// pantographs
|
||||
@@ -219,7 +219,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( mvPantographUnit->bPantKurek3 == true ); } );
|
||||
return mvPantographUnit->bPantKurek3 == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::pantographairsourcesetauxiliary: {
|
||||
@@ -230,7 +230,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( mvPantographUnit->bPantKurek3 == false ); } );
|
||||
return mvPantographUnit->bPantKurek3 == false; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::pantographcompressoron: {
|
||||
@@ -241,7 +241,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( mvPantographUnit->PantCompFlag == true ); } );
|
||||
return mvPantographUnit->PantCompFlag == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::pantographcompressoroff: {
|
||||
@@ -252,7 +252,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( mvPantographUnit->PantCompFlag == false ); } );
|
||||
return mvPantographUnit->PantCompFlag == false; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::pantographsvalveon: {
|
||||
@@ -263,7 +263,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( mvPantographUnit->PantsValve.is_active == true ); } );
|
||||
return mvPantographUnit->PantsValve.is_active == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::frontpantographvalveon: {
|
||||
@@ -274,7 +274,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[ this ]( float const Parameter ) -> bool {
|
||||
return ( ( mvPantographUnit->Pantographs[ end::front ].valve.is_active == true ) || ( ( Parameter > 0 ) && ( mvOccupied->Vel > Parameter ) ) ); },
|
||||
return mvPantographUnit->Pantographs[end::front].valve.is_active == true || (Parameter > 0 && mvOccupied->Vel > Parameter); },
|
||||
Actionparameter );
|
||||
break;
|
||||
}
|
||||
@@ -286,7 +286,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( mvPantographUnit->Pantographs[ end::front ].valve.is_active == false ); } );
|
||||
return mvPantographUnit->Pantographs[end::front].valve.is_active == false; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::rearpantographvalveon: {
|
||||
@@ -297,7 +297,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[ this ]( float const Parameter ) -> bool {
|
||||
return ( ( mvPantographUnit->Pantographs[ end::rear ].valve.is_active == true ) || ( ( Parameter > 0 ) && ( mvOccupied->Vel > Parameter ) ) ); },
|
||||
return mvPantographUnit->Pantographs[end::rear].valve.is_active == true || (Parameter > 0 && mvOccupied->Vel > Parameter); },
|
||||
Actionparameter );
|
||||
break;
|
||||
}
|
||||
@@ -309,7 +309,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( mvPantographUnit->Pantographs[ end::rear ].valve.is_active == false ); } );
|
||||
return mvPantographUnit->Pantographs[end::rear].valve.is_active == false; } );
|
||||
break;
|
||||
}
|
||||
// converter
|
||||
@@ -321,7 +321,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( IsAnyConverterEnabled == true ); } );
|
||||
return IsAnyConverterEnabled == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::converteroff: {
|
||||
@@ -332,7 +332,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( IsAnyConverterExplicitlyEnabled == false ); } );
|
||||
return IsAnyConverterExplicitlyEnabled == false; } );
|
||||
break;
|
||||
}
|
||||
// relays
|
||||
@@ -343,7 +343,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ( mvOccupied->ConverterOverloadRelayStart != start_t::manual ) || ( mvOccupied->ConvOvldFlag == false ) ); } );
|
||||
return mvOccupied->ConverterOverloadRelayStart != start_t::manual || mvOccupied->ConvOvldFlag == false; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::maincircuitgroundreset: {
|
||||
@@ -353,7 +353,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ( mvOccupied->GroundRelayStart != start_t::manual ) || ( mvOccupied->GroundRelay == true ) ); } );
|
||||
return mvOccupied->GroundRelayStart != start_t::manual || mvOccupied->GroundRelay == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::tractionnmotoroverloadreset: {
|
||||
@@ -363,7 +363,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( mvOccupied->FuseFlag == false ); } );
|
||||
return mvOccupied->FuseFlag == false; } );
|
||||
break;
|
||||
}
|
||||
// line breaker
|
||||
@@ -375,7 +375,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( IsAnyLineBreakerOpen == false ); } );
|
||||
return IsAnyLineBreakerOpen == false; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::linebreakeropen: {
|
||||
@@ -387,7 +387,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
// TBD, TODO: replace with consist-wide flag set true if any line breaker is closed?
|
||||
return ( mvControlling->Mains == false ); } );
|
||||
return mvControlling->Mains == false; } );
|
||||
break;
|
||||
}
|
||||
// compressor
|
||||
@@ -399,7 +399,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( IsAnyCompressorEnabled == true ); } );
|
||||
return IsAnyCompressorEnabled == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::compressoroff: {
|
||||
@@ -410,7 +410,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( IsAnyCompressorExplicitlyEnabled == false ); } );
|
||||
return IsAnyCompressorExplicitlyEnabled == false; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::frontmotorblowerson: {
|
||||
@@ -423,7 +423,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this]( float const Parameter ) -> bool {
|
||||
auto const &device { mvOccupied->MotorBlowers[ end::front ] };
|
||||
return ( ( device.start_type != start_t::manual ) || ( ( device.is_enabled == true ) && ( device.is_disabled == false ) ) ); } );
|
||||
return device.start_type != start_t::manual || (device.is_enabled == true && device.is_disabled == false); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::rearmotorblowerson: {
|
||||
@@ -436,7 +436,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this]( float const Parameter ) -> bool {
|
||||
auto const &device { mvOccupied->MotorBlowers[ end::rear ] };
|
||||
return ( ( device.start_type != start_t::manual ) || ( ( device.is_enabled == true ) && ( device.is_disabled == false ) ) ); } );
|
||||
return device.start_type != start_t::manual || (device.is_enabled == true && device.is_disabled == false); } );
|
||||
break;
|
||||
}
|
||||
// spring brake
|
||||
@@ -448,7 +448,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this]( float const Parameter ) -> bool {
|
||||
return ( mvOccupied->SpringBrake.Activate == true ); } );
|
||||
return mvOccupied->SpringBrake.Activate == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::springbrakeoff: {
|
||||
@@ -459,7 +459,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this]( float const Parameter ) -> bool {
|
||||
return ( mvOccupied->SpringBrake.Activate == false ); } );
|
||||
return mvOccupied->SpringBrake.Activate == false; } );
|
||||
break;
|
||||
}
|
||||
// manual brake
|
||||
@@ -471,7 +471,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this]( float const Parameter ) -> bool {
|
||||
return ( ( mvOccupied->LocalBrake != TLocalBrake::ManualBrake ) || ( mvOccupied->MBrake == false ) || ( mvOccupied->ManualBrakePos == ManualBrakePosNo ) ); } );
|
||||
return mvOccupied->LocalBrake != TLocalBrake::ManualBrake || mvOccupied->MBrake == false || mvOccupied->ManualBrakePos == ManualBrakePosNo; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::manualbrakoff: {
|
||||
@@ -482,14 +482,14 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this]( float const Parameter ) -> bool {
|
||||
return ( ( mvOccupied->LocalBrake != TLocalBrake::ManualBrake ) || ( mvOccupied->MBrake == false ) || ( mvOccupied->ManualBrakePos == 0 ) ); } );
|
||||
return mvOccupied->LocalBrake != TLocalBrake::ManualBrake || mvOccupied->MBrake == false || mvOccupied->ManualBrakePos == 0; } );
|
||||
break;
|
||||
}
|
||||
// master controller
|
||||
case driver_hint::mastercontrollersetidle: {
|
||||
if( AIControllFlag ) {
|
||||
while( ( mvControlling->RList[ mvControlling->MainCtrlPos ].Mn == 0 )
|
||||
&& ( mvControlling->IncMainCtrl( 1 ) ) ) {
|
||||
while( mvControlling->RList[mvControlling->MainCtrlPos].Mn == 0
|
||||
&& mvControlling->IncMainCtrl(1) ) {
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -497,7 +497,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this]( float const Parameter ) -> bool {
|
||||
return ( mvControlling->RList[ mvControlling->MainCtrlPos ].Mn > 0 ); } );
|
||||
return mvControlling->RList[mvControlling->MainCtrlPos].Mn > 0; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::mastercontrollersetseriesmode: {
|
||||
@@ -507,8 +507,8 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
if( mvControlling->ScndCtrlPos ) {
|
||||
mvControlling->DecScndCtrl( 2 );
|
||||
}
|
||||
while( ( mvControlling->RList[ mvControlling->MainCtrlPos ].Bn > 1 )
|
||||
&& ( mvControlling->DecMainCtrl( 1 ) ) ) {
|
||||
while( mvControlling->RList[mvControlling->MainCtrlPos].Bn > 1
|
||||
&& mvControlling->DecMainCtrl(1) ) {
|
||||
; // all work is performed in the header
|
||||
}
|
||||
}
|
||||
@@ -517,7 +517,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this]( float const Parameter ) -> bool {
|
||||
return ( mvControlling->RList[ mvControlling->MainCtrlPos ].Bn < 2 ); } );
|
||||
return mvControlling->RList[mvControlling->MainCtrlPos].Bn < 2; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::mastercontrollersetzerospeed: {
|
||||
@@ -528,13 +528,13 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ( mvControlling->IsMainCtrlNoPowerPos() ) && ( mvControlling->IsScndCtrlNoPowerPos() ) ); } );
|
||||
return mvControlling->IsMainCtrlNoPowerPos() && mvControlling->IsScndCtrlNoPowerPos(); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::mastercontrollersetreverserunlock: {
|
||||
if( AIControllFlag ) {
|
||||
while( ( false == mvControlling->EIMDirectionChangeAllow() )
|
||||
&& ( mvControlling->DecMainCtrl( 1 ) ) ) {
|
||||
while( false == mvControlling->EIMDirectionChangeAllow()
|
||||
&& mvControlling->DecMainCtrl(1) ) {
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -542,7 +542,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( mvControlling->EIMDirectionChangeAllow() ); },
|
||||
return mvControlling->EIMDirectionChangeAllow(); },
|
||||
mvControlling->MainCtrlMaxDirChangePos );
|
||||
break;
|
||||
}
|
||||
@@ -554,7 +554,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( std::abs( mvControlling->Ft ) <= Parameter ); },
|
||||
return std::abs(mvControlling->Ft) <= Parameter; },
|
||||
std::min(
|
||||
0.0,
|
||||
std::max(
|
||||
@@ -576,12 +576,8 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ( AccDesired <= EU07_AI_NOACCELERATION )
|
||||
|| ( ( false == Ready ) && ( false == mvOccupied->ShuntMode ) )
|
||||
|| ( AccDesired - AbsAccS <= 0.05 )
|
||||
|| ( mvOccupied->EIMCtrlType > 0 ?
|
||||
( mvControlling->eimic_real >= 1.0 ) :
|
||||
( ( mvControlling->IsScndCtrlMaxPowerPos() ) && ( mvControlling->IsMainCtrlMaxPowerPos() ) ) ) ); } );
|
||||
return AccDesired <= EU07_AI_NOACCELERATION || (false == Ready && false == mvOccupied->ShuntMode) || AccDesired - AbsAccS <= 0.05 ||
|
||||
(mvOccupied->EIMCtrlType > 0 ? mvControlling->eimic_real >= 1.0 : mvControlling->IsScndCtrlMaxPowerPos() && mvControlling->IsMainCtrlMaxPowerPos()); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::bufferscompress: {
|
||||
@@ -594,7 +590,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ( std::abs( mvControlling->Ft ) > 30.0 ) || ( ( OrderCurrentGet() & Disconnect ) == 0 ) ); } );
|
||||
return std::abs(mvControlling->Ft) > 30.0 || (OrderCurrentGet() & Disconnect) == 0; } );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -606,7 +602,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( mvControlling->IsScndCtrlNoPowerPos() ); } );
|
||||
return mvControlling->IsScndCtrlNoPowerPos(); } );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -619,7 +615,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
auto const &device { mvControlling->WaterPump };
|
||||
return ( ( device.start_type != start_t::manual ) || ( ( device.is_enabled == true ) && ( device.is_disabled == false ) ) || ( device.is_active == true ) ); } );
|
||||
return device.start_type != start_t::manual || (device.is_enabled == true && device.is_disabled == false) || device.is_active == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::waterpumpoff: {
|
||||
@@ -631,7 +627,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
auto const &device { mvControlling->WaterPump };
|
||||
return ( ( device.start_type != start_t::manual ) || ( ( device.is_enabled == false ) && ( device.is_active == false ) ) ); } );
|
||||
return device.start_type != start_t::manual || (device.is_enabled == false && device.is_active == false); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::waterpumpbreakeron: {
|
||||
@@ -643,7 +639,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
auto const &device { mvControlling->WaterPump };
|
||||
return ( device.breaker == true ); } );
|
||||
return device.breaker == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::waterpumpbreakeroff: {
|
||||
@@ -655,7 +651,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
auto const &device { mvControlling->WaterPump };
|
||||
return ( device.breaker == false ); } );
|
||||
return device.breaker == false; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::waterheateron: {
|
||||
@@ -667,7 +663,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
auto const &device { mvControlling->WaterHeater };
|
||||
return ( device.is_enabled == true ); } );
|
||||
return device.is_enabled == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::waterheateroff: {
|
||||
@@ -679,7 +675,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
auto const &device { mvControlling->WaterHeater };
|
||||
return ( device.is_enabled == false ); } );
|
||||
return device.is_enabled == false; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::waterheaterbreakeron: {
|
||||
@@ -691,7 +687,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
auto const &device { mvControlling->WaterHeater };
|
||||
return ( device.breaker == true ); } );
|
||||
return device.breaker == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::waterheaterbreakeroff: {
|
||||
@@ -703,7 +699,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
auto const &device { mvControlling->WaterHeater };
|
||||
return ( device.breaker == false ); } );
|
||||
return device.breaker == false; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::watercircuitslinkon: {
|
||||
@@ -714,7 +710,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ( mvControlling->dizel_heat.auxiliary_water_circuit == false ) || ( mvControlling->WaterCircuitsLink == true ) ); } );
|
||||
return mvControlling->dizel_heat.auxiliary_water_circuit == false || mvControlling->WaterCircuitsLink == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::watercircuitslinkoff: {
|
||||
@@ -725,7 +721,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ( mvControlling->dizel_heat.auxiliary_water_circuit == false ) || ( mvControlling->WaterCircuitsLink == false ) ); } );
|
||||
return mvControlling->dizel_heat.auxiliary_water_circuit == false || mvControlling->WaterCircuitsLink == false; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::waittemperaturetoolow: {
|
||||
@@ -733,7 +729,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( false == IsHeatingTemperatureTooLow ); } );
|
||||
return false == IsHeatingTemperatureTooLow; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::waitpressuretoolow: {
|
||||
@@ -741,7 +737,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ( mvControlling->ScndPipePress > 4.5 ) || ( mvControlling->VeselVolume == 0.0 ) ); } );
|
||||
return mvControlling->ScndPipePress > 4.5 || mvControlling->VeselVolume == 0.0; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::waitpantographpressuretoolow: {
|
||||
@@ -749,7 +745,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( mvPantographUnit->PantPress >= ( is_emu() ? ( mvPantographUnit->PantPressLockActive ? 4.6 : 2.6 ) : 4.2 ) ); } );
|
||||
return mvPantographUnit->PantPress >= (is_emu() ? (mvPantographUnit->PantPressLockActive ? 4.6 : 2.6) : 4.2); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::waitloadexchange: {
|
||||
@@ -757,7 +753,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ExchangeTime <= 0 ); } );
|
||||
return ExchangeTime <= 0; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::waitdeparturetime: {
|
||||
@@ -765,7 +761,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( IsAtPassengerStop == false ); } );
|
||||
return IsAtPassengerStop == false; } );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -779,8 +775,8 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
case driver_hint::trainbrakesetpipeunlock: {
|
||||
if( AIControllFlag ) {
|
||||
if( mvOccupied->HandleUnlock != -3 ) {
|
||||
while( ( BrakeCtrlPosition >= mvOccupied->HandleUnlock )
|
||||
&& ( BrakeLevelAdd( -1 ) ) ) {
|
||||
while( BrakeCtrlPosition >= mvOccupied->HandleUnlock
|
||||
&& BrakeLevelAdd(-1) ) {
|
||||
// all work is done in the header
|
||||
;
|
||||
}
|
||||
@@ -790,7 +786,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ( mvOccupied->HandleUnlock == -3 ) || ( BrakeCtrlPosition == mvOccupied->HandleUnlock ) ); } );
|
||||
return mvOccupied->HandleUnlock == -3 || BrakeCtrlPosition == mvOccupied->HandleUnlock; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::trainbrakerelease: {
|
||||
@@ -802,15 +798,14 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( is_equal( mvOccupied->fBrakeCtrlPos, mvOccupied->Handle->GetPos( bh_RP ), 0.2 )
|
||||
|| ( mvOccupied->Handle->Time && ( mvOccupied->Handle->GetCP() > mvOccupied->HighPipePress - 0.05) ) ); } );
|
||||
return is_equal(mvOccupied->fBrakeCtrlPos, mvOccupied->Handle->GetPos(bh_RP), 0.2) || (mvOccupied->Handle->Time && mvOccupied->Handle->GetCP() > mvOccupied->HighPipePress - 0.05); } );
|
||||
// return ( BrakeCtrlPosition == gbh_RP ); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::trainbrakeapply: {
|
||||
if( AIControllFlag ) {
|
||||
// za radą yB ustawiamy pozycję 3 kranu (ruszanie kranem w innych miejscach powino zostać wyłączone)
|
||||
if( ( BrakeSystem == TBrakeSystem::ElectroPneumatic ) && ( false == ForcePNBrake ) ) {
|
||||
if( BrakeSystem == TBrakeSystem::ElectroPneumatic && false == ForcePNBrake ) {
|
||||
mvOccupied->BrakeLevelSet( mvOccupied->Handle->GetPos( bh_EPB ) );
|
||||
}
|
||||
else {
|
||||
@@ -821,14 +816,14 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( IsConsistBraked /*|| ( ( OrderCurrentGet() & Disconnect ) == 0 ) */ ); } );
|
||||
return IsConsistBraked /*|| ( ( OrderCurrentGet() & Disconnect ) == 0 ) */; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::brakingforcedecrease: {
|
||||
if( AIControllFlag ) {
|
||||
auto const brakingcontrolschange { DecBrake() };
|
||||
// set optional delay between brake adjustments
|
||||
if( ( brakingcontrolschange ) && ( Actionparameter > 0 ) ) {
|
||||
if( brakingcontrolschange && Actionparameter > 0 ) {
|
||||
fBrakeTime = Actionparameter;
|
||||
}
|
||||
}
|
||||
@@ -836,7 +831,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( std::abs( mvControlling->Fb ) <= Parameter ); },
|
||||
return std::abs(mvControlling->Fb) <= Parameter; },
|
||||
std::min( 0.0, 0.95 * std::abs( mvControlling->Fb ) ) ); // keep hint until 5% decrease
|
||||
break;
|
||||
}
|
||||
@@ -844,7 +839,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
if( AIControllFlag ) {
|
||||
auto const brakingcontrolschange { IncBrake() };
|
||||
// set optional delay between brake adjustments
|
||||
if( ( brakingcontrolschange ) && ( Actionparameter > 0 ) ) {
|
||||
if( brakingcontrolschange && Actionparameter > 0 ) {
|
||||
fBrakeTime = Actionparameter;
|
||||
}
|
||||
}
|
||||
@@ -852,7 +847,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ( std::abs( mvControlling->Fb ) > Parameter ) || ( is_equal( mvOccupied->fBrakeCtrlPos, mvOccupied->Handle->GetPos( bh_EB ), 0.2 ) ) ); },
|
||||
return std::abs(mvControlling->Fb) > Parameter || is_equal(mvOccupied->fBrakeCtrlPos, mvOccupied->Handle->GetPos(bh_EB), 0.2); },
|
||||
std::max(
|
||||
0.0,
|
||||
std::max(
|
||||
@@ -868,7 +863,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ( Ready ) && ( fReady < 0.4 ) && ( is_equal( mvOccupied->fBrakeCtrlPos, mvOccupied->Handle->GetPos( bh_RP ), 0.2 ) ) ); } );
|
||||
return Ready && fReady < 0.4 && is_equal(mvOccupied->fBrakeCtrlPos, mvOccupied->Handle->GetPos(bh_RP), 0.2); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::brakingforcelap: {
|
||||
@@ -894,7 +889,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( mvOccupied->LocalBrakePosA >= Parameter ); },
|
||||
return mvOccupied->LocalBrakePosA >= Parameter; },
|
||||
( LocalBrakePosNo - ( mvOccupied->EIMCtrlEmergency ? 1 : 0 ) ) / LocalBrakePosNo );
|
||||
break;
|
||||
}
|
||||
@@ -906,7 +901,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( mvOccupied->LocalBrakePosA < 0.05 ); } );
|
||||
return mvOccupied->LocalBrakePosA < 0.05; } );
|
||||
break;
|
||||
}
|
||||
// reverser
|
||||
@@ -918,7 +913,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( mvOccupied->DirActive * mvOccupied->CabActive > 0 ); } );
|
||||
return mvOccupied->DirActive * mvOccupied->CabActive > 0; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::directionbackward: {
|
||||
@@ -929,7 +924,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( mvOccupied->DirActive * mvOccupied->CabActive < 0 ); } );
|
||||
return mvOccupied->DirActive * mvOccupied->CabActive < 0; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::directionother: {
|
||||
@@ -942,7 +937,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( iDirection == iDirectionOrder ); } );
|
||||
return iDirection == iDirectionOrder; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::directionnone: {
|
||||
@@ -953,7 +948,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( mvOccupied->DirActive == 0 ); } );
|
||||
return mvOccupied->DirActive == 0; } );
|
||||
break;
|
||||
}
|
||||
// anti-slip systems
|
||||
@@ -965,7 +960,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ( mvControlling->Sand == 0 ) || ( mvControlling->SandDose == true ) || ( mvControlling->SlippingWheels == false ) ); } );
|
||||
return mvControlling->Sand == 0 || mvControlling->SandDose == true || mvControlling->SlippingWheels == false; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::sandingoff: {
|
||||
@@ -976,7 +971,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ( mvControlling->Sand == 0 ) || ( mvControlling->SandDose == false ) ); } );
|
||||
return mvControlling->Sand == 0 || mvControlling->SandDose == false; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::antislip: {
|
||||
@@ -986,7 +981,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ( mvControlling->ASBType != 1 ) || ( ( mvControlling->Hamulec->GetBrakeStatus() & b_asb ) != 0 ) || ( mvControlling->SlippingWheels == false ) ); } );
|
||||
return mvControlling->ASBType != 1 || (mvControlling->Hamulec->GetBrakeStatus() & b_asb) != 0 || mvControlling->SlippingWheels == false; } );
|
||||
break;
|
||||
}
|
||||
// horns
|
||||
@@ -999,7 +994,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
// NOTE: we provide slightly larger horn activation window for human driver
|
||||
return ( ( fWarningDuration + 5.0 < 0.05 ) || ( mvOccupied->WarningSignal != 0 ) ); } );
|
||||
return fWarningDuration + 5.0 < 0.05 || mvOccupied->WarningSignal != 0; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::hornoff: {
|
||||
@@ -1025,7 +1020,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ( mvOccupied->Doors.has_lock == false ) || ( mvOccupied->Doors.lock_enabled == true ) ); } );
|
||||
return mvOccupied->Doors.has_lock == false || mvOccupied->Doors.lock_enabled == true; } );
|
||||
break;
|
||||
}
|
||||
// departure signal
|
||||
@@ -1037,7 +1032,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ( mvOccupied->Doors.has_warning == false ) || ( mvOccupied->Doors.has_autowarning == true ) || ( mvOccupied->DepartureSignal == true ) || mvOccupied->Vel > 5.0 ); } );
|
||||
return mvOccupied->Doors.has_warning == false || mvOccupied->Doors.has_autowarning == true || mvOccupied->DepartureSignal == true || mvOccupied->Vel > 5.0; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::departuresignaloff: {
|
||||
@@ -1048,56 +1043,56 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( ( mvOccupied->Doors.has_warning == false ) || ( mvOccupied->Doors.has_autowarning == true ) || ( mvOccupied->DepartureSignal == false ) ); } );
|
||||
return mvOccupied->Doors.has_warning == false || mvOccupied->Doors.has_autowarning == true || mvOccupied->DepartureSignal == false; } );
|
||||
break;
|
||||
}
|
||||
// consist doors
|
||||
case driver_hint::doorrightopen: {
|
||||
if( ( AIControllFlag )
|
||||
|| ( pVehicle->MoverParameters->Doors.open_control == control_t::conductor ) ) {
|
||||
if( AIControllFlag
|
||||
|| pVehicle->MoverParameters->Doors.open_control == control_t::conductor ) {
|
||||
pVehicle->MoverParameters->OperateDoors( side::right, true );
|
||||
}
|
||||
remove_hint( driver_hint::doorrightclose );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( IsAnyDoorOpen[ side::right ] == true ); } );
|
||||
return IsAnyDoorOpen[side::right] == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::doorrightclose: {
|
||||
if( ( AIControllFlag )
|
||||
|| ( pVehicle->MoverParameters->Doors.open_control == control_t::conductor ) ) {
|
||||
if( AIControllFlag
|
||||
|| pVehicle->MoverParameters->Doors.open_control == control_t::conductor ) {
|
||||
pVehicle->MoverParameters->OperateDoors( side::right, false );
|
||||
}
|
||||
remove_hint( driver_hint::doorrightopen );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( IsAnyDoorOpen[ side::right ] == false ); } );
|
||||
return IsAnyDoorOpen[side::right] == false; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::doorleftopen: {
|
||||
if( ( AIControllFlag )
|
||||
|| ( pVehicle->MoverParameters->Doors.open_control == control_t::conductor ) ) {
|
||||
if( AIControllFlag
|
||||
|| pVehicle->MoverParameters->Doors.open_control == control_t::conductor ) {
|
||||
pVehicle->MoverParameters->OperateDoors( side::left, true );
|
||||
}
|
||||
remove_hint( driver_hint::doorleftclose );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( IsAnyDoorOpen[ side::left ] == true ); } );
|
||||
return IsAnyDoorOpen[side::left] == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::doorleftclose: {
|
||||
if( ( AIControllFlag )
|
||||
|| ( pVehicle->MoverParameters->Doors.open_control == control_t::conductor ) ) {
|
||||
if( AIControllFlag
|
||||
|| pVehicle->MoverParameters->Doors.open_control == control_t::conductor ) {
|
||||
pVehicle->MoverParameters->OperateDoors( side::left, false );
|
||||
}
|
||||
remove_hint( driver_hint::doorleftopen );
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( IsAnyDoorOpen[ side::left ] == false ); } );
|
||||
return IsAnyDoorOpen[side::left] == false; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::doorrightpermiton: {
|
||||
@@ -1108,7 +1103,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( IsAnyDoorPermitActive[ side::right ] == true ); } );
|
||||
return IsAnyDoorPermitActive[side::right] == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::doorrightpermitoff: {
|
||||
@@ -1119,7 +1114,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( IsAnyDoorPermitActive[ side::right ] == false ); } );
|
||||
return IsAnyDoorPermitActive[side::right] == false; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::doorleftpermiton: {
|
||||
@@ -1130,7 +1125,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( IsAnyDoorPermitActive[ side::left ] == true ); } );
|
||||
return IsAnyDoorPermitActive[side::left] == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::doorleftpermitoff: {
|
||||
@@ -1141,7 +1136,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( IsAnyDoorPermitActive[ side::left ] == false ); } );
|
||||
return IsAnyDoorPermitActive[side::left] == false; } );
|
||||
break;
|
||||
}
|
||||
// consist lights
|
||||
@@ -1155,7 +1150,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
auto const &device { mvOccupied->CompartmentLights };
|
||||
return ( ( Global.fLuminance * ConsistShade > 0.40 ) || ( device.start_type != start_t::manual ) || ( ( device.is_enabled == true ) && ( device.is_disabled == false ) ) || ( device.is_active == true ) ); } );
|
||||
return Global.fLuminance * ConsistShade > 0.40 || device.start_type != start_t::manual || (device.is_enabled == true && device.is_disabled == false) || device.is_active == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::consistlightsoff: {
|
||||
@@ -1168,7 +1163,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
auto const &device { mvOccupied->CompartmentLights };
|
||||
return ( ( Global.fLuminance * ConsistShade < 0.35 ) || ( device.start_type != start_t::manual ) || ( ( device.is_enabled == false ) && ( device.is_active == false ) ) ); } );
|
||||
return Global.fLuminance * ConsistShade < 0.35 || device.start_type != start_t::manual || (device.is_enabled == false && device.is_active == false); } );
|
||||
break;
|
||||
}
|
||||
// consist heating
|
||||
@@ -1180,7 +1175,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( mvOccupied->HeatingAllow == true ); } );
|
||||
return mvOccupied->HeatingAllow == true; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::consistheatingoff: {
|
||||
@@ -1191,7 +1186,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( mvOccupied->HeatingAllow == false ); } );
|
||||
return mvOccupied->HeatingAllow == false; } );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1226,7 +1221,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
auto const &device { pVehicles[ end::front ]->MoverParameters->Couplers[ static_cast<int>( Parameter ) ] };
|
||||
return ( device.type() == TCouplerType::Automatic ); } );
|
||||
return device.type() == TCouplerType::Automatic; } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::couplingadapterremove: {
|
||||
@@ -1237,7 +1232,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
auto const &device { pVehicles[ end::front ]->MoverParameters->Couplers[ static_cast<int>( Parameter ) ] };
|
||||
return ( false == device.has_adapter() ); } );
|
||||
return false == device.has_adapter(); } );
|
||||
break;
|
||||
}
|
||||
// lights
|
||||
@@ -1251,7 +1246,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( pVehicles[ end::front ]->has_signal_pc1_on() ); } );
|
||||
return pVehicles[end::front]->has_signal_pc1_on(); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::headcodepc2: {
|
||||
@@ -1264,7 +1259,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( pVehicles[ end::front ]->has_signal_pc2_on() ); } );
|
||||
return pVehicles[end::front]->has_signal_pc2_on(); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::headcodetb1: {
|
||||
@@ -1283,14 +1278,12 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
[this](float const Parameter) -> bool {
|
||||
auto const activeend { mvOccupied->CabActive >= 0 ? end::front : end::rear };
|
||||
auto const consistfront { mvOccupied->DirActive >= 0 ? end::front : end::rear };
|
||||
return (
|
||||
pVehicles[ consistfront ]->has_signal_on( activeend, light::headlight_right )
|
||||
&& pVehicles[ 1 - consistfront ]->has_signal_on( 1 - activeend, light::headlight_left ) ); } );
|
||||
return pVehicles[consistfront]->has_signal_on(activeend, light::headlight_right) && pVehicles[1 - consistfront]->has_signal_on(1 - activeend, light::headlight_left); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::headcodepc5: {
|
||||
if( ( AIControllFlag )
|
||||
|| ( Global.AITrainman && ( false == pVehicles[ end::rear ]->is_connected( pVehicle, coupling::control ) ) ) ) {
|
||||
if( AIControllFlag
|
||||
|| ( Global.AITrainman && false == pVehicles[end::rear]->is_connected(pVehicle, coupling::control) ) ) {
|
||||
pVehicles[ end::rear ]->RaLightsSet( -1, light::redmarker_left | light::redmarker_right | light::rearendsignals );
|
||||
}
|
||||
remove_hint( driver_hint::headcodetb1 );
|
||||
@@ -1298,7 +1291,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( pVehicles[ end::rear ]->has_signal_pc5_on() ); } );
|
||||
return pVehicles[end::rear]->has_signal_pc5_on(); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::lightsoff: {
|
||||
@@ -1314,9 +1307,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
[this](float const Parameter) -> bool {
|
||||
auto const activeend { mvOccupied->CabActive >= 0 ? end::front : end::rear };
|
||||
auto const consistfront { mvOccupied->DirActive >= 0 ? end::front : end::rear };
|
||||
return (
|
||||
pVehicles[ consistfront ]->has_signal_on( activeend, 0 )
|
||||
&& pVehicles[ 1 - consistfront ]->has_signal_on( 1 - activeend, 0 ) ); } );
|
||||
return pVehicles[consistfront]->has_signal_on(activeend, 0) && pVehicles[1 - consistfront]->has_signal_on(1 - activeend, 0); } );
|
||||
break;
|
||||
}
|
||||
// releaser
|
||||
@@ -1328,7 +1319,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( true == mvOccupied->Hamulec->Releaser() ); } );
|
||||
return true == mvOccupied->Hamulec->Releaser(); } );
|
||||
break;
|
||||
}
|
||||
case driver_hint::releaseroff: {
|
||||
@@ -1339,7 +1330,7 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
||||
hint(
|
||||
Action,
|
||||
[this](float const Parameter) -> bool {
|
||||
return ( false == mvOccupied->Hamulec->Releaser() ); } );
|
||||
return false == mvOccupied->Hamulec->Releaser(); } );
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ bool driver_mode::drivermode_input::init()
|
||||
{
|
||||
|
||||
// initialize input devices
|
||||
auto result = (keyboard.init() && mouse.init());
|
||||
auto result = keyboard.init() && mouse.init();
|
||||
if (true == Global.InputGamepad)
|
||||
{
|
||||
gamepad.init();
|
||||
@@ -268,7 +268,7 @@ bool driver_mode::update()
|
||||
}
|
||||
}
|
||||
|
||||
if ((simulation::Train == nullptr) && (false == FreeFlyModeFlag))
|
||||
if (simulation::Train == nullptr && false == FreeFlyModeFlag)
|
||||
{
|
||||
// intercept cases when the driven train got removed after entering portal
|
||||
InOutKey();
|
||||
@@ -344,7 +344,7 @@ bool driver_mode::update()
|
||||
// tooltip update
|
||||
set_tooltip("");
|
||||
auto const *train{simulation::Train};
|
||||
if ((train != nullptr) && (false == FreeFlyModeFlag))
|
||||
if (train != nullptr && false == FreeFlyModeFlag)
|
||||
{
|
||||
if (false == DebugModeFlag)
|
||||
{
|
||||
@@ -378,7 +378,7 @@ bool driver_mode::update()
|
||||
{
|
||||
// in debug mode show names of submodels, to help with cab setup and/or debugging
|
||||
auto const cabcontrol = GfxRenderer->Pick_Control();
|
||||
set_tooltip((cabcontrol ? cabcontrol->pName : ""));
|
||||
set_tooltip(cabcontrol ? cabcontrol->pName : "");
|
||||
}
|
||||
}
|
||||
if (Global.ControlPicking && FreeFlyModeFlag && DebugModeFlag)
|
||||
@@ -410,7 +410,7 @@ bool driver_mode::update()
|
||||
|
||||
GfxRenderer->Update(deltarealtime);
|
||||
|
||||
simulation::is_ready = simulation::is_ready || ((simulation::Train != nullptr) && (simulation::Train->is_cab_initialized)) || (Global.local_start_vehicle == "ghostview");
|
||||
simulation::is_ready = simulation::is_ready || (simulation::Train != nullptr && simulation::Train->is_cab_initialized) || Global.local_start_vehicle == "ghostview";
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -419,7 +419,7 @@ bool driver_mode::update()
|
||||
void driver_mode::enter()
|
||||
{
|
||||
|
||||
TDynamicObject *nPlayerTrain{((Global.local_start_vehicle != "ghostview") ? simulation::Vehicles.find(Global.local_start_vehicle) : nullptr)};
|
||||
TDynamicObject *nPlayerTrain{(Global.local_start_vehicle != "ghostview" ? simulation::Vehicles.find(Global.local_start_vehicle) : nullptr)};
|
||||
|
||||
Camera.Init(Global.FreeCameraInit[0], Global.FreeCameraInitAngle[0], nullptr);
|
||||
Global.pCamera = Camera;
|
||||
@@ -467,9 +467,9 @@ void driver_mode::on_key(int const Key, int const Scancode, int const Action, in
|
||||
{
|
||||
|
||||
#ifndef __unix__
|
||||
Global.shiftState = (Mods & GLFW_MOD_SHIFT) ? true : false;
|
||||
Global.ctrlState = (Mods & GLFW_MOD_CONTROL) ? true : false;
|
||||
Global.altState = (Mods & GLFW_MOD_ALT) ? true : false;
|
||||
Global.shiftState = Mods & GLFW_MOD_SHIFT ? true : false;
|
||||
Global.ctrlState = Mods & GLFW_MOD_CONTROL ? true : false;
|
||||
Global.altState = Mods & GLFW_MOD_ALT ? true : false;
|
||||
#endif
|
||||
|
||||
bool anyModifier = Mods & (GLFW_MOD_SHIFT | GLFW_MOD_CONTROL | GLFW_MOD_ALT);
|
||||
@@ -479,7 +479,7 @@ void driver_mode::on_key(int const Key, int const Scancode, int const Action, in
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (Key == (GLFW_KEY_F12) && Global.shiftState && Action == GLFW_PRESS)
|
||||
if (Key == GLFW_KEY_F12 && Global.shiftState && Action == GLFW_PRESS)
|
||||
{
|
||||
m_userinterface->showDebugUI();
|
||||
return;
|
||||
@@ -490,13 +490,13 @@ void driver_mode::on_key(int const Key, int const Scancode, int const Action, in
|
||||
return;
|
||||
}
|
||||
|
||||
if ((true == Global.InputMouse) && ((Key == GLFW_KEY_LEFT_ALT) || (Key == GLFW_KEY_RIGHT_ALT)))
|
||||
if (true == Global.InputMouse && (Key == GLFW_KEY_LEFT_ALT || Key == GLFW_KEY_RIGHT_ALT))
|
||||
{
|
||||
// if the alt key was pressed toggle control picking mode and set matching cursor behaviour
|
||||
if (Action == GLFW_PRESS)
|
||||
{
|
||||
// toggle picking mode
|
||||
set_picking(Global.shiftState ? true : (Global.ctrlState ? false : !Global.ControlPicking));
|
||||
set_picking(Global.shiftState ? true : Global.ctrlState ? false : !Global.ControlPicking);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -558,7 +558,7 @@ bool driver_mode::is_command_processor() const
|
||||
void driver_mode::update_camera(double const Deltatime)
|
||||
{
|
||||
|
||||
auto *controlled = (simulation::Train ? simulation::Train->Dynamic() : nullptr);
|
||||
auto *controlled = simulation::Train ? simulation::Train->Dynamic() : nullptr;
|
||||
|
||||
if (false == Global.ControlPicking)
|
||||
{
|
||||
@@ -626,7 +626,7 @@ void driver_mode::update_camera(double const Deltatime)
|
||||
if (false == DebugCameraFlag)
|
||||
{
|
||||
// regular camera
|
||||
if ((simulation::Train != nullptr) && (false == FreeFlyModeFlag) && (false == Global.CabWindowOpen))
|
||||
if (simulation::Train != nullptr && false == FreeFlyModeFlag && false == Global.CabWindowOpen)
|
||||
{
|
||||
// if in cab potentially alter camera placement based on changes in train object
|
||||
Camera.m_owneroffset = simulation::Train->pMechOffset;
|
||||
@@ -636,20 +636,20 @@ void driver_mode::update_camera(double const Deltatime)
|
||||
|
||||
Camera.Update();
|
||||
|
||||
if ((simulation::Train != nullptr) && (false == FreeFlyModeFlag))
|
||||
if (simulation::Train != nullptr && false == FreeFlyModeFlag)
|
||||
{
|
||||
// keep the camera within cab boundaries
|
||||
Camera.m_owneroffset = simulation::Train->clamp_inside(Camera.m_owneroffset);
|
||||
}
|
||||
|
||||
if ((simulation::Train != nullptr) && (false == FreeFlyModeFlag) && (false == Global.CabWindowOpen))
|
||||
if (simulation::Train != nullptr && false == FreeFlyModeFlag && false == Global.CabWindowOpen)
|
||||
{
|
||||
// cache cab camera in case of view type switch
|
||||
simulation::Train->pMechViewAngle = {Camera.Angle.x, Camera.Angle.y};
|
||||
simulation::Train->pMechOffset = Camera.m_owneroffset;
|
||||
}
|
||||
|
||||
if ((true == FreeFlyModeFlag) && (Camera.m_owner != nullptr))
|
||||
if (true == FreeFlyModeFlag && Camera.m_owner != nullptr)
|
||||
{
|
||||
// cache external view config
|
||||
auto &externalviewconfig{m_externalviewconfigs[m_externalviewmode]};
|
||||
@@ -667,14 +667,14 @@ void driver_mode::update_camera(double const Deltatime)
|
||||
// reset window state, it'll be set again if applicable in a check below
|
||||
Global.CabWindowOpen = false;
|
||||
|
||||
if ((simulation::Train != nullptr) && (Camera.m_owner != nullptr) && (false == DebugCameraFlag))
|
||||
if (simulation::Train != nullptr && Camera.m_owner != nullptr && false == DebugCameraFlag)
|
||||
{
|
||||
// jeśli jazda w kabinie, przeliczyć trzeba parametry kamery
|
||||
/*
|
||||
auto tempangle = controlled->VectorFront() * ( controlled->MoverParameters->CabOccupied == -1 ? -1 : 1 );
|
||||
double modelrotate = atan2( -tempangle.x, tempangle.z );
|
||||
*/
|
||||
if ((false == FreeFlyModeFlag) && (true == Global.ctrlState) && ((m_input.keyboard.key(GLFW_KEY_LEFT) != GLFW_RELEASE) || (m_input.keyboard.key(GLFW_KEY_RIGHT) != GLFW_RELEASE)))
|
||||
if (false == FreeFlyModeFlag && true == Global.ctrlState && (m_input.keyboard.key(GLFW_KEY_LEFT) != GLFW_RELEASE || m_input.keyboard.key(GLFW_KEY_RIGHT) != GLFW_RELEASE))
|
||||
{
|
||||
// jeśli lusterko lewe albo prawe (bez rzucania na razie)
|
||||
Global.CabWindowOpen = true;
|
||||
@@ -722,8 +722,8 @@ void driver_mode::update_camera(double const Deltatime)
|
||||
auto shakencamerapos{Camera.m_owneroffset +
|
||||
shakescale * glm::vec3(1.5 * Camera.m_owner->ShakeState.offset.x, 2.0 * Camera.m_owner->ShakeState.offset.y, 1.5 * Camera.m_owner->ShakeState.offset.z)};
|
||||
|
||||
Camera.Pos = (Camera.m_owner->GetWorldPosition(FreeFlyModeFlag ? glm::dvec3(shakencamerapos) : // TODO: vehicle collision box for the external vehicle camera
|
||||
simulation::Train->clamp_inside(shakencamerapos)));
|
||||
Camera.Pos = Camera.m_owner->GetWorldPosition(FreeFlyModeFlag ? glm::dvec3(shakencamerapos) : // TODO: vehicle collision box for the external vehicle camera
|
||||
simulation::Train->clamp_inside(shakencamerapos));
|
||||
|
||||
if (!Global.iPause)
|
||||
{
|
||||
@@ -902,15 +902,15 @@ void driver_mode::OnKeyDown(int cKey)
|
||||
|
||||
// actual key processing
|
||||
// TODO: redo the input system
|
||||
if ((cKey >= GLFW_KEY_0) && (cKey <= GLFW_KEY_9))
|
||||
if (cKey >= GLFW_KEY_0 && cKey <= GLFW_KEY_9)
|
||||
{
|
||||
// klawisze cyfrowe
|
||||
int i = cKey - GLFW_KEY_0; // numer klawisza
|
||||
if (Global.shiftState)
|
||||
{
|
||||
// z [Shift] uruchomienie eventu
|
||||
if ((Global.iPause == 0) // podczas pauzy klawisze nie działają
|
||||
&& (KeyEvents[i] != nullptr))
|
||||
if (Global.iPause == 0 // podczas pauzy klawisze nie działają
|
||||
&& KeyEvents[i] != nullptr)
|
||||
{
|
||||
m_relay.post(user_command::queueevent, 0.0, 0.0, GLFW_PRESS, 0, glm::vec3(0.0f), &KeyEvents[i]->name());
|
||||
}
|
||||
@@ -921,7 +921,7 @@ void driver_mode::OnKeyDown(int cKey)
|
||||
if (FreeFlyModeFlag)
|
||||
{
|
||||
// w trybie latania można przeskakiwać do ustawionych kamer
|
||||
if ((Global.FreeCameraInit[i].x == 0.0) && (Global.FreeCameraInit[i].y == 0.0) && (Global.FreeCameraInit[i].z == 0.0))
|
||||
if (Global.FreeCameraInit[i].x == 0.0 && Global.FreeCameraInit[i].y == 0.0 && Global.FreeCameraInit[i].z == 0.0)
|
||||
{
|
||||
// jeśli kamera jest w punkcie zerowym, zapamiętanie współrzędnych i kątów
|
||||
Global.FreeCameraInit[i] = Camera.Pos;
|
||||
@@ -966,7 +966,7 @@ void driver_mode::OnKeyDown(int cKey)
|
||||
TDynamicObject *dynamic = std::get<TDynamicObject *>(simulation::Region->find_vehicle(Global.pCamera.Pos, 50, false, false));
|
||||
if (dynamic)
|
||||
{
|
||||
m_relay.post(user_command::entervehicle, (Global.ctrlState ? GLFW_MOD_CONTROL : 0), (simulation::Train ? simulation::Train->id() : 0), GLFW_PRESS, 0, dynamic->GetPosition(),
|
||||
m_relay.post(user_command::entervehicle, Global.ctrlState ? GLFW_MOD_CONTROL : 0, simulation::Train ? simulation::Train->id() : 0, GLFW_PRESS, 0, dynamic->GetPosition(),
|
||||
&dynamic->name());
|
||||
|
||||
change_train = dynamic->name();
|
||||
@@ -982,11 +982,11 @@ void driver_mode::OnKeyDown(int cKey)
|
||||
|
||||
if (Global.ctrlState)
|
||||
{
|
||||
Global.fTimeSpeed = (Global.shiftState ? 60.0 : 20.0);
|
||||
Global.fTimeSpeed = Global.shiftState ? 60.0 : 20.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.fTimeSpeed = (Global.shiftState ? 5.0 : Global.default_timespeed);
|
||||
Global.fTimeSpeed = Global.shiftState ? 5.0 : Global.default_timespeed;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1024,7 +1024,7 @@ void driver_mode::OnKeyDown(int cKey)
|
||||
case GLFW_KEY_F11:
|
||||
{
|
||||
// editor mode
|
||||
if ((false == Global.ctrlState) && (false == Global.shiftState))
|
||||
if (false == Global.ctrlState && false == Global.shiftState)
|
||||
{
|
||||
Application.push_mode(eu07_application::mode::editor);
|
||||
}
|
||||
@@ -1044,14 +1044,14 @@ void driver_mode::OnKeyDown(int cKey)
|
||||
void driver_mode::DistantView(bool const Near)
|
||||
{
|
||||
|
||||
TDynamicObject const *vehicle = {((simulation::Train != nullptr) ? simulation::Train->Dynamic() : pDynamicNearest)};
|
||||
TDynamicObject const *vehicle = {(simulation::Train != nullptr ? simulation::Train->Dynamic() : pDynamicNearest)};
|
||||
|
||||
if (vehicle == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto const cab = (vehicle->MoverParameters->CabOccupied == 0 ? 1 : vehicle->MoverParameters->CabOccupied);
|
||||
auto const cab = vehicle->MoverParameters->CabOccupied == 0 ? 1 : vehicle->MoverParameters->CabOccupied;
|
||||
auto const left = vehicle->VectorLeft() * (double)cab;
|
||||
|
||||
if (true == Near)
|
||||
@@ -1119,7 +1119,7 @@ void driver_mode::ExternalView()
|
||||
|
||||
Camera.m_owneroffset = {1.5 * owner->MoverParameters->Dim.W * offsetflip, std::max(5.0, 1.25 * owner->MoverParameters->Dim.H), -0.4 * owner->MoverParameters->Dim.L * offsetflip};
|
||||
|
||||
Camera.Angle.y = glm::radians((vehicle->MoverParameters->DirActive < 0 ? 180.0 : 0.0));
|
||||
Camera.Angle.y = glm::radians(vehicle->MoverParameters->DirActive < 0 ? 180.0 : 0.0);
|
||||
}
|
||||
auto const shakeangles{owner->shake_angles()};
|
||||
Camera.Angle.x -= 0.5 * shakeangles.second; // hustanie kamery przod tyl
|
||||
@@ -1149,7 +1149,7 @@ void driver_mode::ExternalView()
|
||||
|
||||
Camera.m_owneroffset = {1.5 * owner->MoverParameters->Dim.W * offsetflip, std::max(5.0, 1.25 * owner->MoverParameters->Dim.H), 0.2 * owner->MoverParameters->Dim.L * offsetflip};
|
||||
|
||||
Camera.Angle.y = glm::radians((vehicle->MoverParameters->DirActive < 0 ? 0.0 : 180.0));
|
||||
Camera.Angle.y = glm::radians(vehicle->MoverParameters->DirActive < 0 ? 0.0 : 180.0);
|
||||
}
|
||||
auto const shakeangles{owner->shake_angles()};
|
||||
Camera.Angle.x -= 0.5 * shakeangles.second; // hustanie kamery przod tyl
|
||||
@@ -1177,7 +1177,7 @@ void driver_mode::ExternalView()
|
||||
|
||||
Camera.m_owneroffset = {-0.65 * owner->MoverParameters->Dim.W * offsetflip, 0.90, 0.15 * owner->MoverParameters->Dim.L * offsetflip};
|
||||
|
||||
Camera.Angle.y = glm::radians((vehicle->MoverParameters->DirActive < 0 ? 180.0 : 0.0));
|
||||
Camera.Angle.y = glm::radians(vehicle->MoverParameters->DirActive < 0 ? 180.0 : 0.0);
|
||||
}
|
||||
auto const shakeangles{owner->shake_angles()};
|
||||
Camera.Angle.x -= 0.5 * shakeangles.second; // hustanie kamery przod tyl
|
||||
|
||||
@@ -112,7 +112,7 @@ bool driver_ui::on_key(int const Key, int const Action)
|
||||
case GLFW_KEY_F12:
|
||||
{ // ui mode selectors
|
||||
|
||||
if ((true == Global.ctrlState) || (true == Global.shiftState))
|
||||
if (true == Global.ctrlState || true == Global.shiftState)
|
||||
{
|
||||
// only react to keys without modifiers
|
||||
return false;
|
||||
@@ -143,11 +143,11 @@ bool driver_ui::on_key(int const Key, int const Action)
|
||||
case GLFW_KEY_F1:
|
||||
{
|
||||
// basic consist info
|
||||
auto state = ((m_aidpanel.is_open == false) ? 0 : (m_aidpanel.is_expanded == false) ? 1 : 2);
|
||||
auto state = m_aidpanel.is_open == false ? 0 : m_aidpanel.is_expanded == false ? 1 : 2;
|
||||
state = clamp_circular(++state, 3);
|
||||
|
||||
m_aidpanel.is_open = (state > 0);
|
||||
m_aidpanel.is_expanded = (state > 1);
|
||||
m_aidpanel.is_open = state > 0;
|
||||
m_aidpanel.is_expanded = state > 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -155,11 +155,11 @@ bool driver_ui::on_key(int const Key, int const Action)
|
||||
case GLFW_KEY_F2:
|
||||
{
|
||||
// timetable
|
||||
auto state = ((m_timetablepanel.is_open == false) ? 0 : (m_timetablepanel.is_expanded == false) ? 1 : 2);
|
||||
auto state = m_timetablepanel.is_open == false ? 0 : m_timetablepanel.is_expanded == false ? 1 : 2;
|
||||
state = clamp_circular(++state, 3);
|
||||
|
||||
m_timetablepanel.is_open = (state > 0);
|
||||
m_timetablepanel.is_expanded = (state > 1);
|
||||
m_timetablepanel.is_open = state > 0;
|
||||
m_timetablepanel.is_expanded = state > 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -209,8 +209,8 @@ void driver_ui::update()
|
||||
{
|
||||
|
||||
auto const pausemask{1 | 2};
|
||||
auto ispaused{(false == DebugModeFlag) && ((Global.iPause & pausemask) != 0)};
|
||||
if ((ispaused != m_paused) && (false == Global.ControlPicking))
|
||||
auto ispaused{false == DebugModeFlag && (Global.iPause & pausemask) != 0};
|
||||
if (ispaused != m_paused && false == Global.ControlPicking)
|
||||
{
|
||||
set_cursor(ispaused);
|
||||
}
|
||||
@@ -252,7 +252,7 @@ void driver_ui::render_()
|
||||
ImGui::SetNextWindowSize(ImVec2(-1, -1));
|
||||
if (ImGui::BeginPopupModal(popupheader, nullptr, 0))
|
||||
{
|
||||
if ((ImGui::Button(STR_C("Resume"), ImVec2(150, 0))) || (ImGui::IsKeyReleased(ImGui::GetKeyIndex(ImGuiKey_Escape))))
|
||||
if (ImGui::Button(STR_C("Resume"), ImVec2(150, 0)) || ImGui::IsKeyReleased(ImGui::GetKeyIndex(ImGuiKey_Escape)))
|
||||
{
|
||||
m_relay.post(user_command::pausetoggle, 0.0, 0.0, GLFW_RELEASE, 0);
|
||||
}
|
||||
|
||||
@@ -48,12 +48,12 @@ drivingaid_panel::update() {
|
||||
auto const *train { simulation::Train };
|
||||
auto const *controlled { ( train ? train->Dynamic() : nullptr ) };
|
||||
|
||||
if( ( controlled == nullptr )
|
||||
|| ( controlled->Mechanik == nullptr ) ) { return; }
|
||||
if( controlled == nullptr
|
||||
|| controlled->Mechanik == nullptr ) { return; }
|
||||
|
||||
auto const *mover = controlled->MoverParameters;
|
||||
auto const *driver = controlled->Mechanik;
|
||||
auto const *owner = ( controlled->ctOwner != nullptr ? controlled->ctOwner : controlled->Mechanik );
|
||||
auto const *owner = controlled->ctOwner != nullptr ? controlled->ctOwner : controlled->Mechanik;
|
||||
|
||||
{ // throttle, velocity, speed limits and grade
|
||||
std::string expandedtext;
|
||||
@@ -76,8 +76,8 @@ drivingaid_panel::update() {
|
||||
if( speedlimit != 0 ) { // if we aren't allowed to move then any next speed limit is irrelevant
|
||||
// nie przekraczać rozkladowej
|
||||
auto const schedulespeedlimit { (
|
||||
( ( owner->OrderCurrentGet() & ( Obey_train | Bank ) ) != 0 ) && ( owner->TrainParams.TTVmax > 0.0 ) ? static_cast<int>( owner->TrainParams.TTVmax ) :
|
||||
( ( owner->OrderCurrentGet() & ( Obey_train | Bank ) ) == 0 ) ? static_cast<int>( owner->fShuntVelocity ) :
|
||||
(owner->OrderCurrentGet() & (Obey_train | Bank)) != 0 && owner->TrainParams.TTVmax > 0.0 ? static_cast<int>( owner->TrainParams.TTVmax ) :
|
||||
(owner->OrderCurrentGet() & (Obey_train | Bank)) == 0 ? static_cast<int>( owner->fShuntVelocity ) :
|
||||
-1 ) };
|
||||
// first take note of any speed change which should occur after passing potential current speed limit
|
||||
if( owner->VelLimitLastDist.second > 0 ) {
|
||||
@@ -142,9 +142,12 @@ drivingaid_panel::update() {
|
||||
std::snprintf(
|
||||
m_buffer.data(), m_buffer.size(),
|
||||
STR_C("Throttle: %3d+%d %c%s"),
|
||||
( mover->EIMCtrlType > 0 ? std::max( 0, static_cast<int>( 100.4 * mover->eimic_real ) ) : driver->Controlling()->MainCtrlPos ),
|
||||
( mover->EIMCtrlType > 0 ? driver->Controlling()->MainCtrlPos : driver->Controlling()->ScndCtrlPos ),
|
||||
( mover->SpeedCtrlUnit.IsActive ? 'T' : mover->DirActive > 0 ? 'D' : mover->DirActive < 0 ? 'R' : 'N' ),
|
||||
mover->EIMCtrlType > 0 ? std::max(0, static_cast<int>(100.4 * mover->eimic_real)) : driver->Controlling()->MainCtrlPos,
|
||||
mover->EIMCtrlType > 0 ? driver->Controlling()->MainCtrlPos : driver->Controlling()->ScndCtrlPos,
|
||||
mover->SpeedCtrlUnit.IsActive ? 'T' :
|
||||
mover->DirActive > 0 ? 'D' :
|
||||
mover->DirActive < 0 ? 'R' :
|
||||
'N',
|
||||
expandedtext.c_str());
|
||||
|
||||
text_lines.emplace_back( m_buffer.data(), Global.UITextColor );
|
||||
@@ -166,9 +169,9 @@ drivingaid_panel::update() {
|
||||
m_buffer.data(), m_buffer.size(),
|
||||
STR_C("Brakes: %5.1f+%-2.0f%c%s"),
|
||||
// ( mover->EIMCtrlType == 0 ? basicbraking : mover->EIMCtrlType == 3 ? ( mover->UniCtrlIntegratedBrakeCtrl ? eimicbraking : basicbraking ) : eimicbraking ),
|
||||
( mover->UniCtrlIntegratedBrakeCtrl ? eimicbraking : basicbraking ),
|
||||
mover->UniCtrlIntegratedBrakeCtrl ? eimicbraking : basicbraking,
|
||||
mover->LocalBrakePosA * LocalBrakePosNo,
|
||||
( mover->SlippingWheels ? '!' : ' ' ),
|
||||
mover->SlippingWheels ? '!' : ' ',
|
||||
expandedtext.c_str() );
|
||||
|
||||
text_lines.emplace_back( m_buffer.data(), Global.UITextColor );
|
||||
@@ -197,13 +200,9 @@ drivingaid_panel::update() {
|
||||
}
|
||||
}
|
||||
std::string textline =
|
||||
( (mover->SecuritySystem.is_vigilance_blinking() && (train != nullptr ? (train->fBlinkTimer > 0) : true)) ?
|
||||
STR("!ALERTER! ") :
|
||||
" " );
|
||||
mover->SecuritySystem.is_vigilance_blinking() && (train != nullptr ? train->fBlinkTimer > 0 : true) ? STR("!ALERTER! ") : " ";
|
||||
textline +=
|
||||
( mover->SecuritySystem.is_cabsignal_blinking() ?
|
||||
STR("!SHP!") :
|
||||
" " );
|
||||
mover->SecuritySystem.is_cabsignal_blinking() ? STR("!SHP!") : " ";
|
||||
|
||||
text_lines.emplace_back( textline + " " + expandedtext, Global.UITextColor );
|
||||
}
|
||||
@@ -219,13 +218,12 @@ scenario_panel::update() {
|
||||
auto const *train { simulation::Train };
|
||||
auto const *controlled { ( train ? train->Dynamic() : nullptr ) };
|
||||
auto const &camera { Global.pCamera };
|
||||
m_nearest = (
|
||||
false == FreeFlyModeFlag ? controlled :
|
||||
camera.m_owner != nullptr ? camera.m_owner :
|
||||
std::get<TDynamicObject *>( simulation::Region->find_vehicle( camera.Pos, 20, false, false ) ) ); // w trybie latania lokalizujemy wg mapy
|
||||
m_nearest = false == FreeFlyModeFlag ? controlled :
|
||||
camera.m_owner != nullptr ? camera.m_owner :
|
||||
std::get<TDynamicObject *>(simulation::Region->find_vehicle(camera.Pos, 20, false, false)); // w trybie latania lokalizujemy wg mapy
|
||||
if( m_nearest == nullptr ) { return; }
|
||||
auto const *owner { (
|
||||
( ( m_nearest->Mechanik != nullptr ) && ( m_nearest->Mechanik->primary() ) ) ?
|
||||
m_nearest->Mechanik != nullptr && m_nearest->Mechanik->primary() ?
|
||||
m_nearest->Mechanik :
|
||||
m_nearest->ctOwner ) };
|
||||
if( owner == nullptr ) { return; }
|
||||
@@ -263,13 +261,13 @@ scenario_panel::render() {
|
||||
if( true == ImGui::Begin( panelname.c_str(), &is_open, flags ) ) {
|
||||
// potential assignment section
|
||||
auto const *owner { (
|
||||
( ( m_nearest->Mechanik != nullptr ) && ( m_nearest->Mechanik->primary() ) ) ?
|
||||
m_nearest->Mechanik != nullptr && m_nearest->Mechanik->primary() ?
|
||||
m_nearest->Mechanik :
|
||||
m_nearest->ctOwner ) };
|
||||
if( owner != nullptr ) {
|
||||
auto const assignmentheader { STR("Assignment") };
|
||||
if( ( false == owner->assignment().empty() )
|
||||
&& ( true == ImGui::CollapsingHeader( assignmentheader.c_str() ) ) ) {
|
||||
if( false == owner->assignment().empty()
|
||||
&& true == ImGui::CollapsingHeader(assignmentheader.c_str()) ) {
|
||||
ImGui::TextWrapped( "%s", owner->assignment().c_str() );
|
||||
ImGui::Separator();
|
||||
}
|
||||
@@ -330,10 +328,7 @@ timetable_panel::update() {
|
||||
|
||||
if( vehicle == nullptr ) { return; }
|
||||
// if the nearest located vehicle doesn't have a direct driver, try to query its owner
|
||||
auto const *owner = (
|
||||
( ( vehicle->Mechanik != nullptr ) && ( vehicle->Mechanik->primary() ) ) ?
|
||||
vehicle->Mechanik :
|
||||
vehicle->ctOwner );
|
||||
auto const *owner = vehicle->Mechanik != nullptr && vehicle->Mechanik->primary() ? vehicle->Mechanik : vehicle->ctOwner;
|
||||
if( owner == nullptr ) { return; }
|
||||
|
||||
auto const &table = owner->TrainTimetable();
|
||||
@@ -364,8 +359,8 @@ timetable_panel::update() {
|
||||
// consist data
|
||||
auto consistmass { owner->fMass };
|
||||
auto consistlength { owner->fLength };
|
||||
if( ( false == owner->is_dmu() )
|
||||
&& ( false == owner->is_emu() ) ) {
|
||||
if( false == owner->is_dmu()
|
||||
&& false == owner->is_emu() ) {
|
||||
//odejmij lokomotywy czynne, a przynajmniej aktualną
|
||||
consistmass -= owner->pVehicle->MoverParameters->TotalMass;
|
||||
// subtract potential other half of a two-part vehicle
|
||||
@@ -429,29 +424,27 @@ timetable_panel::update() {
|
||||
std::to_string( int( 100 + tableline->Dh ) ).substr( 1, 2 ) + ":" + to_minutes_str( tableline->Dm, true, 3 ) :
|
||||
U8(" │ ") ) };
|
||||
auto const candepart { (
|
||||
( table.StationStart < table.StationIndex )
|
||||
&& ( i < table.StationIndex )
|
||||
&& ( ( tableline->Ah < 0 ) // pass-through, always valid
|
||||
|| ( tableline->is_maintenance ) // maintenance stop, always valid
|
||||
|| ( time.wHour * 60 + time.wMinute + time.wSecond * 0.0167 >= tableline->Dh * 60 + tableline->Dm ) ) ) };
|
||||
auto const loadchangeinprogress { ( ( static_cast<int>( std::ceil( -1.0 * owner->fStopTime ) ) ) > 0 ) };
|
||||
auto const isatpassengerstop { ( true == owner->IsAtPassengerStop ) && ( vehicle->MoverParameters->Vel < 1.0 ) };
|
||||
table.StationStart < table.StationIndex
|
||||
&& i < table.StationIndex
|
||||
&& ( tableline->Ah < 0 // pass-through, always valid
|
||||
|| tableline->is_maintenance // maintenance stop, always valid
|
||||
|| time.wHour * 60 + time.wMinute + time.wSecond * 0.0167 >= tableline->Dh * 60 + tableline->Dm ) ) };
|
||||
auto const loadchangeinprogress { ( static_cast<int>(std::ceil(-1.0 * owner->fStopTime)) > 0 ) };
|
||||
auto const isatpassengerstop { true == owner->IsAtPassengerStop && vehicle->MoverParameters->Vel < 1.0 };
|
||||
auto const traveltime { (
|
||||
i < 2 ? " " :
|
||||
tableline->Ah >= 0 ? to_minutes_str( CompareTime( table.TimeTable[ i - 1 ].Dh, table.TimeTable[ i - 1 ].Dm, tableline->Ah, tableline->Am ), false, 3 ) :
|
||||
to_minutes_str( std::max( 0.0, CompareTime( table.TimeTable[ i - 1 ].Dh, table.TimeTable[ i - 1 ].Dm, tableline->Dh, tableline->Dm ) - 0.5 ), false, 3 ) ) };
|
||||
auto const linecolor { (
|
||||
( i != table.StationStart ) ? Global.UITextColor :
|
||||
i != table.StationStart ? Global.UITextColor :
|
||||
loadchangeinprogress ? colors::uitextred :
|
||||
candepart ? colors::uitextgreen : // czas minął i odjazd był, to nazwa stacji będzie na zielono
|
||||
isatpassengerstop ? colors::uitextorange :
|
||||
Global.UITextColor ) };
|
||||
std::string const trackcount{ ( tableline->TrackNo == 1 ? U8(" ┃ ") : U8(" ║ " )) };
|
||||
m_tablelines.emplace_back(
|
||||
( U8("│ ") + vmax + U8(" │ ") + station + trackcount + arrival + U8(" │ ") + traveltime + U8(" │") ),
|
||||
m_tablelines.emplace_back(U8("│ ") + vmax + U8(" │ ") + station + trackcount + arrival + U8(" │ ") + traveltime + U8(" │"),
|
||||
linecolor );
|
||||
m_tablelines.emplace_back(
|
||||
( U8("│ │ ") + location + tableline->StationWare + trackcount + departure + U8(" │ │") ),
|
||||
m_tablelines.emplace_back(U8("│ │ ") + location + tableline->StationWare + trackcount + departure + U8(" │ │"),
|
||||
linecolor );
|
||||
// divider/footer
|
||||
if( i < table.StationCount ) {
|
||||
@@ -522,20 +515,14 @@ void debug_panel::update()
|
||||
|
||||
// input item bindings
|
||||
m_input.train = simulation::Train;
|
||||
m_input.controlled = ( m_input.train ? m_input.train->Dynamic() : nullptr );
|
||||
m_input.camera = &( Global.pCamera );
|
||||
m_input.vehicle = (
|
||||
false == FreeFlyModeFlag ? m_input.controlled :
|
||||
m_input.camera->m_owner != nullptr ? m_input.camera->m_owner :
|
||||
std::get<TDynamicObject *>( simulation::Region->find_vehicle( m_input.camera->Pos, 20, false, false ) ) ); // w trybie latania lokalizujemy wg mapy
|
||||
m_input.controlled = m_input.train ? m_input.train->Dynamic() : nullptr;
|
||||
m_input.camera = &Global.pCamera;
|
||||
m_input.vehicle = false == FreeFlyModeFlag ? m_input.controlled :
|
||||
m_input.camera->m_owner != nullptr ? m_input.camera->m_owner :
|
||||
std::get<TDynamicObject *>(simulation::Region->find_vehicle(m_input.camera->Pos, 20, false, false)); // w trybie latania lokalizujemy wg mapy
|
||||
m_input.mover =
|
||||
( m_input.vehicle != nullptr ?
|
||||
m_input.vehicle->MoverParameters :
|
||||
nullptr );
|
||||
m_input.mechanik = (
|
||||
m_input.vehicle != nullptr ?
|
||||
m_input.vehicle->Mechanik :
|
||||
nullptr );
|
||||
m_input.vehicle != nullptr ? m_input.vehicle->MoverParameters : nullptr;
|
||||
m_input.mechanik = m_input.vehicle != nullptr ? m_input.vehicle->Mechanik : nullptr;
|
||||
|
||||
// header section
|
||||
text_lines.clear();
|
||||
@@ -602,7 +589,7 @@ debug_panel::render() {
|
||||
// sections
|
||||
ImGui::Separator();
|
||||
if( true == render_section( "Vehicle", m_vehiclelines ) ) {
|
||||
if( DebugModeFlag && ( m_input.mover ) && ( m_input.mover->DamageFlag != 0 ) ) {
|
||||
if( DebugModeFlag && m_input.mover && m_input.mover->DamageFlag != 0 ) {
|
||||
if( true == ImGui::Button( "Stop and repair consist" ) ) {
|
||||
command_relay relay;
|
||||
relay.post(user_command::resetconsist, 0.0, 0.0, GLFW_PRESS, 0, glm::vec3(0.0f), &m_input.vehicle->name());
|
||||
@@ -738,7 +725,7 @@ debug_panel::render_section_scenario() {
|
||||
{
|
||||
auto timerate { ( Global.fTimeSpeed == 60 ? 4 : Global.fTimeSpeed == 20 ? 3 : Global.fTimeSpeed == 5 ? 2 : 1 ) };
|
||||
if( ImGui::SliderInt( ( "x " + to_string( Global.fTimeSpeed, 0 ) + "###timeacceleration" ).c_str(), &timerate, 1, 4, "Time acceleration" ) ) {
|
||||
Global.fTimeSpeed = ( timerate == 4 ? 60 : timerate == 3 ? 20 : timerate == 2 ? 5 : 1 );
|
||||
Global.fTimeSpeed = timerate == 4 ? 60 : timerate == 3 ? 20 : timerate == 2 ? 5 : 1;
|
||||
}
|
||||
}
|
||||
// base draw range slider
|
||||
@@ -780,8 +767,8 @@ debug_panel::update_section_vehicle( std::vector<text_line> &Output ) {
|
||||
auto const &vehicle { *m_input.vehicle };
|
||||
auto const &mover { *m_input.mover };
|
||||
|
||||
auto const isowned { /* ( vehicle.Mechanik == nullptr ) && */ ( vehicle.ctOwner != nullptr ) && ( vehicle.ctOwner->Vehicle() != m_input.vehicle ) };
|
||||
auto const isdieselenginepowered { ( mover.EngineType == TEngineType::DieselElectric ) || ( mover.EngineType == TEngineType::DieselEngine ) };
|
||||
auto const isowned { /* ( vehicle.Mechanik == nullptr ) && */ vehicle.ctOwner != nullptr && vehicle.ctOwner->Vehicle() != m_input.vehicle };
|
||||
auto const isdieselenginepowered { mover.EngineType == TEngineType::DieselElectric || mover.EngineType == TEngineType::DieselEngine };
|
||||
auto const isdieselinshuntmode { mover.ShuntMode && mover.EngineType == TEngineType::DieselElectric };
|
||||
|
||||
std::snprintf(
|
||||
@@ -803,24 +790,52 @@ debug_panel::update_section_vehicle( std::vector<text_line> &Output ) {
|
||||
m_buffer.data(), m_buffer.size(),
|
||||
STR_C("Devices: %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%s%s\nPower transfers: %.0f@%.0f%s[%.0f]%s%.0f@%.0f :: %.0f@%.0f%s[%.0f]%s%.0f@%.0f"),
|
||||
// devices
|
||||
( mover.Battery ? 'B' : '.' ),
|
||||
( mover.PantsValve.is_active ? '+' : '.' ),
|
||||
( mover.Pantographs[ end::rear ].valve.is_active ? 'O' : ( mover.Pantographs[ end::rear ].valve.is_enabled ? 'o' : '.' ) ),
|
||||
( mover.Pantographs[ end::front ].valve.is_active ? 'P' : ( mover.Pantographs[ end::front ].valve.is_enabled ? 'p' : '.' ) ),
|
||||
( mover.PantPressLockActive ? '!' : ( mover.PantPressSwitchActive ? '*' : '.' ) ),
|
||||
( mover.WaterPump.is_active ? 'W' : ( false == mover.WaterPump.breaker ? '-' : ( mover.WaterPump.is_enabled ? 'w' : '.' ) ) ),
|
||||
( mover.WaterHeater.is_damaged ? '!' : ( mover.WaterHeater.is_active ? 'H' : ( false == mover.WaterHeater.breaker ? '-' : ( mover.WaterHeater.is_enabled ? 'h' : '.' ) ) ) ),
|
||||
( mover.FuelPump.is_active ? 'F' : ( mover.FuelPump.is_enabled ? 'f' : '.' ) ),
|
||||
( mover.OilPump.is_active ? 'O' : ( mover.OilPump.is_enabled ? 'o' : '.' ) ),
|
||||
( mover.Mains ? 'M' : '.' ),
|
||||
( mover.FuseFlag ? '!' : '.' ),
|
||||
( mover.ConverterFlag ? 'X' : ( false == mover.ConverterAllowLocal ? '-' : ( mover.ConverterAllow ? 'x' : '.' ) ) ),
|
||||
( mover.ConvOvldFlag ? '!' : '.' ),
|
||||
( mover.CompressorFlag ? 'C' : ( false == mover.CompressorAllowLocal ? '-' : ( ( mover.CompressorAllow || ( mover.CompressorStart == start_t::automatic && mover.CompressorSpeed > 0.0 ) ) ? 'c' : '.' ) ) ),
|
||||
( mover.CompressorGovernorLock ? '!' : '.' ),
|
||||
( mover.StLinSwitchOff ? '-' : ( mover.ControlPressureSwitch ? '!' : ( mover.StLinFlag ? '+' : '.' ) ) ),
|
||||
( mover.Heating ? 'H' : ( mover.HeatingAllow ? 'h' : '.' ) ),
|
||||
( mover.Hamulec->Releaser() ? '^' : '.' ),
|
||||
mover.Battery ? 'B' : '.',
|
||||
mover.PantsValve.is_active ? '+' : '.',
|
||||
mover.Pantographs[end::rear].valve.is_active ? 'O' :
|
||||
mover.Pantographs[end::rear].valve.is_enabled ? 'o' :
|
||||
'.',
|
||||
mover.Pantographs[end::front].valve.is_active ? 'P' :
|
||||
mover.Pantographs[end::front].valve.is_enabled ? 'p' :
|
||||
'.',
|
||||
mover.PantPressLockActive ? '!' :
|
||||
mover.PantPressSwitchActive ? '*' :
|
||||
'.',
|
||||
mover.WaterPump.is_active ? 'W' :
|
||||
false == mover.WaterPump.breaker ? '-' :
|
||||
mover.WaterPump.is_enabled ? 'w' :
|
||||
'.',
|
||||
mover.WaterHeater.is_damaged ? '!' :
|
||||
mover.WaterHeater.is_active ? 'H' :
|
||||
false == mover.WaterHeater.breaker ? '-' :
|
||||
mover.WaterHeater.is_enabled ? 'h' :
|
||||
'.',
|
||||
mover.FuelPump.is_active ? 'F' :
|
||||
mover.FuelPump.is_enabled ? 'f' :
|
||||
'.',
|
||||
mover.OilPump.is_active ? 'O' :
|
||||
mover.OilPump.is_enabled ? 'o' :
|
||||
'.',
|
||||
mover.Mains ? 'M' : '.',
|
||||
mover.FuseFlag ? '!' : '.',
|
||||
mover.ConverterFlag ? 'X' :
|
||||
false == mover.ConverterAllowLocal ? '-' :
|
||||
mover.ConverterAllow ? 'x' :
|
||||
'.',
|
||||
mover.ConvOvldFlag ? '!' : '.',
|
||||
mover.CompressorFlag ? 'C' :
|
||||
false == mover.CompressorAllowLocal ? '-' :
|
||||
mover.CompressorAllow || (mover.CompressorStart == start_t::automatic && mover.CompressorSpeed > 0.0) ? 'c' :
|
||||
'.',
|
||||
mover.CompressorGovernorLock ? '!' : '.',
|
||||
mover.StLinSwitchOff ? '-' :
|
||||
mover.ControlPressureSwitch ? '!' :
|
||||
mover.StLinFlag ? '+' :
|
||||
'.',
|
||||
mover.Heating ? 'H' :
|
||||
mover.HeatingAllow ? 'h' :
|
||||
'.',
|
||||
mover.Hamulec->Releaser() ? '^' : '.',
|
||||
std::string( m_input.mechanik ? STR(" R") + ( mover.Radio ? std::to_string( m_input.mechanik->iRadioChannel ) : "-" ) : "" ).c_str(),
|
||||
std::string( isdieselenginepowered ? STR(" oil pressure: ") + to_string( mover.OilPump.pressure, 2 ) : "" ).c_str(),
|
||||
// power transfers
|
||||
@@ -871,7 +886,7 @@ debug_panel::update_section_vehicle( std::vector<text_line> &Output ) {
|
||||
mover.dizel_heat.Ts,
|
||||
mover.dizel_heat.To,
|
||||
mover.dizel_heat.temperatura1,
|
||||
( mover.WaterCircuitsLink ? '-' : '|' ),
|
||||
mover.WaterCircuitsLink ? '-' : '|',
|
||||
mover.dizel_heat.temperatura2 );
|
||||
textline += m_buffer.data();
|
||||
}
|
||||
@@ -888,8 +903,8 @@ debug_panel::update_section_vehicle( std::vector<text_line> &Output ) {
|
||||
mover.LoadFlag,
|
||||
mover.LocalBrakePosA,
|
||||
mover.LocalBrakePosAEIM,
|
||||
( mover.ManualBrakePos / static_cast<float>( ManualBrakePosNo ) ),
|
||||
( mover.SpringBrake.Activate ? 1.f : 0.f ),
|
||||
mover.ManualBrakePos / static_cast<float>(ManualBrakePosNo),
|
||||
mover.SpringBrake.Activate ? 1.f : 0.f,
|
||||
// cylinders
|
||||
mover.BrakePress,
|
||||
mover.LocBrakePress,
|
||||
@@ -911,7 +926,7 @@ debug_panel::update_section_vehicle( std::vector<text_line> &Output ) {
|
||||
m_buffer.data(), m_buffer.size(),
|
||||
STR_C(" pantograph: %.2f%cMT"),
|
||||
mover.PantPress,
|
||||
( mover.bPantKurek3 ? '-' : '|' ) );
|
||||
mover.bPantKurek3 ? '-' : '|' );
|
||||
textline += m_buffer.data();
|
||||
}
|
||||
|
||||
@@ -924,7 +939,7 @@ debug_panel::update_section_vehicle( std::vector<text_line> &Output ) {
|
||||
mover.Ft * 0.001f * ( mover.CabOccupied ? mover.CabOccupied : vehicle.ctOwner ? vehicle.ctOwner->Controlling()->CabOccupied : 1 ) + 0.001f,
|
||||
mover.Fb * 0.001f,
|
||||
mover.FrictionForce() * 0.001f,
|
||||
( mover.SlippingWheels ? " (!)" : "" ),
|
||||
mover.SlippingWheels ? " (!)" : "",
|
||||
// acceleration
|
||||
mover.AccSVBased,
|
||||
mover.AccN + 0.001f,
|
||||
@@ -994,7 +1009,7 @@ void debug_panel::graph_data::render() {
|
||||
std::string
|
||||
debug_panel::update_vehicle_coupler( int const Side ) {
|
||||
// NOTE: mover and vehicle are guaranteed to be valid by the caller
|
||||
auto const &mover { *( m_input.mover ) };
|
||||
auto const &mover { *m_input.mover };
|
||||
|
||||
std::string const controltype{ ( mover.Couplers[ Side ].control_type.empty() ? "[*]" : "[" + mover.Couplers[ Side ].control_type + "]" ) };
|
||||
std::string couplerstatus { STR("none") };
|
||||
@@ -1022,7 +1037,7 @@ debug_panel::update_vehicle_coupler( int const Side ) {
|
||||
std::string
|
||||
debug_panel::update_vehicle_brake() const {
|
||||
// NOTE: mover is guaranteed to be valid by the caller
|
||||
auto const &mover { *( m_input.mover ) };
|
||||
auto const &mover { *m_input.mover };
|
||||
|
||||
std::string brakedelay;
|
||||
|
||||
@@ -1063,9 +1078,7 @@ debug_panel::update_section_engine( std::vector<text_line> &Output ) {
|
||||
|
||||
if( i < 10 ) {
|
||||
parameters +=
|
||||
( ( m_input.train != nullptr ) && ( m_input.train->Dynamic() == m_input.vehicle ) ?
|
||||
" | " + TTrain::fPress_labels[ i ] + to_string( m_input.train->fPress[ i ][ 0 ], 2, 9 ) :
|
||||
"" );
|
||||
m_input.train != nullptr && m_input.train->Dynamic() == m_input.vehicle ? " | " + TTrain::fPress_labels[i] + to_string(m_input.train->fPress[i][0], 2, 9) : "";
|
||||
}
|
||||
else if( i == 12 ) {
|
||||
parameters += " med:";
|
||||
@@ -1147,8 +1160,8 @@ debug_panel::update_section_ai( std::vector<text_line> &Output ) {
|
||||
|
||||
Output.emplace_back( textline, Global.UITextColor );
|
||||
|
||||
if( ( mechanik.VelNext == 0.0 )
|
||||
&& ( mechanik.eSignNext ) ) {
|
||||
if( mechanik.VelNext == 0.0
|
||||
&& mechanik.eSignNext ) {
|
||||
// jeśli ma zapamiętany event semafora, nazwa eventu semafora
|
||||
Output.emplace_back( "Current signal: " + Bezogonkow( mechanik.eSignNext->m_name ), Global.UITextColor );
|
||||
}
|
||||
@@ -1210,7 +1223,8 @@ debug_panel::update_section_ai( std::vector<text_line> &Output ) {
|
||||
"Acceleration:\n desired: " + to_string( mechanik.AccDesired, 2 )
|
||||
+ ", corrected: " + to_string( mechanik.AccDesired * mechanik.BrakeAccFactor(), 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: " + std::to_string(mechanik.DizelPercentage)
|
||||
+ "/" + std::to_string(mechanik.DizelPercentage_Speed)
|
||||
+ "/" + to_string(100.4*mechanik.mvControlling->eimic_real, 0);
|
||||
@@ -1331,18 +1345,18 @@ debug_panel::update_section_eventqueue( std::vector<text_line> &Output ) {
|
||||
|
||||
Output.emplace_back( "Delay: Event:", Global.UITextColor );
|
||||
|
||||
while( ( event != nullptr )
|
||||
&& ( Output.size() < 30 ) ) {
|
||||
while( event != nullptr
|
||||
&& Output.size() < 30 ) {
|
||||
|
||||
if( ( false == event->m_ignored )
|
||||
&& ( false == event->m_passive )
|
||||
&& ( ( false == m_eventqueueactivevehicleonly )
|
||||
|| ( event->m_activator == m_input.vehicle ) ) ) {
|
||||
if( false == event->m_ignored
|
||||
&& false == event->m_passive
|
||||
&& ( false == m_eventqueueactivevehicleonly
|
||||
|| event->m_activator == m_input.vehicle ) ) {
|
||||
|
||||
auto const label { event->m_name + ( event->m_activator ? " (by: " + event->m_activator->asName + ")" : "" ) };
|
||||
|
||||
if( ( false == searchfilter.empty() )
|
||||
&& ( false == contains( label, searchfilter ) ) ) {
|
||||
if( false == searchfilter.empty()
|
||||
&& false == contains(label, searchfilter) ) {
|
||||
event = event->m_next;
|
||||
continue;
|
||||
}
|
||||
@@ -1359,10 +1373,7 @@ debug_panel::update_section_eventqueue( std::vector<text_line> &Output ) {
|
||||
}
|
||||
if( Output.size() == 1 ) {
|
||||
// event queue can be empty either because no event got through active filters, or because it is genuinely empty
|
||||
Output.front().data = (
|
||||
simulation::Events.begin() == nullptr ?
|
||||
"(no queued events)" :
|
||||
"(no matching events)" );
|
||||
Output.front().data = simulation::Events.begin() == nullptr ? "(no queued events)" : "(no matching events)";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1398,9 +1409,9 @@ debug_panel::update_section_powergrid( std::vector<text_line> &Output ) {
|
||||
|
||||
Output.emplace_back(
|
||||
textline,
|
||||
( ( powerstation->FastFuse || powerstation->SlowFuse ) ? nopowercolor :
|
||||
powerstation->OutputVoltage < ( 0.8 * powerstation->NominalVoltage ) ? lowpowercolor :
|
||||
Global.UITextColor ) );
|
||||
powerstation->FastFuse || powerstation->SlowFuse ? nopowercolor :
|
||||
powerstation->OutputVoltage < 0.8 * powerstation->NominalVoltage ? lowpowercolor :
|
||||
Global.UITextColor );
|
||||
}
|
||||
|
||||
if( Output.size() == 1 ) {
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace
|
||||
return false; // degenerate or vertical triangle, no defined height
|
||||
double const s = (wx * vz - vx * wz) / den;
|
||||
double const t = (ux * wz - wx * uz) / den;
|
||||
if (s < 0.0 || t < 0.0 || (s + t) > 1.0)
|
||||
if (s < 0.0 || t < 0.0 || s + t > 1.0)
|
||||
return false;
|
||||
OutY = a.y + s * (b.y - a.y) + t * (c.y - a.y);
|
||||
return true;
|
||||
@@ -86,7 +86,7 @@ namespace
|
||||
for (TSubModel *sub = Submodel; sub != nullptr; sub = sub->Next)
|
||||
{
|
||||
glm::dmat4 mlocal = M;
|
||||
if ((sub->iFlags & 0xC000) && (sub->GetMatrix() != nullptr))
|
||||
if (sub->iFlags & 0xC000 && sub->GetMatrix() != nullptr)
|
||||
mlocal = M * glm::dmat4(glm::make_mat4(sub->GetMatrix()->readArray()));
|
||||
|
||||
if (sub->eType < TP_ROTATOR) // a drawable mesh, not a rotator/light/etc.
|
||||
@@ -121,7 +121,7 @@ namespace
|
||||
|
||||
bool editor_mode::editormode_input::init()
|
||||
{
|
||||
return (mouse.init() && keyboard.init());
|
||||
return mouse.init() && keyboard.init();
|
||||
}
|
||||
|
||||
void editor_mode::editormode_input::poll()
|
||||
@@ -172,14 +172,14 @@ void editor_mode::start_focus(scene::basic_node *node, double duration)
|
||||
// distance that frames the object's bounding sphere within the vertical FOV, with some margin
|
||||
double const radius = std::max(1.0, static_cast<double>(node->radius()));
|
||||
double const fovy = glm::radians(static_cast<double>(Global.FieldOfView) / std::max(0.01, static_cast<double>(Global.ZoomFactor)));
|
||||
double distance = (radius / std::tan(fovy * 0.5)) * 1.6;
|
||||
double distance = radius / std::tan(fovy * 0.5) * 1.6;
|
||||
distance = std::clamp(distance, radius * 1.5, static_cast<double>(kMaxPlacementDistance));
|
||||
|
||||
// keep the camera on the side it currently views from, so the move turns toward the object
|
||||
// rather than flying around it; fall back to a pleasant 3/4 direction when sitting on top of it
|
||||
glm::dvec3 dir = Camera.Pos - center;
|
||||
double const len = glm::length(dir);
|
||||
dir = (len > 1e-3) ? dir / len : glm::normalize(glm::dvec3(1.0, 0.5, 1.0));
|
||||
dir = len > 1e-3 ? dir / len : glm::normalize(glm::dvec3(1.0, 0.5, 1.0));
|
||||
|
||||
m_focus_start_pos = Camera.Pos;
|
||||
m_focus_start_angle = Camera.Angle;
|
||||
@@ -354,7 +354,7 @@ scene::basic_node* editor_mode::find_in_hierarchy(const std::string &uuid_str)
|
||||
{
|
||||
if (uuid_str.empty()) return nullptr;
|
||||
auto it = scene::Hierarchy.find(uuid_str);
|
||||
return (it != scene::Hierarchy.end()) ? it->second : nullptr;
|
||||
return it != scene::Hierarchy.end() ? it->second : nullptr;
|
||||
}
|
||||
|
||||
scene::basic_node* editor_mode::find_node_by_any(scene::basic_node *node_ptr, const std::string &uuid_str, const std::string &name)
|
||||
@@ -726,7 +726,7 @@ void editor_mode::render_settings()
|
||||
ImGui::TextUnformatted("Camera movement");
|
||||
|
||||
const char *schemes[] = {"WSAD (new)", "Arrows (legacy)"};
|
||||
int current = (EditorSettings.movement() == editorSettings::movement_scheme::legacy) ? 1 : 0;
|
||||
int current = EditorSettings.movement() == editorSettings::movement_scheme::legacy ? 1 : 0;
|
||||
if (ImGui::Combo("##movement_scheme", ¤t, schemes, IM_ARRAYSIZE(schemes)))
|
||||
{
|
||||
EditorSettings.movement(current == 1 ? editorSettings::movement_scheme::legacy
|
||||
@@ -983,8 +983,8 @@ void editor_mode::handle_chunk_edit_click(bool DeleteMode)
|
||||
// if the clicked cell holds a chunk, target the neighbour nearest the clicked edge (the empty
|
||||
// side); otherwise fill the clicked cell
|
||||
bool const occupied = streaming
|
||||
? (m_streamer.terrain_at(world.x, world.z) != nullptr)
|
||||
: (m_grid_chunks.count({cx, cz}) > 0);
|
||||
? m_streamer.terrain_at(world.x, world.z) != nullptr
|
||||
: m_grid_chunks.count({cx, cz}) > 0;
|
||||
int tcx = cx, tcz = cz;
|
||||
if (occupied)
|
||||
{
|
||||
@@ -1081,7 +1081,7 @@ void editor_mode::handle_terrain_sculpt(double Deltatime)
|
||||
return;
|
||||
|
||||
double const rate = m_terrain_brush_strength * Deltatime; // metres applied this frame
|
||||
double const signedrate = (Global.shiftState ? -rate : rate);
|
||||
double const signedrate = Global.shiftState ? -rate : rate;
|
||||
// apply to every chunk the brush touches; each patch clips to its own bounds, so a stroke
|
||||
// crossing a chunk boundary edits both and shared-edge vertices stay in sync
|
||||
for (editor_terrain *terrain : active_terrains())
|
||||
@@ -1227,7 +1227,7 @@ void editor_mode::render_gizmo()
|
||||
// doesn't expect; rebuild a clean, standard perspective that matches the rendered view.
|
||||
// for the main viewport the engine uses a symmetric frustum with this exact fov/aspect.
|
||||
float const fovy = glm::radians(Global.FieldOfView / Global.ZoomFactor);
|
||||
float const aspect = (io.DisplaySize.y > 0.0f) ? (io.DisplaySize.x / io.DisplaySize.y) : 1.0f;
|
||||
float const aspect = io.DisplaySize.y > 0.0f ? io.DisplaySize.x / io.DisplaySize.y : 1.0f;
|
||||
glm::mat4 const projection = glm::perspective(fovy, aspect, 0.1f, 10000.0f);
|
||||
|
||||
// rotation/scale are only meaningful for instanced models; other node types translate only
|
||||
@@ -1267,7 +1267,7 @@ void editor_mode::render_gizmo()
|
||||
snapvalue = glm::vec3(5.0f);
|
||||
else
|
||||
snapvalue = glm::vec3(0.1f);
|
||||
float const *snap = (Global.ctrlState && snapvalue.x > 0.0f) ? glm::value_ptr(snapvalue) : nullptr;
|
||||
float const *snap = Global.ctrlState && snapvalue.x > 0.0f ? glm::value_ptr(snapvalue) : nullptr;
|
||||
|
||||
ImGuizmo::Manipulate(glm::value_ptr(view), glm::value_ptr(projection),
|
||||
operation, mode, glm::value_ptr(matrix), nullptr, snap);
|
||||
@@ -1316,7 +1316,7 @@ void editor_mode::update_camera(double const Deltatime)
|
||||
if (m_focus_active)
|
||||
{
|
||||
m_focus_time += Deltatime;
|
||||
double t = m_focus_duration > 0.0 ? (m_focus_time / m_focus_duration) : 1.0;
|
||||
double t = m_focus_duration > 0.0 ? m_focus_time / m_focus_duration : 1.0;
|
||||
if (t >= 1.0)
|
||||
t = 1.0;
|
||||
// smoothstep easing
|
||||
@@ -1356,7 +1356,7 @@ void editor_mode::enter()
|
||||
auto const *vehicle = Camera.m_owner;
|
||||
if (vehicle)
|
||||
{
|
||||
const int cab = (vehicle->MoverParameters->CabOccupied == 0 ? 1 : vehicle->MoverParameters->CabOccupied);
|
||||
const int cab = vehicle->MoverParameters->CabOccupied == 0 ? 1 : vehicle->MoverParameters->CabOccupied;
|
||||
const glm::dvec3 left = vehicle->VectorLeft() * (double)cab;
|
||||
Camera.Pos = glm::dvec3(Camera.Pos.x, vehicle->GetPosition().y, Camera.Pos.z) + left * vehicle->GetWidth() + glm::dvec3(1.25f * left.x, 1.6f, 1.25f * left.z);
|
||||
Camera.m_owner = nullptr;
|
||||
@@ -1387,7 +1387,7 @@ void editor_mode::exit()
|
||||
m_gizmo_using = false;
|
||||
ui()->set_node(nullptr);
|
||||
|
||||
Application.set_cursor((Global.ControlPicking ? GLFW_CURSOR_NORMAL : GLFW_CURSOR_DISABLED));
|
||||
Application.set_cursor(Global.ControlPicking ? GLFW_CURSOR_NORMAL : GLFW_CURSOR_DISABLED);
|
||||
|
||||
if (!Global.ControlPicking)
|
||||
{
|
||||
@@ -1398,9 +1398,9 @@ void editor_mode::exit()
|
||||
void editor_mode::on_key(int const Key, int const Scancode, int const Action, int const Mods)
|
||||
{
|
||||
#ifndef __unix__
|
||||
Global.shiftState = (Mods & GLFW_MOD_SHIFT) ? true : false;
|
||||
Global.ctrlState = (Mods & GLFW_MOD_CONTROL) ? true : false;
|
||||
Global.altState = (Mods & GLFW_MOD_ALT) ? true : false;
|
||||
Global.shiftState = Mods & GLFW_MOD_SHIFT ? true : false;
|
||||
Global.ctrlState = Mods & GLFW_MOD_CONTROL ? true : false;
|
||||
Global.altState = Mods & GLFW_MOD_ALT ? true : false;
|
||||
#endif
|
||||
bool anyModifier = Mods & (GLFW_MOD_SHIFT | GLFW_MOD_CONTROL | GLFW_MOD_ALT);
|
||||
|
||||
@@ -1678,11 +1678,11 @@ void editor_mode::render_change_history(){
|
||||
auto &s = m_history[i];
|
||||
char buf[256];
|
||||
std::snprintf(buf, sizeof(buf), "%3d: %s %s pos=(%.1f,%.1f,%.1f)", i,
|
||||
(s.action == EditorSnapshot::Action::Add) ? "ADD" :
|
||||
(s.action == EditorSnapshot::Action::Delete) ? "DEL" :
|
||||
(s.action == EditorSnapshot::Action::Move) ? "MOV" :
|
||||
(s.action == EditorSnapshot::Action::Rotate) ? "ROT" :
|
||||
(s.action == EditorSnapshot::Action::Scale) ? "SCA" : "OTH",
|
||||
s.action == EditorSnapshot::Action::Add ? "ADD" :
|
||||
s.action == EditorSnapshot::Action::Delete ? "DEL" :
|
||||
s.action == EditorSnapshot::Action::Move ? "MOV" :
|
||||
s.action == EditorSnapshot::Action::Rotate ? "ROT" :
|
||||
s.action == EditorSnapshot::Action::Scale ? "SCA" : "OTH",
|
||||
s.node_name.empty() ? "(noname)" : s.node_name.c_str(),
|
||||
s.position.x, s.position.y, s.position.z);
|
||||
|
||||
@@ -1722,7 +1722,7 @@ void editor_mode::on_event_poll()
|
||||
// game-engine style camera: WSAD/EQ only fly the camera while the right mouse button is held.
|
||||
// when it's released the keyboard is free for gizmo shortcuts, and we flush a zero-movement
|
||||
// command once so the camera doesn't keep coasting on the last velocity it was given.
|
||||
bool const flying = (m_input.mouse.button(GLFW_MOUSE_BUTTON_RIGHT) == GLFW_PRESS);
|
||||
bool const flying = m_input.mouse.button(GLFW_MOUSE_BUTTON_RIGHT) == GLFW_PRESS;
|
||||
if (flying)
|
||||
{
|
||||
m_input.poll();
|
||||
|
||||
@@ -95,14 +95,14 @@ void itemproperties_panel::update(scene::basic_node *Node)
|
||||
text_lines.emplace_back(textline, Global.UITextColor);
|
||||
|
||||
// 3d shape
|
||||
auto modelfile{((subnode->pModel != nullptr) ? subnode->pModel->NameGet() : "(none)")};
|
||||
auto modelfile{(subnode->pModel != nullptr ? subnode->pModel->NameGet() : "(none)")};
|
||||
if (modelfile.find(paths::models) == 0)
|
||||
{
|
||||
// don't include 'models/' in the path
|
||||
modelfile.erase(0, std::string{paths::models}.size());
|
||||
}
|
||||
// texture
|
||||
auto texturefile{((subnode->Material()->replacable_skins[1] != null_handle) ? GfxRenderer->Material(subnode->Material()->replacable_skins[1])->GetName() : "(none)")};
|
||||
auto texturefile{(subnode->Material()->replacable_skins[1] != null_handle ? GfxRenderer->Material(subnode->Material()->replacable_skins[1])->GetName() : "(none)")};
|
||||
if (texturefile.find(paths::textures) == 0)
|
||||
{
|
||||
// don't include 'textures/' in the path
|
||||
@@ -129,12 +129,12 @@ void itemproperties_panel::update(scene::basic_node *Node)
|
||||
"\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);
|
||||
// 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)")};
|
||||
if (texturefile.find(paths::textures) == 0)
|
||||
{
|
||||
texturefile.erase(0, std::string{paths::textures}.size());
|
||||
}
|
||||
auto texturefile2{((subnode->m_material2 != null_handle) ? GfxRenderer->Material(subnode->m_material2)->GetName() : "(none)")};
|
||||
auto texturefile2{(subnode->m_material2 != null_handle ? GfxRenderer->Material(subnode->m_material2)->GetName() : "(none)")};
|
||||
if (texturefile2.find(paths::textures) == 0)
|
||||
{
|
||||
texturefile2.erase(0, std::string{paths::textures}.size());
|
||||
@@ -166,13 +166,13 @@ void itemproperties_panel::update(scene::basic_node *Node)
|
||||
}
|
||||
|
||||
textline += (textline.empty() ? "" : "\n") + eventsequence.first + ": [";
|
||||
for (auto const &event : *(eventsequence.second))
|
||||
for (auto const &event : *eventsequence.second)
|
||||
{
|
||||
if (textline.back() != '[')
|
||||
{
|
||||
textline += ", ";
|
||||
}
|
||||
textline += (event.second != nullptr ? Bezogonkow(event.second->m_name) : event.first + " (missing)");
|
||||
textline += event.second != nullptr ? Bezogonkow(event.second->m_name) : event.first + " (missing)";
|
||||
}
|
||||
textline += "] ";
|
||||
}
|
||||
@@ -472,9 +472,9 @@ nodebank_panel::nodebank_panel(std::string const &Name, bool const Isopen) : ui_
|
||||
auto groupend{groupbegin};
|
||||
while (groupbegin != m_nodebank.end())
|
||||
{
|
||||
groupbegin = std::find_if(groupend, m_nodebank.end(), [](auto const &Entry) { return (false == Entry.second->empty()); });
|
||||
groupend = std::find_if(groupbegin, m_nodebank.end(), [](auto const &Entry) { return (Entry.second->empty()); });
|
||||
std::sort(groupbegin, groupend, [](auto const &Left, auto const &Right) { return (Left.first < Right.first); });
|
||||
groupbegin = std::find_if(groupend, m_nodebank.end(), [](auto const &Entry) { return false == Entry.second->empty(); });
|
||||
groupend = std::find_if(groupbegin, m_nodebank.end(), [](auto const &Entry) { return Entry.second->empty(); });
|
||||
std::sort(groupbegin, groupend, [](auto const &Left, auto const &Right) { return Left.first < Right.first; });
|
||||
}
|
||||
}
|
||||
void nodebank_panel::nodebank_reload()
|
||||
@@ -500,9 +500,9 @@ void nodebank_panel::nodebank_reload()
|
||||
auto groupend{groupbegin};
|
||||
while (groupbegin != m_nodebank.end())
|
||||
{
|
||||
groupbegin = std::find_if(groupend, m_nodebank.end(), [](auto const &Entry) { return (false == Entry.second->empty()); });
|
||||
groupend = std::find_if(groupbegin, m_nodebank.end(), [](auto const &Entry) { return (Entry.second->empty()); });
|
||||
std::sort(groupbegin, groupend, [](auto const &Left, auto const &Right) { return (Left.first < Right.first); });
|
||||
groupbegin = std::find_if(groupend, m_nodebank.end(), [](auto const &Entry) { return false == Entry.second->empty(); });
|
||||
groupend = std::find_if(groupbegin, m_nodebank.end(), [](auto const &Entry) { return Entry.second->empty(); });
|
||||
std::sort(groupbegin, groupend, [](auto const &Left, auto const &Right) { return Left.first < Right.first; });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,7 +566,7 @@ void nodebank_panel::render()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ((false == searchfilter.empty()) && (false == contains(entry.first, searchfilter)))
|
||||
if (false == searchfilter.empty() && false == contains(entry.first, searchfilter))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -609,7 +609,7 @@ std::string nodebank_panel::generate_node_label(std::string Input) const
|
||||
replace_slashes(model);
|
||||
erase_extension(model);
|
||||
replace_slashes(texture);
|
||||
return (texture == "none" ? model : model + " (" + texture + ")");
|
||||
return texture == "none" ? model : model + " (" + texture + ")";
|
||||
}
|
||||
|
||||
void functions_panel::update(scene::basic_node const *Node)
|
||||
|
||||
@@ -56,7 +56,7 @@ bool scenarioloader_mode::update() {
|
||||
Application.pop_mode();
|
||||
}
|
||||
|
||||
WriteLog( "Scenario loading time: " + std::to_string( std::chrono::duration_cast<std::chrono::seconds>( ( std::chrono::system_clock::now() - timestart ) ).count() ) + " seconds" );
|
||||
WriteLog( "Scenario loading time: " + std::to_string( std::chrono::duration_cast<std::chrono::seconds>( std::chrono::system_clock::now() - timestart ).count() ) + " seconds" );
|
||||
// TODO: implement and use next mode cue
|
||||
|
||||
Application.pop_mode();
|
||||
|
||||
@@ -474,7 +474,7 @@ void ui_layer::render_hierarchy(){
|
||||
void ui_layer::set_cursor(int const Mode)
|
||||
{
|
||||
glfwSetInputMode(m_window, GLFW_CURSOR, Mode);
|
||||
m_cursorvisible = (Mode != GLFW_CURSOR_DISABLED);
|
||||
m_cursorvisible = Mode != GLFW_CURSOR_DISABLED;
|
||||
}
|
||||
|
||||
void ui_layer::set_progress(std::string const &Text)
|
||||
@@ -614,7 +614,7 @@ void ui_layer::render_background()
|
||||
float tex_h = (float)tex.get_height();
|
||||
|
||||
// skalowanie "cover" – wypełnia cały ekran, zachowując proporcje
|
||||
float scale_factor = (display_size.x / display_size.y) > (tex_w / tex_h) ? display_size.x / tex_w : display_size.y / tex_h;
|
||||
float scale_factor = display_size.x / display_size.y > tex_w / tex_h ? display_size.x / tex_w : display_size.y / tex_h;
|
||||
|
||||
ImVec2 image_size(tex_w * scale_factor, tex_h * scale_factor);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user