mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 13:59:19 +02:00
event condition fixes, cab light control enhancement, manual brake control enhancement
This commit is contained in:
@@ -193,7 +193,7 @@ basic_event::event_conditions::deserialize( cParser &Input ) {
|
|||||||
flags |= flags::text;
|
flags |= flags::text;
|
||||||
}
|
}
|
||||||
Input.getTokens();
|
Input.getTokens();
|
||||||
if( Input.peek() != "*" ) //"*" - nie brac val1 pod uwage
|
if( Input.peek() != "*" ) //"*" - nie brac pod uwage
|
||||||
{ // two tokens, operator followed by comparison value
|
{ // two tokens, operator followed by comparison value
|
||||||
std::string operatorstring;
|
std::string operatorstring;
|
||||||
Input >> operatorstring;
|
Input >> operatorstring;
|
||||||
@@ -203,13 +203,14 @@ basic_event::event_conditions::deserialize( cParser &Input ) {
|
|||||||
flags |= flags::value1;
|
flags |= flags::value1;
|
||||||
}
|
}
|
||||||
Input.getTokens();
|
Input.getTokens();
|
||||||
|
if( Input.peek() != "*" ) //"*" - nie brac pod uwage
|
||||||
{ // two tokens, operator followed by comparison value
|
{ // two tokens, operator followed by comparison value
|
||||||
std::string operatorstring;
|
std::string operatorstring;
|
||||||
Input >> operatorstring;
|
Input >> operatorstring;
|
||||||
memcompare_value2_operator = comparison_operator_from_string( operatorstring );
|
memcompare_value2_operator = comparison_operator_from_string( operatorstring );
|
||||||
Input.getTokens();
|
Input.getTokens();
|
||||||
Input >> memcompare_value2;
|
Input >> memcompare_value2;
|
||||||
flags |= flags::value1;
|
flags |= flags::value2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,12 +157,12 @@ bool TMemCell::Compare( std::string const &szTestText, double const fTestValue1,
|
|||||||
checkfailed |= ( !result );
|
checkfailed |= ( !result );
|
||||||
}
|
}
|
||||||
if( TestFlag( CheckMask, basic_event::flags::value1 ) ) {
|
if( TestFlag( CheckMask, basic_event::flags::value1 ) ) {
|
||||||
auto const result { compare( fValue1, fTestValue1, TextOperator ) };
|
auto const result { compare( fValue1, fTestValue1, Value1Operator ) };
|
||||||
checkpassed |= result;
|
checkpassed |= result;
|
||||||
checkfailed |= ( !result );
|
checkfailed |= ( !result );
|
||||||
}
|
}
|
||||||
if( TestFlag( CheckMask, basic_event::flags::value2 ) ) {
|
if( TestFlag( CheckMask, basic_event::flags::value2 ) ) {
|
||||||
auto const result { compare( fValue2, fTestValue2, TextOperator ) };
|
auto const result { compare( fValue2, fTestValue2, Value2Operator ) };
|
||||||
checkpassed |= result;
|
checkpassed |= result;
|
||||||
checkfailed |= ( !result );
|
checkfailed |= ( !result );
|
||||||
}
|
}
|
||||||
|
|||||||
44
Train.cpp
44
Train.cpp
@@ -4271,14 +4271,11 @@ void TTrain::OnCommand_interiorlightenable( TTrain *Train, command_data const &C
|
|||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
if( Train->ggCabLightButton.SubModel == nullptr ) {
|
if( false == Train->m_controlmapper.contains( "cablight_sw:" ) ) {
|
||||||
// TODO: proper control deviced definition for the interiors, that doesn't hinge of presence of 3d submodels
|
// TODO: proper control deviced definition for the interiors, that doesn't hinge of presence of 3d submodels
|
||||||
WriteLog( "Interior Light switch is missing, or wasn't defined" );
|
WriteLog( "Interior Light switch is missing, or wasn't defined" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// visual feedback
|
|
||||||
Train->ggCabLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
|
||||||
Train->btCabLight.Turn( true );
|
|
||||||
// store lighting switch states
|
// store lighting switch states
|
||||||
if( false == Train->DynamicObject->JointCabs ) {
|
if( false == Train->DynamicObject->JointCabs ) {
|
||||||
// vehicles with separate cabs get separate lighting switch states
|
// vehicles with separate cabs get separate lighting switch states
|
||||||
@@ -4297,14 +4294,11 @@ void TTrain::OnCommand_interiorlightdisable( TTrain *Train, command_data const &
|
|||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
if( Train->ggCabLightButton.SubModel == nullptr ) {
|
if( false == Train->m_controlmapper.contains( "cablight_sw:" ) ) {
|
||||||
// TODO: proper control deviced definition for the interiors, that doesn't hinge of presence of 3d submodels
|
// TODO: proper control deviced definition for the interiors, that doesn't hinge of presence of 3d submodels
|
||||||
WriteLog( "Interior Light switch is missing, or wasn't defined" );
|
WriteLog( "Interior Light switch is missing, or wasn't defined" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// visual feedback
|
|
||||||
Train->ggCabLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
|
||||||
Train->btCabLight.Turn( false );
|
|
||||||
// store lighting switch states
|
// store lighting switch states
|
||||||
if( false == Train->DynamicObject->JointCabs ) {
|
if( false == Train->DynamicObject->JointCabs ) {
|
||||||
// vehicles with separate cabs get separate lighting switch states
|
// vehicles with separate cabs get separate lighting switch states
|
||||||
@@ -6800,10 +6794,6 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
}
|
}
|
||||||
ggLocalBrake.Update();
|
ggLocalBrake.Update();
|
||||||
}
|
}
|
||||||
if (ggManualBrake.SubModel != nullptr) {
|
|
||||||
ggManualBrake.UpdateValue(double(mvOccupied->ManualBrakePos));
|
|
||||||
ggManualBrake.Update();
|
|
||||||
}
|
|
||||||
ggAlarmChain.Update();
|
ggAlarmChain.Update();
|
||||||
ggBrakeProfileCtrl.Update();
|
ggBrakeProfileCtrl.Update();
|
||||||
ggBrakeProfileG.Update();
|
ggBrakeProfileG.Update();
|
||||||
@@ -6940,7 +6930,6 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
ggInstrumentLightButton.Update();
|
ggInstrumentLightButton.Update();
|
||||||
ggDashboardLightButton.Update();
|
ggDashboardLightButton.Update();
|
||||||
ggTimetableLightButton.Update();
|
ggTimetableLightButton.Update();
|
||||||
ggCabLightButton.Update();
|
|
||||||
ggCabLightDimButton.Update();
|
ggCabLightDimButton.Update();
|
||||||
ggCompartmentLightsButton.Update();
|
ggCompartmentLightsButton.Update();
|
||||||
ggCompartmentLightsOnButton.Update();
|
ggCompartmentLightsOnButton.Update();
|
||||||
@@ -7617,6 +7606,8 @@ bool TTrain::InitializeCab(int NewCabNo, std::string const &asFileName)
|
|||||||
cabindex = 0;
|
cabindex = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
iCabn = cabindex;
|
||||||
|
|
||||||
std::string cabstr("cab" + std::to_string(cabindex) + "definition:");
|
std::string cabstr("cab" + std::to_string(cabindex) + "definition:");
|
||||||
|
|
||||||
cParser parser(asFileName, cParser::buffer_FILE);
|
cParser parser(asFileName, cParser::buffer_FILE);
|
||||||
@@ -8212,7 +8203,6 @@ void TTrain::clear_cab_controls()
|
|||||||
ggDirKey.Clear();
|
ggDirKey.Clear();
|
||||||
ggBrakeCtrl.Clear();
|
ggBrakeCtrl.Clear();
|
||||||
ggLocalBrake.Clear();
|
ggLocalBrake.Clear();
|
||||||
ggManualBrake.Clear();
|
|
||||||
ggAlarmChain.Clear();
|
ggAlarmChain.Clear();
|
||||||
ggBrakeProfileCtrl.Clear();
|
ggBrakeProfileCtrl.Clear();
|
||||||
ggBrakeProfileG.Clear();
|
ggBrakeProfileG.Clear();
|
||||||
@@ -8253,7 +8243,6 @@ void TTrain::clear_cab_controls()
|
|||||||
ggDashboardLightButton.Clear();
|
ggDashboardLightButton.Clear();
|
||||||
ggTimetableLightButton.Clear();
|
ggTimetableLightButton.Clear();
|
||||||
// hunter-091012
|
// hunter-091012
|
||||||
ggCabLightButton.Clear();
|
|
||||||
ggCabLightDimButton.Clear();
|
ggCabLightDimButton.Clear();
|
||||||
ggCompartmentLightsButton.Clear();
|
ggCompartmentLightsButton.Clear();
|
||||||
ggCompartmentLightsOnButton.Clear();
|
ggCompartmentLightsOnButton.Clear();
|
||||||
@@ -8403,7 +8392,6 @@ void TTrain::clear_cab_controls()
|
|||||||
btLampkaRearRightLight.Clear();
|
btLampkaRearRightLight.Clear();
|
||||||
btLampkaRearLeftEndLight.Clear();
|
btLampkaRearLeftEndLight.Clear();
|
||||||
btLampkaRearRightEndLight.Clear();
|
btLampkaRearRightEndLight.Clear();
|
||||||
btCabLight.Clear(); // hunter-171012
|
|
||||||
// others
|
// others
|
||||||
btLampkaMalfunction.Clear();
|
btLampkaMalfunction.Clear();
|
||||||
btLampkaMalfunctionB.Clear();
|
btLampkaMalfunctionB.Clear();
|
||||||
@@ -8579,9 +8567,6 @@ void TTrain::set_cab_controls( int const Cab ) {
|
|||||||
ggDimHeadlightsButton.PutValue( 1.f );
|
ggDimHeadlightsButton.PutValue( 1.f );
|
||||||
}
|
}
|
||||||
// cab lights
|
// cab lights
|
||||||
if( true == Cabine[Cab].bLight ) {
|
|
||||||
ggCabLightButton.PutValue( 1.f );
|
|
||||||
}
|
|
||||||
if( true == Cabine[Cab].bLightDim ) {
|
if( true == Cabine[Cab].bLightDim ) {
|
||||||
ggCabLightDimButton.PutValue( 1.f );
|
ggCabLightDimButton.PutValue( 1.f );
|
||||||
}
|
}
|
||||||
@@ -8833,7 +8818,6 @@ bool TTrain::initialize_button(cParser &Parser, std::string const &Label, int co
|
|||||||
{ "i-rearrightend:", btLampkaRearRightEndLight },
|
{ "i-rearrightend:", btLampkaRearRightEndLight },
|
||||||
{ "i-dashboardlight:", btDashboardLight },
|
{ "i-dashboardlight:", btDashboardLight },
|
||||||
{ "i-timetablelight:", btTimetableLight },
|
{ "i-timetablelight:", btTimetableLight },
|
||||||
{ "i-cablight:", btCabLight },
|
|
||||||
{ "i-universal0:", btUniversals[ 0 ] },
|
{ "i-universal0:", btUniversals[ 0 ] },
|
||||||
{ "i-universal1:", btUniversals[ 1 ] },
|
{ "i-universal1:", btUniversals[ 1 ] },
|
||||||
{ "i-universal2:", btUniversals[ 2 ] },
|
{ "i-universal2:", btUniversals[ 2 ] },
|
||||||
@@ -8859,7 +8843,8 @@ bool TTrain::initialize_button(cParser &Parser, std::string const &Label, int co
|
|||||||
{ "i-doorpermit_right:", &mvOccupied->Doors.instances[ ( cab_to_end() == end::front ? side::right : side::left ) ].open_permit },
|
{ "i-doorpermit_right:", &mvOccupied->Doors.instances[ ( cab_to_end() == end::front ? side::right : side::left ) ].open_permit },
|
||||||
{ "i-doorstep:", &mvOccupied->Doors.step_enabled },
|
{ "i-doorstep:", &mvOccupied->Doors.step_enabled },
|
||||||
{ "i-mainpipelock:", &mvOccupied->LockPipe },
|
{ "i-mainpipelock:", &mvOccupied->LockPipe },
|
||||||
{ "i-battery:", &mvOccupied->Battery }
|
{ "i-battery:", &mvOccupied->Battery },
|
||||||
|
{ "i-cablight:", &Cabine[ iCabn ].bLight },
|
||||||
};
|
};
|
||||||
{
|
{
|
||||||
auto lookup = autolights.find( Label );
|
auto lookup = autolights.find( Label );
|
||||||
@@ -8918,7 +8903,6 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
|
|||||||
{ "dirkey:" , ggDirKey },
|
{ "dirkey:" , ggDirKey },
|
||||||
{ "brakectrl:", ggBrakeCtrl },
|
{ "brakectrl:", ggBrakeCtrl },
|
||||||
{ "localbrake:", ggLocalBrake },
|
{ "localbrake:", ggLocalBrake },
|
||||||
{ "manualbrake:", ggManualBrake },
|
|
||||||
{ "alarmchain:", ggAlarmChain },
|
{ "alarmchain:", ggAlarmChain },
|
||||||
{ "brakeprofile_sw:", ggBrakeProfileCtrl },
|
{ "brakeprofile_sw:", ggBrakeProfileCtrl },
|
||||||
{ "brakeprofileg_sw:", ggBrakeProfileG },
|
{ "brakeprofileg_sw:", ggBrakeProfileG },
|
||||||
@@ -9015,7 +8999,6 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
|
|||||||
{ "instrumentlight_sw:", ggInstrumentLightButton },
|
{ "instrumentlight_sw:", ggInstrumentLightButton },
|
||||||
{ "dashboardlight_sw:", ggDashboardLightButton },
|
{ "dashboardlight_sw:", ggDashboardLightButton },
|
||||||
{ "timetablelight_sw:", ggTimetableLightButton },
|
{ "timetablelight_sw:", ggTimetableLightButton },
|
||||||
{ "cablight_sw:", ggCabLightButton },
|
|
||||||
{ "cablightdim_sw:", ggCabLightDimButton },
|
{ "cablightdim_sw:", ggCabLightDimButton },
|
||||||
{ "compartmentlights_sw:", ggCompartmentLightsButton },
|
{ "compartmentlights_sw:", ggCompartmentLightsButton },
|
||||||
{ "compartmentlightson_sw:", ggCompartmentLightsOnButton },
|
{ "compartmentlightson_sw:", ggCompartmentLightsOnButton },
|
||||||
@@ -9084,6 +9067,7 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
|
|||||||
{ "pantfrontoff_sw:", &mvControlled->Pantographs[end::front].valve.is_disabled },
|
{ "pantfrontoff_sw:", &mvControlled->Pantographs[end::front].valve.is_disabled },
|
||||||
{ "pantrearoff_sw:", &mvControlled->Pantographs[end::rear].valve.is_disabled },
|
{ "pantrearoff_sw:", &mvControlled->Pantographs[end::rear].valve.is_disabled },
|
||||||
{ "radio_sw:", &mvOccupied->Radio },
|
{ "radio_sw:", &mvOccupied->Radio },
|
||||||
|
{ "cablight_sw:", &Cabine[ iCabn ].bLight },
|
||||||
};
|
};
|
||||||
{
|
{
|
||||||
auto lookup = autoboolgauges.find( Label );
|
auto lookup = autoboolgauges.find( Label );
|
||||||
@@ -9095,6 +9079,20 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// TODO: move viable dedicated gauges to the automatic array
|
||||||
|
std::unordered_map<std::string, int *> const autointgauges = {
|
||||||
|
{ "manualbrake:", &mvOccupied->ManualBrakePos },
|
||||||
|
};
|
||||||
|
{
|
||||||
|
auto lookup = autointgauges.find( Label );
|
||||||
|
if( lookup != autointgauges.end() ) {
|
||||||
|
auto &gauge = Cabine[ Cabindex ].Gauge( -1 ); // pierwsza wolna lampka
|
||||||
|
gauge.Load( Parser, DynamicObject );
|
||||||
|
gauge.AssignInt( lookup->second );
|
||||||
|
m_controlmapper.insert( gauge, lookup->first );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ABu 090305: uniwersalne przyciski lub inne rzeczy
|
// ABu 090305: uniwersalne przyciski lub inne rzeczy
|
||||||
if( Label == "mainctrlact:" ) {
|
if( Label == "mainctrlact:" ) {
|
||||||
|
|||||||
5
Train.h
5
Train.h
@@ -459,7 +459,6 @@ public: // reszta może by?publiczna
|
|||||||
TGauge ggDirKey;
|
TGauge ggDirKey;
|
||||||
TGauge ggBrakeCtrl;
|
TGauge ggBrakeCtrl;
|
||||||
TGauge ggLocalBrake;
|
TGauge ggLocalBrake;
|
||||||
TGauge ggManualBrake;
|
|
||||||
TGauge ggAlarmChain;
|
TGauge ggAlarmChain;
|
||||||
TGauge ggBrakeProfileCtrl; // nastawiacz GPR - przelacznik obrotowy
|
TGauge ggBrakeProfileCtrl; // nastawiacz GPR - przelacznik obrotowy
|
||||||
TGauge ggBrakeProfileG; // nastawiacz GP - hebelek towarowy
|
TGauge ggBrakeProfileG; // nastawiacz GP - hebelek towarowy
|
||||||
@@ -539,7 +538,7 @@ public: // reszta może by?publiczna
|
|||||||
TGauge ggInstrumentLightButton;
|
TGauge ggInstrumentLightButton;
|
||||||
TGauge ggDashboardLightButton;
|
TGauge ggDashboardLightButton;
|
||||||
TGauge ggTimetableLightButton;
|
TGauge ggTimetableLightButton;
|
||||||
TGauge ggCabLightButton; // hunter-091012: przelacznik oswietlania kabiny
|
// TGauge ggCabLightButton; // hunter-091012: przelacznik oswietlania kabiny
|
||||||
TGauge ggCabLightDimButton; // hunter-091012: przelacznik przyciemnienia
|
TGauge ggCabLightDimButton; // hunter-091012: przelacznik przyciemnienia
|
||||||
// oswietlenia kabiny
|
// oswietlenia kabiny
|
||||||
TGauge ggCompartmentLightsButton;
|
TGauge ggCompartmentLightsButton;
|
||||||
@@ -691,7 +690,7 @@ public: // reszta może by?publiczna
|
|||||||
TButton btLampkaTempomat;
|
TButton btLampkaTempomat;
|
||||||
TButton btLampkaDistanceCounter;
|
TButton btLampkaDistanceCounter;
|
||||||
|
|
||||||
TButton btCabLight; // hunter-171012: lampa oswietlajaca kabine
|
// TButton btCabLight; // hunter-171012: lampa oswietlajaca kabine
|
||||||
// Ra 2013-12: wirtualne "lampki" do odbijania na haslerze w PoKeys
|
// Ra 2013-12: wirtualne "lampki" do odbijania na haslerze w PoKeys
|
||||||
TButton btHaslerBrakes; // ciśnienie w cylindrach
|
TButton btHaslerBrakes; // ciśnienie w cylindrach
|
||||||
TButton btHaslerCurrent; // prąd na silnikach
|
TButton btHaslerCurrent; // prąd na silnikach
|
||||||
|
|||||||
Reference in New Issue
Block a user