mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-17 05:44:10 +01:00
fix: a stopped diesel engine no longer stops the others every frame (eu07/maszyna#80)
dizel_Momentum() relayed MainSwitch 0 to the consist every frame while the engine stood still, whatever stopped it. In a train with mixed JointEngineStart flags an engine stopped from mainb_off stopped the engines behind it once it spun down, and the stopped engine of the cab's vehicle knocked out the one started from mainb_on. The stop is now relayed only when the engine stalls while running, as on master an engine stalling in a joint start still stops the others.
This commit is contained in:
@@ -251,3 +251,48 @@ TEST_CASE("engine start: an engine stopping on its own stops the others only whe
|
||||
CHECK(running(second) == (false == joint));
|
||||
}
|
||||
}
|
||||
|
||||
// a stopped engine stays stopped on its own: only an engine stopping while it ran tells the others, as a joint start's
|
||||
// engines stop together; one stopped from another vehicle's switch, or not started at all, doesn't stop those running,
|
||||
// whatever the flags of the vehicles in a mixed train
|
||||
TEST_CASE("engine start: an engine stopped from its own switch doesn't stop the others when it has spun down") {
|
||||
consist train;
|
||||
// the middle railcar keeps the joint start, as a .fiz without the key does. what a vehicle without the cab relays
|
||||
// goes on away from the cab, so it's the third one that would stop
|
||||
auto &first{train.add(sn61(false), 1).mover()};
|
||||
auto &second{train.add(sn61()).mover()};
|
||||
auto &third{train.add(sn61(false)).mover()};
|
||||
prepare(train);
|
||||
engine_start::remote_switch switchb;
|
||||
engine_start::remote_switch switchc;
|
||||
first.MainSwitch(true, first.MainSwitchRange());
|
||||
hold(train, switchb, engine_start::engine(first, first, 2), 2.0);
|
||||
hold(train, switchc, engine_start::engine(first, first, 3), 2.0);
|
||||
train.run(15.0);
|
||||
REQUIRE(running(first));
|
||||
REQUIRE(running(second));
|
||||
REQUIRE(running(third));
|
||||
// mainb_off
|
||||
CHECK(engine_start::remote_switch::open(second));
|
||||
train.run(30.0);
|
||||
CHECK_FALSE(second.Mains);
|
||||
CHECK(second.enrot == 0.0);
|
||||
CHECK(running(first));
|
||||
CHECK(running(third));
|
||||
}
|
||||
|
||||
TEST_CASE("engine start: the stopped engine of the cab's vehicle doesn't stop the one started from its switch") {
|
||||
consist train;
|
||||
// the cab's railcar keeps the joint start, its engine stopped
|
||||
auto &first{train.add(sn61(), 1).mover()};
|
||||
auto &second{train.add(sn61(false)).mover()};
|
||||
prepare(train);
|
||||
REQUIRE_FALSE(first.Mains);
|
||||
// mainb_on
|
||||
engine_start::remote_switch switchb;
|
||||
hold(train, switchb, engine_start::engine(first, first, 2), 2.0);
|
||||
train.run(15.0);
|
||||
CHECK(running(second));
|
||||
CHECK_FALSE(first.Mains);
|
||||
CHECK(first.enrot == 0.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user