mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-19 21:34:58 +01:00
feat: separate engine start switches for the vehicles in multiple (eu07/maszyna#80)
In vehicles like the ST43, the SP32 or the SN61 every engine of a train in
multiple has its own start and stop buttons in the cab. Until now the cab's
line breaker / engine start switch (main_sw, main_on_bt, main_off_bt) always
started and stopped the engines of all the vehicles under its control.
- .fiz, Engine: JointEngineStart=Yes|No (default Yes, as before). With No
the cab's main_* work the cab's own vehicle only, and an engine stopping on
its own (stalled, out of fuel) stops only its own vehicle instead of every
engine in the train.
- .mmd: mainb_sw, mainb_on_bt, mainb_off_bt work the second vehicle with an
engine under the cab's control, mainc_sw, mainc_on_bt, mainc_off_bt the
third one. They count along the control cable from the cab's vehicle,
behind the cab first. Like main_*, the start switch has to be held for the
vehicle's IniCDelay with the vehicle ready (MainSwitchCheck); an impulse
switch of an electric locomotive with series motors closes on release.
- New commands, added at the end of the command list: linebreakertoggleb,
linebreakeropenb, linebreakercloseb, linebreakertogglec, linebreakeropenc,
linebreakerclosec. No default keys.
- The logic is in vehicle/enginestart.{h,cpp} (core library), tested in
tests/unit/test_engine_start.cpp.
Nothing changes for existing vehicles: the new key and the new cab controls
are optional, and without them the code does what it did before.
Game data (SVN, not changed here, to be done separately; the code works
without it): for the SN61 (dynamic/pkp/sn61_v2), whose cab models already
have the buttons start02/stop02/start03/stop03,
- sn61.fiz, sn61-86.fiz, sn61_v1.fiz and the other SN61 .fiz: add
JointEngineStart=No to the Engine: line;
- sn61.mmd.inc (and the other SN61 includes): after main_on_bt add
mainb_off_bt: { stop02 mov -0.005 0 0.1 ... }
mainb_on_bt: { start02 mov -0.005 0 0.1 ... }
mainc_off_bt: { stop03 mov -0.005 0 0.1 ... }
mainc_on_bt: { start03 mov -0.005 0 0.1 ... }
with the sounds of main_off_bt / main_on_bt.
The tooltips "line breaker B" / "line breaker C" are new strings for lang/*.po.
This commit is contained in:
@@ -14,6 +14,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "vehicle/Driver.h"
|
||||
#include "vehicle/Button.h"
|
||||
#include "vehicle/Gauge.h"
|
||||
#include "vehicle/enginestart.h"
|
||||
#include "audio/sound.h"
|
||||
#include "scripting/PyInt.h"
|
||||
#include "input/command.h"
|
||||
@@ -214,6 +215,10 @@ class TTrain {
|
||||
void change_pantograph_selection( int const Change );
|
||||
// helper, common part of pantograh valves state update methods
|
||||
void update_pantograph_valves();
|
||||
// the Index-th other vehicle in multiple whose engine the cab starts with its own switches (0: mainb_*, 1: mainc_*)
|
||||
TMoverParameters *remote_engine( std::size_t const Index ) const;
|
||||
// the switches starting the engines of the other vehicles in multiple, for Deltatime seconds
|
||||
void update_remote_linebreakers( double const Deltatime );
|
||||
// update function subroutines
|
||||
void update_sounds( double const Deltatime );
|
||||
void update_sounds_runningnoise( sound_source &Sound );
|
||||
@@ -338,6 +343,9 @@ class TTrain {
|
||||
static void OnCommand_linebreakertoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_linebreakeropen( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_linebreakerclose( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_linebreakertoggleremote( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_linebreakeropenremote( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_linebreakercloseremote( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_fuelpumptoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_fuelpumpenable( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_fuelpumpdisable( TTrain *Train, command_data const &Command );
|
||||
@@ -570,6 +578,15 @@ public: // reszta może by?publiczna
|
||||
TGauge ggMainOffButton;
|
||||
TGauge ggMainOnButton;
|
||||
TGauge ggMainButton; // EZT
|
||||
// the line breaker / engine start switches of the second and the third vehicle in multiple (mainb_*, mainc_*)
|
||||
struct remote_linebreaker {
|
||||
TGauge main_switch; // mainb_sw:
|
||||
TGauge on_button; // mainb_on_bt:
|
||||
TGauge off_button; // mainb_off_bt:
|
||||
bool held_without_switch{ false }; // closed by a command, in a cab without a switch for it
|
||||
engine_start::remote_switch state;
|
||||
};
|
||||
std::array<remote_linebreaker, 2> m_remotelinebreakers;
|
||||
TGauge ggSecurityResetButton;
|
||||
TGauge ggSHPResetButton;
|
||||
TGauge ggReleaserButton;
|
||||
|
||||
Reference in New Issue
Block a user