mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-19 15:45:23 +01:00
main_off_bt declared with "type: toggle" in the cab's .mmd is now the line breaker's hold coil lever of the ET22 and EP09: it stays where it is put. Off, it opens the line breaker and keeps it from closing (also cancelling a closing armed by a held main_on_bt); back on, it only feeds the coil again. The single keyboard key puts the lever back on before closing, and a line breaker closed by the AI or through the control cable puts the lever back on to match. TGauge now remembers whether type: was given, since every control defaults to toggle. Without type: on main_off_bt (all vehicles today) nothing changes. Data (SVN, not part of this commit): add "type: toggle" to main_off_bt: in dynamic/pkp/et22_v3/*.mmd and dynamic/pkp/ep09_v1, ep09_v2/*.mmd. Older exes ignore it.
35 lines
1.3 KiB
C++
35 lines
1.3 KiB
C++
/*
|
|
This Source Code Form is subject to the
|
|
terms of the Mozilla Public License, v.
|
|
2.0. If a copy of the MPL was not
|
|
distributed with this file, You can
|
|
obtain one at
|
|
http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
// the lever of the line breaker's hold coil (eu07/maszyna#364), as on the ET22 and the EP09: the cab's main_off_bt
|
|
// control declared with "type: toggle" stays in the position it's put in. Position 0 keeps the hold coil fed, so the
|
|
// line breaker can be closed; position 1 cuts the coil off, which opens the line breaker and keeps it from closing
|
|
// until the lever is put back. Without the declared type main_off_bt stays the push button it always was, which
|
|
// opens the line breaker and springs back.
|
|
namespace hold_coil_lever {
|
|
|
|
// whether the main_off_bt control is the bistable lever, from the type its definition declares, if it declares one
|
|
inline bool is_bistable(bool const Typedeclared, bool const Toggletype) {
|
|
return Typedeclared && Toggletype;
|
|
}
|
|
|
|
// whether the lever in the given position cuts off the hold coil
|
|
inline bool cuts_off(float const Position) {
|
|
return Position > 0.5f;
|
|
}
|
|
|
|
// the position the lever goes to when it's operated: the other one
|
|
inline float operated(float const Position) {
|
|
return cuts_off(Position) ? 0.f : 1.f;
|
|
}
|
|
|
|
} // namespace hold_coil_lever
|