mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-18 07:59:19 +02:00
fix(cab): the line contactors lamp goes out with the pressure switch (eu07/maszyna#470) The lamp of the open line contactors, which tells the start can be made, went out at 1 bar in the brake cylinders, while the pressure switch cuts the start off only at 2 bar (or below 3.6 bar in the main pipe), so with the brakes partly applied the start could be made with the lamp out. With a pressure switch fitted the lamp now follows it; without one it goes out at 1 bar as before. The same holds for the lamp of the second unit, which used to keep its last state between 1 bar and the cut-off. The condition is TMoverParameters::LineContactorsLampLit(). Tests: tests/unit/test_line_contactors.cpp. refactor: Sonar findings of PR 217 - horn_supply::pneumatic shadowed the pneumatic enumerator of the sound flags (cpp:S1117), it's horn_supply::air; the supplies read with using enum (S6177), - CouplerForce(): the automatic coupling refused or caught without another level of nested ifs (S134), the same outcome: too fast, the coupling is locked; caught, coupled and locked; otherwise left to try again, - CompressorCheck(): the power the compressor doesn't draw yet noted without a TODO (S1135), - tests: the previous crash damage setting in an in-class initializer (S3230), the loops which stop early with break rather than in their conditions (S886), the stand-ins of test::pair in a std::vector rather than an array (S5945), units in the comments of the example without /* */ (S1103). test: the cases the changes of the branch left without a test - Cntrl.: BDelay1 to BDelay4 reach the brake delays (now through std::format), the default start types of the ground and converter overload relays of a multiple unit and of other vehicles (out of the nested conditionals), - the compressor: fed from the low voltage it waits from the low voltage coming on; the pressure switch stops it above the cut-out pressure, without one the excess air is vented (the vented fraction rewritten), - the horns: a vehicle without any air sounds as before, the threshold pressure, an electric horn on 110 V, - the positions of a cab control below zero, and a control without position sounds. refactor(cab): the kind of the train heating switch as a flag Read once with the vehicle definition, rather than compared as text in each of the switch commands. feat(cab): train heating switch springing back (MaSzyna-EU07/maszyna#85) TrainHeating=[toggle]|impulse in the Switches: section of the vehicle definition makes the train heating switch an unstable one: it goes up to switch the heating on, down to switch it off, and back to the middle once let go, instead of staying where it was put. The position of such a switch isn't set from the heating state when the cab is entered. Tests: tests/unit/test_switches.cpp. feat(sound): mirror sounds (MaSzyna-EU07/maszyna#84, eu07/maszyna#322) The sound definitions of a vehicle (.mmd) take mirroropen: and mirrorclose:, played as a mirror sets off unfolding or folding, and the locations section mirrors: <offset>... end, the offsets along the vehicle of the mirror pairs, as for the doors (negative ahead of the centre), each pair at the sides of the vehicle. As the animation, only the mirrors at the occupied cab sound. The start of a move is mirror_moves::motion in vehicle/mirrors.h. Tests: tests/unit/test_mirrors.cpp. feat(cab): joint oil and fuel pump switch (MaSzyna-EU07/maszyna#81) A cab control oilfuelpump_sw: switches both the oil and the fuel pump at once, with the new command oilfuelpumptoggle (no key by default). As a two-state switch it turns both pumps off when both are on and both on otherwise; as an impulse switch it's held to start them, like the separate pump switches. Its position follows the pumps when the cab is entered. refactor(editor): text fields filled without strncpy (MaSzyna-EU07/maszyna#112) The last three strncpy calls Sonar flags (cpp:S5816), in the road and track editors, copy the text into the ImGui field buffers with std::string::copy and terminate it right after; the text gets cut to the buffer as before. fix: automatic coupler crashes, horns, compressor start delay, radio and cab lever sounds - automatic couplers don't catch above the safe collision speed (#86): with crash damage on they couple at a closing speed of 15 km/h at most, a faster hit locks the coupling until the vehicles part and the collision runs its course. On the way: CollisionVelocity() read a head-on 10 + 10 km/h as 14.1 km/h (quaternions turn by half the angle), it's now taken from the touching ends; CollisionDetect() took the other vehicle's speed the wrong way round for vehicles facing each other. Head-on hits now derail sooner, at the intended limit, - a single horn lever can't sound both tones at once (eu07/maszyna#392), - a skid ends once the vehicle stops on locked wheels (eu07/maszyna#479), - electronic destination signs are blanked at the end of the timetable (eu07/maszyna#446), - horns need the air or the voltage to sound (eu07/maszyna#290, #76): HornType=[Pneumatic]|Electric and Horn3Type in Cntrl.; a pneumatic horn needs 0.2 MPa in the main reservoir (or the main pipe without one), an electric one the low voltage; the lever stays where it was put, - compressor start delay (#67): CompressorStartDelay [s] in Brake., counted from the compressor getting its power, after the engine starts say; none by default, - the channel and volume buttons of a radio without power do nothing (eu07/maszyna#429); the power check of the radio is TMoverParameters::RadioPowered(), - a lever moved smoothly sounds the positions it passes (#83). Sonar findings in the functions changed: nesting, nested conditionals, commented-out code, std::format, references to const. Unit tests: test::pair for two vehicles running into each other, test_couplers, test_horn, test_wheelslip, test_compressor, test_radio, test_gauge_positions.
908 lines
55 KiB
C++
908 lines
55 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/.
|
|
*/
|
|
|
|
#include "stdafx.h"
|
|
#include "input/command.h"
|
|
|
|
#include "utilities/Globals.h"
|
|
#include "utilities/Logs.h"
|
|
#include "utilities/Timer.h"
|
|
#include "simulation/simulation.h"
|
|
#include "vehicle/Train.h"
|
|
|
|
namespace simulation {
|
|
|
|
command_queue Commands;
|
|
commanddescription_sequence Commands_descriptions = {
|
|
|
|
{"aidriverenable", command_target::vehicle, command_mode::oneoff},
|
|
{"aidriverdisable", command_target::vehicle, command_mode::oneoff},
|
|
{"jointcontrollerset", command_target::vehicle, command_mode::oneoff},
|
|
{"mastercontrollerincrease", command_target::vehicle, command_mode::oneoff},
|
|
{"mastercontrollerincreasefast", command_target::vehicle, command_mode::oneoff},
|
|
{"mastercontrollerdecrease", command_target::vehicle, command_mode::oneoff},
|
|
{"mastercontrollerdecreasefast", command_target::vehicle, command_mode::oneoff},
|
|
{"mastercontrollerset", command_target::vehicle, command_mode::oneoff},
|
|
|
|
{"dynamicbrakecontrollerincrease", command_target::vehicle, command_mode::oneoff},
|
|
{"dynamicbrakecontrollerdecrease", command_target::vehicle, command_mode::oneoff},
|
|
{"dynamicbrakecontrollerset", command_target::vehicle, command_mode::oneoff},
|
|
{"dynamicbrakecontrollerincreasefast", command_target::vehicle, command_mode::oneoff},
|
|
{"dynamicbrakecontrollerdecreasefast", command_target::vehicle, command_mode::oneoff},
|
|
|
|
{"secondcontrollerincrease", command_target::vehicle, command_mode::oneoff},
|
|
{"secondcontrollerincreasefast", command_target::vehicle, command_mode::oneoff},
|
|
{"secondcontrollerdecrease", command_target::vehicle, command_mode::oneoff},
|
|
{"secondcontrollerdecreasefast", command_target::vehicle, command_mode::oneoff},
|
|
{"secondcontrollerset", command_target::vehicle, command_mode::oneoff},
|
|
{"mucurrentindicatorothersourceactivate", command_target::vehicle, command_mode::oneoff},
|
|
{"independentbrakeincrease", command_target::vehicle, command_mode::continuous},
|
|
{"independentbrakeincreasefast", command_target::vehicle, command_mode::oneoff},
|
|
{"independentbrakedecrease", command_target::vehicle, command_mode::continuous},
|
|
{"independentbrakedecreasefast", command_target::vehicle, command_mode::oneoff},
|
|
{"independentbrakeset", command_target::vehicle, command_mode::oneoff},
|
|
{"independentbrakebailoff", command_target::vehicle, command_mode::oneoff},
|
|
{"universalbrakebutton1", command_target::vehicle, command_mode::oneoff},
|
|
{"universalbrakebutton2", command_target::vehicle, command_mode::oneoff},
|
|
{"universalbrakebutton3", command_target::vehicle, command_mode::oneoff},
|
|
{"trainbrakeincrease", command_target::vehicle, command_mode::continuous},
|
|
{"trainbrakedecrease", command_target::vehicle, command_mode::continuous},
|
|
{"trainbrakeset", command_target::vehicle, command_mode::oneoff},
|
|
{"trainbrakecharging", command_target::vehicle, command_mode::oneoff},
|
|
{"trainbrakerelease", command_target::vehicle, command_mode::oneoff},
|
|
{"trainbrakefirstservice", command_target::vehicle, command_mode::oneoff},
|
|
{"trainbrakeservice", command_target::vehicle, command_mode::oneoff},
|
|
{"trainbrakefullservice", command_target::vehicle, command_mode::oneoff},
|
|
{"trainbrakehandleoff", command_target::vehicle, command_mode::oneoff},
|
|
{"trainbrakeemergency", command_target::vehicle, command_mode::oneoff},
|
|
{"trainbrakebasepressureincrease", command_target::vehicle, command_mode::oneoff},
|
|
{"trainbrakebasepressuredecrease", command_target::vehicle, command_mode::oneoff},
|
|
{"trainbrakebasepressurereset", command_target::vehicle, command_mode::oneoff},
|
|
{"trainbrakeoperationtoggle", command_target::vehicle, command_mode::oneoff},
|
|
{"manualbrakeincrease", command_target::vehicle, command_mode::oneoff},
|
|
{"manualbrakedecrease", command_target::vehicle, command_mode::oneoff},
|
|
{"alarmchaintoggle", command_target::vehicle, command_mode::oneoff},
|
|
{"alarmchainenable", command_target::vehicle, command_mode::oneoff},
|
|
{"alarmchaindisable", command_target::vehicle, command_mode::oneoff},
|
|
{"wheelspinbrakeactivate", command_target::vehicle, command_mode::oneoff},
|
|
{"sandboxactivate", command_target::vehicle, command_mode::oneoff},
|
|
{"autosandboxtoggle", command_target::vehicle, command_mode::oneoff},
|
|
{"autosandboxactivate", command_target::vehicle, command_mode::oneoff},
|
|
{"autosandboxdeactivate", command_target::vehicle, command_mode::oneoff},
|
|
{"reverserincrease", command_target::vehicle, command_mode::oneoff},
|
|
{"reverserdecrease", command_target::vehicle, command_mode::oneoff},
|
|
{"reverserforwardhigh", command_target::vehicle, command_mode::oneoff},
|
|
{"reverserforward", command_target::vehicle, command_mode::oneoff},
|
|
{"reverserneutral", command_target::vehicle, command_mode::oneoff},
|
|
{"reverserbackward", command_target::vehicle, command_mode::oneoff},
|
|
{"waterpumpbreakertoggle", command_target::vehicle, command_mode::oneoff},
|
|
{"waterpumpbreakerclose", command_target::vehicle, command_mode::oneoff},
|
|
{"waterpumpbreakeropen", command_target::vehicle, command_mode::oneoff},
|
|
{"waterpumptoggle", command_target::vehicle, command_mode::oneoff},
|
|
{"waterpumpenable", command_target::vehicle, command_mode::oneoff},
|
|
{"waterpumpdisable", command_target::vehicle, command_mode::oneoff},
|
|
{"waterheaterbreakertoggle", command_target::vehicle, command_mode::oneoff},
|
|
{"waterheaterbreakerclose", command_target::vehicle, command_mode::oneoff},
|
|
{"waterheaterbreakeropen", command_target::vehicle, command_mode::oneoff},
|
|
{"waterheatertoggle", command_target::vehicle, command_mode::oneoff},
|
|
{"waterheaterenable", command_target::vehicle, command_mode::oneoff},
|
|
{"waterheaterdisable", command_target::vehicle, command_mode::oneoff},
|
|
{"watercircuitslinktoggle", command_target::vehicle, command_mode::oneoff},
|
|
{"watercircuitslinkenable", command_target::vehicle, command_mode::oneoff},
|
|
{"watercircuitslinkdisable", command_target::vehicle, command_mode::oneoff},
|
|
{"fuelpumptoggle", command_target::vehicle, command_mode::oneoff},
|
|
{"fuelpumpenable", command_target::vehicle, command_mode::oneoff},
|
|
{"fuelpumpdisable", command_target::vehicle, command_mode::oneoff},
|
|
{"oilpumptoggle", command_target::vehicle, command_mode::oneoff},
|
|
{"oilpumpenable", command_target::vehicle, command_mode::oneoff},
|
|
{"oilpumpdisable", command_target::vehicle, command_mode::oneoff},
|
|
{"linebreakertoggle", command_target::vehicle, command_mode::oneoff},
|
|
{"linebreakeropen", command_target::vehicle, command_mode::oneoff},
|
|
{"linebreakerclose", command_target::vehicle, command_mode::oneoff},
|
|
{"convertertoggle", command_target::vehicle, command_mode::oneoff},
|
|
{"converterenable", command_target::vehicle, command_mode::oneoff},
|
|
{"converterdisable", command_target::vehicle, command_mode::oneoff},
|
|
{"convertertogglelocal", command_target::vehicle, command_mode::oneoff},
|
|
{"converteroverloadrelayreset", command_target::vehicle, command_mode::oneoff},
|
|
{"compressortoggle", command_target::vehicle, command_mode::oneoff},
|
|
{"compressorenable", command_target::vehicle, command_mode::oneoff},
|
|
{"compressordisable", command_target::vehicle, command_mode::oneoff},
|
|
{"compressortogglelocal", command_target::vehicle, command_mode::oneoff},
|
|
{"compressorpresetactivatenext", command_target::vehicle, command_mode::oneoff},
|
|
{"compressorpresetactivateprevious", command_target::vehicle, command_mode::oneoff},
|
|
{"compressorpresetactivatedefault", command_target::vehicle, command_mode::oneoff},
|
|
{"motoroverloadrelaythresholdtoggle", command_target::vehicle, command_mode::oneoff},
|
|
{"motoroverloadrelaythresholdsetlow", command_target::vehicle, command_mode::oneoff},
|
|
{"motoroverloadrelaythresholdsethigh", command_target::vehicle, command_mode::oneoff},
|
|
{"motoroverloadrelayreset", command_target::vehicle, command_mode::oneoff},
|
|
{"universalrelayreset1", command_target::vehicle, command_mode::oneoff},
|
|
{"universalrelayreset2", command_target::vehicle, command_mode::oneoff},
|
|
{"universalrelayreset3", command_target::vehicle, command_mode::oneoff},
|
|
{"notchingrelaytoggle", command_target::vehicle, command_mode::oneoff},
|
|
{"epbrakecontroltoggle", command_target::vehicle, command_mode::oneoff},
|
|
{"epbrakecontrolenable", command_target::vehicle, command_mode::oneoff},
|
|
{"epbrakecontroldisable", command_target::vehicle, command_mode::oneoff},
|
|
{"trainbrakeoperationmodeincrease", command_target::vehicle, command_mode::oneoff},
|
|
{"trainbrakeoperationmodedecrease", command_target::vehicle, command_mode::oneoff},
|
|
{"brakeactingspeedincrease", command_target::vehicle, command_mode::oneoff},
|
|
{"brakeactingspeeddecrease", command_target::vehicle, command_mode::oneoff},
|
|
{"brakeactingspeedsetcargo", command_target::vehicle, command_mode::oneoff},
|
|
{"brakeactingspeedsetpassenger", command_target::vehicle, command_mode::oneoff},
|
|
{"brakeactingspeedsetrapid", command_target::vehicle, command_mode::oneoff},
|
|
{"brakeloadcompensationincrease", command_target::vehicle, command_mode::oneoff},
|
|
{"brakeloadcompensationdecrease", command_target::vehicle, command_mode::oneoff},
|
|
{"mubrakingindicatortoggle", command_target::vehicle, command_mode::oneoff},
|
|
{"alerteracknowledge", command_target::vehicle, command_mode::oneoff},
|
|
{"cabsignalacknowledge", command_target::vehicle, command_mode::oneoff},
|
|
{"hornlowactivate", command_target::vehicle, command_mode::oneoff},
|
|
{"hornhighactivate", command_target::vehicle, command_mode::oneoff},
|
|
{"whistleactivate", command_target::vehicle, command_mode::oneoff},
|
|
{"radiotoggle", command_target::vehicle, command_mode::oneoff},
|
|
{"radioenable", command_target::vehicle, command_mode::oneoff},
|
|
{"radiodisable", command_target::vehicle, command_mode::oneoff},
|
|
{"radiochannelincrease", command_target::vehicle, command_mode::oneoff},
|
|
{"radiochanneldecrease", command_target::vehicle, command_mode::oneoff},
|
|
{"radiochannelset", command_target::vehicle, command_mode::oneoff},
|
|
{"radiostopsend", command_target::vehicle, command_mode::oneoff},
|
|
{"radiostopenable", command_target::vehicle, command_mode::oneoff},
|
|
{"radiostopdisable", command_target::vehicle, command_mode::oneoff},
|
|
{"radiostoptest", command_target::vehicle, command_mode::oneoff},
|
|
{"radiocall1send", command_target::vehicle, command_mode::oneoff},
|
|
{"radiocall3send", command_target::vehicle, command_mode::oneoff},
|
|
{"radiovolumeincrease", command_target::vehicle, command_mode::oneoff},
|
|
{"radiovolumedecrease", command_target::vehicle, command_mode::oneoff},
|
|
{"radiovolumeset", command_target::vehicle, command_mode::oneoff},
|
|
{"cabchangeforward", command_target::vehicle, command_mode::oneoff},
|
|
{"cabchangebackward", command_target::vehicle, command_mode::oneoff},
|
|
{"modernlightdimmerdecrease", command_target::vehicle, command_mode::oneoff},
|
|
{"modernlightdimmerincrease", command_target::vehicle, command_mode::oneoff},
|
|
{ "viewturn", command_target::entity, command_mode::oneoff },
|
|
{ "movehorizontal", command_target::entity, command_mode::oneoff },
|
|
{ "movehorizontalfast", command_target::entity, command_mode::oneoff },
|
|
{ "movevertical", command_target::entity, command_mode::oneoff },
|
|
{ "moveverticalfast", command_target::entity, command_mode::oneoff },
|
|
{ "moveleft", command_target::entity, command_mode::oneoff },
|
|
{ "moveright", command_target::entity, command_mode::oneoff },
|
|
{ "moveforward", command_target::entity, command_mode::oneoff },
|
|
{ "moveback", command_target::entity, command_mode::oneoff },
|
|
{ "moveup", command_target::entity, command_mode::oneoff },
|
|
{ "movedown", command_target::entity, command_mode::oneoff },
|
|
{ "nearestcarcouplingincrease", command_target::vehicle, command_mode::oneoff },
|
|
{ "nearestcarcouplingdisconnect", command_target::vehicle, command_mode::oneoff },
|
|
{ "nearestcarcoupleradapterattach", command_target::vehicle, command_mode::oneoff },
|
|
{ "nearestcarcoupleradapterremove", command_target::vehicle, command_mode::oneoff },
|
|
{ "occupiedcarcouplingdisconnect", command_target::vehicle, command_mode::oneoff },
|
|
{ "occupiedcarcouplingdisconnectback", command_target::vehicle, command_mode::oneoff },
|
|
{ "doortoggleleft", command_target::vehicle, command_mode::oneoff },
|
|
{ "doortoggleright", command_target::vehicle, command_mode::oneoff },
|
|
{ "doorpermitleft", command_target::vehicle, command_mode::oneoff },
|
|
{ "doorpermitright", command_target::vehicle, command_mode::oneoff },
|
|
{ "doorpermitpresetactivatenext", command_target::vehicle, command_mode::oneoff },
|
|
{ "doorpermitpresetactivateprevious", command_target::vehicle, command_mode::oneoff },
|
|
{ "dooropenleft", command_target::vehicle, command_mode::oneoff },
|
|
{ "dooropenright", command_target::vehicle, command_mode::oneoff },
|
|
{ "dooropenall", command_target::vehicle, command_mode::oneoff },
|
|
{ "doorcloseleft", command_target::vehicle, command_mode::oneoff },
|
|
{ "doorcloseright", command_target::vehicle, command_mode::oneoff },
|
|
{ "doorcloseall", command_target::vehicle, command_mode::oneoff },
|
|
{ "doorsteptoggle", command_target::vehicle, command_mode::oneoff },
|
|
{ "doormodetoggle", command_target::vehicle, command_mode::oneoff },
|
|
{ "mirrorstoggle", command_target::vehicle, command_mode::oneoff },
|
|
{ "departureannounce", command_target::vehicle, command_mode::oneoff },
|
|
{ "doorlocktoggle", command_target::vehicle, command_mode::oneoff },
|
|
{ "pantographcompressorvalvetoggle", command_target::vehicle, command_mode::oneoff },
|
|
{ "pantographcompressorvalveenable", command_target::vehicle, command_mode::oneoff },
|
|
{ "pantographcompressorvalvedisable", command_target::vehicle, command_mode::oneoff },
|
|
{ "pantographcompressoractivate", command_target::vehicle, command_mode::oneoff },
|
|
{ "pantographtogglefront", command_target::vehicle, command_mode::oneoff },
|
|
{ "pantographtogglerear", command_target::vehicle, command_mode::oneoff },
|
|
{ "pantographraisefront", command_target::vehicle, command_mode::oneoff },
|
|
{ "pantographraiserear", command_target::vehicle, command_mode::oneoff },
|
|
{ "pantographlowerfront", command_target::vehicle, command_mode::oneoff },
|
|
{ "pantographlowerrear", command_target::vehicle, command_mode::oneoff },
|
|
{ "pantographlowerall", command_target::vehicle, command_mode::oneoff },
|
|
{ "pantographselectnext", command_target::vehicle, command_mode::oneoff },
|
|
{ "pantographselectprevious", command_target::vehicle, command_mode::oneoff },
|
|
{ "pantographtoggleselected", command_target::vehicle, command_mode::oneoff },
|
|
{ "pantographraiseselected", command_target::vehicle, command_mode::oneoff },
|
|
{ "pantographlowerselected", command_target::vehicle, command_mode::oneoff },
|
|
{ "pantographvalvesupdate", command_target::vehicle, command_mode::oneoff },
|
|
{ "pantographvalvesoff", command_target::vehicle, command_mode::oneoff },
|
|
{ "heatingtoggle", command_target::vehicle, command_mode::oneoff },
|
|
{ "heatingenable", command_target::vehicle, command_mode::oneoff },
|
|
{ "heatingdisable", command_target::vehicle, command_mode::oneoff },
|
|
{ "lightspresetactivatenext", command_target::vehicle, command_mode::oneoff },
|
|
{ "lightspresetactivateprevious", command_target::vehicle, command_mode::oneoff },
|
|
{ "headlighttoggleleft", command_target::vehicle, command_mode::oneoff },
|
|
{ "headlightenableleft", command_target::vehicle, command_mode::oneoff },
|
|
{ "headlightdisableleft", command_target::vehicle, command_mode::oneoff },
|
|
{ "headlighttoggleright", command_target::vehicle, command_mode::oneoff },
|
|
{ "headlightenableright", command_target::vehicle, command_mode::oneoff },
|
|
{ "headlightdisableright", command_target::vehicle, command_mode::oneoff },
|
|
{ "headlighttoggleupper", command_target::vehicle, command_mode::oneoff },
|
|
{ "headlightenableupper", command_target::vehicle, command_mode::oneoff },
|
|
{ "headlightdisableupper", command_target::vehicle, command_mode::oneoff },
|
|
{ "redmarkertoggleleft", command_target::vehicle, command_mode::oneoff },
|
|
{ "redmarkerenableleft", command_target::vehicle, command_mode::oneoff },
|
|
{ "redmarkerdisableleft", command_target::vehicle, command_mode::oneoff },
|
|
{ "redmarkertoggleright", command_target::vehicle, command_mode::oneoff },
|
|
{ "redmarkerenableright", command_target::vehicle, command_mode::oneoff },
|
|
{ "redmarkerdisableright", command_target::vehicle, command_mode::oneoff },
|
|
{ "headlighttogglerearleft", command_target::vehicle, command_mode::oneoff },
|
|
{ "headlightenablerearleft", command_target::vehicle, command_mode::oneoff },
|
|
{ "headlightdisablerearleft", command_target::vehicle, command_mode::oneoff },
|
|
{ "headlighttogglerearright", command_target::vehicle, command_mode::oneoff },
|
|
{ "headlightenablerearright", command_target::vehicle, command_mode::oneoff },
|
|
{ "headlightdisablerearright", command_target::vehicle, command_mode::oneoff },
|
|
{ "headlighttogglerearupper", command_target::vehicle, command_mode::oneoff },
|
|
{ "headlightenablerearupper", command_target::vehicle, command_mode::oneoff },
|
|
{ "headlightdisablerearupper", command_target::vehicle, command_mode::oneoff },
|
|
{ "redmarkertogglerearleft", command_target::vehicle, command_mode::oneoff },
|
|
{ "redmarkerenablerearleft", command_target::vehicle, command_mode::oneoff },
|
|
{ "redmarkerdisablerearleft", command_target::vehicle, command_mode::oneoff },
|
|
{ "redmarkertogglerearright", command_target::vehicle, command_mode::oneoff },
|
|
{ "redmarkerenablerearright", command_target::vehicle, command_mode::oneoff },
|
|
{ "redmarkerdisablerearright", command_target::vehicle, command_mode::oneoff },
|
|
{ "redmarkerstoggle", command_target::vehicle, command_mode::oneoff },
|
|
{ "endsignalstoggle", command_target::vehicle, command_mode::oneoff },
|
|
{ "headlightsdimtoggle", command_target::vehicle, command_mode::oneoff },
|
|
{ "headlightsdimenable", command_target::vehicle, command_mode::oneoff },
|
|
{ "headlightsdimdisable", command_target::vehicle, command_mode::oneoff },
|
|
{ "motorconnectorsopen", command_target::vehicle, command_mode::oneoff },
|
|
{ "motorconnectorsclose", command_target::vehicle, command_mode::oneoff },
|
|
{ "motordisconnect", command_target::vehicle, command_mode::oneoff },
|
|
{ "interiorlighttoggle", command_target::vehicle, command_mode::oneoff },
|
|
{ "interiorlightenable", command_target::vehicle, command_mode::oneoff },
|
|
{ "interiorlightdisable", command_target::vehicle, command_mode::oneoff },
|
|
{ "interiorlightdimtoggle", command_target::vehicle, command_mode::oneoff },
|
|
{ "interiorlightdimenable", command_target::vehicle, command_mode::oneoff },
|
|
{ "interiorlightdimdisable", command_target::vehicle, command_mode::oneoff },
|
|
{ "compartmentlightstoggle", command_target::vehicle, command_mode::oneoff },
|
|
{ "compartmentlightsenable", command_target::vehicle, command_mode::oneoff },
|
|
{ "compartmentlightsdisable", command_target::vehicle, command_mode::oneoff },
|
|
{ "instrumentlighttoggle", command_target::vehicle, command_mode::oneoff },
|
|
{ "instrumentlightenable", command_target::vehicle, command_mode::oneoff },
|
|
{ "instrumentlightdisable", command_target::vehicle, command_mode::oneoff },
|
|
{ "dashboardlighttoggle", command_target::vehicle, command_mode::oneoff },
|
|
{ "dashboardlightenable", command_target::vehicle, command_mode::oneoff },
|
|
{ "dashboardlightdisable", command_target::vehicle, command_mode::oneoff },
|
|
{ "timetablelighttoggle", command_target::vehicle, command_mode::oneoff },
|
|
{ "timetablelightenable", command_target::vehicle, command_mode::oneoff },
|
|
{ "timetablelightdisable", command_target::vehicle, command_mode::oneoff },
|
|
{"generictoggle0", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle1", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle2", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle3", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle4", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle5", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle6", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle7", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle8", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle9", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle10", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle11", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle12", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle13", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle14", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle15", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle16", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle17", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle18", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle19", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle20", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle21", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle22", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle23", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle24", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle25", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle26", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle27", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle28", command_target::vehicle, command_mode::oneoff},
|
|
{"generictoggle29", command_target::vehicle, command_mode::oneoff},
|
|
{ "batterytoggle", command_target::vehicle, command_mode::oneoff },
|
|
{ "batteryenable", command_target::vehicle, command_mode::oneoff },
|
|
{ "batterydisable", command_target::vehicle, command_mode::oneoff },
|
|
{ "cabactivationtoggle", command_target::vehicle, command_mode::oneoff },
|
|
{ "cabactivationenable", command_target::vehicle, command_mode::oneoff },
|
|
{ "cabactivationdisable", command_target::vehicle, command_mode::oneoff },
|
|
{ "motorblowerstogglefront", command_target::vehicle, command_mode::oneoff },
|
|
{ "motorblowerstogglerear", command_target::vehicle, command_mode::oneoff },
|
|
{ "motorblowersdisableall", command_target::vehicle, command_mode::oneoff },
|
|
{ "coolingfanstoggle", command_target::vehicle, command_mode::oneoff },
|
|
{ "tempomattoggle", command_target::vehicle, command_mode::oneoff },
|
|
{ "springbraketoggle", command_target::vehicle, command_mode::oneoff },
|
|
{ "springbrakeenable", command_target::vehicle, command_mode::oneoff },
|
|
{ "springbrakedisable", command_target::vehicle, command_mode::oneoff },
|
|
{ "springbrakeshutofftoggle", command_target::vehicle, command_mode::oneoff },
|
|
{ "springbrakeshutoffenable", command_target::vehicle, command_mode::oneoff },
|
|
{ "springbrakeshutoffdisable", command_target::vehicle, command_mode::oneoff },
|
|
{ "springbrakerelease", command_target::vehicle },
|
|
{ "distancecounteractivate", command_target::vehicle, command_mode::oneoff },
|
|
{ "speedcontrolincrease", command_target::vehicle, command_mode::oneoff },
|
|
{ "speedcontroldecrease", command_target::vehicle, command_mode::oneoff },
|
|
{ "speedcontrolpowerincrease", command_target::vehicle, command_mode::oneoff },
|
|
{ "speedcontrolpowerdecrease", command_target::vehicle, command_mode::oneoff },
|
|
{ "speedcontrolbutton0", command_target::vehicle, command_mode::oneoff },
|
|
{ "speedcontrolbutton1", command_target::vehicle, command_mode::oneoff },
|
|
{ "speedcontrolbutton2", command_target::vehicle, command_mode::oneoff },
|
|
{ "speedcontrolbutton3", command_target::vehicle, command_mode::oneoff },
|
|
{ "speedcontrolbutton4", command_target::vehicle, command_mode::oneoff },
|
|
{ "speedcontrolbutton5", command_target::vehicle, command_mode::oneoff },
|
|
{ "speedcontrolbutton6", command_target::vehicle, command_mode::oneoff },
|
|
{ "speedcontrolbutton7", command_target::vehicle, command_mode::oneoff },
|
|
{ "speedcontrolbutton8", command_target::vehicle, command_mode::oneoff },
|
|
{ "speedcontrolbutton9", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterenable1", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterenable2", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterenable3", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterenable4", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterenable5", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterenable6", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterenable7", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterenable8", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterenable9", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterenable10", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterenable11", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterenable12", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterdisable1", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterdisable2", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterdisable3", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterdisable4", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterdisable5", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterdisable6", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterdisable7", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterdisable8", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterdisable9", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterdisable10", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterdisable11", command_target::vehicle, command_mode::oneoff },
|
|
{ "inverterdisable12", command_target::vehicle, command_mode::oneoff },
|
|
{ "invertertoggle1", command_target::vehicle, command_mode::oneoff },
|
|
{ "invertertoggle2", command_target::vehicle, command_mode::oneoff },
|
|
{ "invertertoggle3", command_target::vehicle, command_mode::oneoff },
|
|
{ "invertertoggle4", command_target::vehicle, command_mode::oneoff },
|
|
{ "invertertoggle5", command_target::vehicle, command_mode::oneoff },
|
|
{ "invertertoggle6", command_target::vehicle, command_mode::oneoff },
|
|
{ "invertertoggle7", command_target::vehicle, command_mode::oneoff },
|
|
{ "invertertoggle8", command_target::vehicle, command_mode::oneoff },
|
|
{ "invertertoggle9", command_target::vehicle, command_mode::oneoff },
|
|
{ "invertertoggle10", command_target::vehicle, command_mode::oneoff },
|
|
{ "invertertoggle11", command_target::vehicle, command_mode::oneoff },
|
|
{ "invertertoggle12", command_target::vehicle, command_mode::oneoff },
|
|
{ "globalradiostop", command_target::simulation, command_mode::oneoff },
|
|
{ "timejump", command_target::simulation, command_mode::oneoff },
|
|
{ "timejumplarge", command_target::simulation, command_mode::oneoff },
|
|
{ "timejumpsmall", command_target::simulation, command_mode::oneoff },
|
|
{ "setdatetime", command_target::simulation, command_mode::oneoff },
|
|
{ "setweather", command_target::simulation, command_mode::oneoff },
|
|
{ "settemperature", command_target::simulation, command_mode::oneoff },
|
|
{ "vehiclemoveforwards", command_target::vehicle, command_mode::oneoff },
|
|
{ "vehiclemovebackwards", command_target::vehicle, command_mode::oneoff },
|
|
{ "vehicleboost", command_target::vehicle, command_mode::oneoff },
|
|
{ "debugtoggle", command_target::simulation, command_mode::oneoff },
|
|
{ "focuspauseset", command_target::simulation, command_mode::oneoff },
|
|
{ "pausetoggle", command_target::simulation, command_mode::oneoff },
|
|
{ "entervehicle", command_target::simulation, command_mode::oneoff },
|
|
{ "resetconsist", command_target::simulation, command_mode::oneoff },
|
|
{ "fillcompressor", command_target::simulation, command_mode::oneoff },
|
|
{ "consistreleaser", command_target::simulation, command_mode::oneoff },
|
|
{ "queueevent", command_target::simulation, command_mode::oneoff },
|
|
{ "setlight", command_target::simulation, command_mode::oneoff },
|
|
{ "insertmodel", command_target::simulation, command_mode::oneoff },
|
|
{ "deletemodel", command_target::simulation, command_mode::oneoff },
|
|
{ "trainsetmove", command_target::simulation, command_mode::oneoff },
|
|
{ "consistteleport", command_target::simulation, command_mode::oneoff },
|
|
{ "pullalarmchain", command_target::simulation, command_mode::oneoff },
|
|
{ "sendaicommand", command_target::simulation, command_mode::oneoff },
|
|
{ "spawntrainset", command_target::simulation, command_mode::oneoff },
|
|
{ "destroytrainset", command_target::simulation, command_mode::oneoff },
|
|
{ "quitsimulation", command_target::simulation, command_mode::oneoff },
|
|
{"wiperswitchincrease", command_target::vehicle, command_mode::oneoff},
|
|
{"wiperswitchdecrease", command_target::vehicle, command_mode::oneoff},
|
|
{"lightsset", command_target::vehicle, command_mode::oneoff},
|
|
{"oilfuelpumptoggle", command_target::vehicle, command_mode::oneoff},
|
|
};
|
|
|
|
// Maps of command and coresponding strings
|
|
std::unordered_map<std::string, user_command> const commandMap = {
|
|
{"aidriverdisable", user_command::aidriverdisable},
|
|
{"jointcontrollerset", user_command::jointcontrollerset},
|
|
{"mastercontrollerincrease", user_command::mastercontrollerincrease},
|
|
{"mastercontrollerincreasefast", user_command::mastercontrollerincreasefast},
|
|
{"mastercontrollerdecrease", user_command::mastercontrollerdecrease},
|
|
{"mastercontrollerdecreasefast", user_command::mastercontrollerdecreasefast},
|
|
{"mastercontrollerset", user_command::mastercontrollerset},
|
|
{"dynamicbrakecontrollerincrease", user_command::dynamicbrakecontrollerincrease},
|
|
{"dynamicbrakecontrollerdecrease", user_command::dynamicbrakecontrollerdecrease},
|
|
{"dynamicbrakecontrollerset", user_command::dynamicbrakecontrollerset},
|
|
{"dynamicbrakecontrollerincreasefast", user_command::dynamicbrakecontrollerincreasefast},
|
|
{"dynamicbrakecontrollerdecreasefast", user_command::dynamicbrakecontrollerdecreasefast},
|
|
{"secondcontrollerincrease", user_command::secondcontrollerincrease},
|
|
{"secondcontrollerincreasefast", user_command::secondcontrollerincreasefast},
|
|
{"secondcontrollerdecrease", user_command::secondcontrollerdecrease},
|
|
{"secondcontrollerdecreasefast", user_command::secondcontrollerdecreasefast},
|
|
{"secondcontrollerset", user_command::secondcontrollerset},
|
|
{"mucurrentindicatorothersourceactivate", user_command::mucurrentindicatorothersourceactivate},
|
|
{"independentbrakeincrease", user_command::independentbrakeincrease},
|
|
{"independentbrakeincreasefast", user_command::independentbrakeincreasefast},
|
|
{"independentbrakedecrease", user_command::independentbrakedecrease},
|
|
{"independentbrakedecreasefast", user_command::independentbrakedecreasefast},
|
|
{"independentbrakeset", user_command::independentbrakeset},
|
|
{"independentbrakebailoff", user_command::independentbrakebailoff},
|
|
{"universalbrakebutton1", user_command::universalbrakebutton1},
|
|
{"universalbrakebutton2", user_command::universalbrakebutton2},
|
|
{"universalbrakebutton3", user_command::universalbrakebutton3},
|
|
{"trainbrakeincrease", user_command::trainbrakeincrease},
|
|
{"trainbrakedecrease", user_command::trainbrakedecrease},
|
|
{"trainbrakeset", user_command::trainbrakeset},
|
|
{"trainbrakecharging", user_command::trainbrakecharging},
|
|
{"trainbrakerelease", user_command::trainbrakerelease},
|
|
{"trainbrakefirstservice", user_command::trainbrakefirstservice},
|
|
{"trainbrakeservice", user_command::trainbrakeservice},
|
|
{"trainbrakefullservice", user_command::trainbrakefullservice},
|
|
{"trainbrakehandleoff", user_command::trainbrakehandleoff},
|
|
{"trainbrakeemergency", user_command::trainbrakeemergency},
|
|
{"trainbrakebasepressureincrease", user_command::trainbrakebasepressureincrease},
|
|
{"trainbrakebasepressuredecrease", user_command::trainbrakebasepressuredecrease},
|
|
{"trainbrakebasepressurereset", user_command::trainbrakebasepressurereset},
|
|
{"trainbrakeoperationtoggle", user_command::trainbrakeoperationtoggle},
|
|
{"manualbrakeincrease", user_command::manualbrakeincrease},
|
|
{"manualbrakedecrease", user_command::manualbrakedecrease},
|
|
{"alarmchaintoggle", user_command::alarmchaintoggle},
|
|
{"alarmchainenable", user_command::alarmchainenable},
|
|
{"alarmchaindisable", user_command::alarmchaindisable},
|
|
{"wheelspinbrakeactivate", user_command::wheelspinbrakeactivate},
|
|
{"sandboxactivate", user_command::sandboxactivate},
|
|
{"autosandboxtoggle", user_command::autosandboxtoggle},
|
|
{"autosandboxactivate", user_command::autosandboxactivate},
|
|
{"autosandboxdeactivate", user_command::autosandboxdeactivate},
|
|
{"reverserincrease", user_command::reverserincrease},
|
|
{"reverserdecrease", user_command::reverserdecrease},
|
|
{"reverserforwardhigh", user_command::reverserforwardhigh},
|
|
{"reverserforward", user_command::reverserforward},
|
|
{"reverserneutral", user_command::reverserneutral},
|
|
{"reverserbackward", user_command::reverserbackward},
|
|
{"waterpumpbreakertoggle", user_command::waterpumpbreakertoggle},
|
|
{"waterpumpbreakerclose", user_command::waterpumpbreakerclose},
|
|
{"waterpumpbreakeropen", user_command::waterpumpbreakeropen},
|
|
{"waterpumptoggle", user_command::waterpumptoggle},
|
|
{"waterpumpenable", user_command::waterpumpenable},
|
|
{"waterpumpdisable", user_command::waterpumpdisable},
|
|
{"waterheaterbreakertoggle", user_command::waterheaterbreakertoggle},
|
|
{"waterheaterbreakerclose", user_command::waterheaterbreakerclose},
|
|
{"waterheaterbreakeropen", user_command::waterheaterbreakeropen},
|
|
{"waterheatertoggle", user_command::waterheatertoggle},
|
|
{"waterheaterenable", user_command::waterheaterenable},
|
|
{"waterheaterdisable", user_command::waterheaterdisable},
|
|
{"watercircuitslinktoggle", user_command::watercircuitslinktoggle},
|
|
{"watercircuitslinkenable", user_command::watercircuitslinkenable},
|
|
{"watercircuitslinkdisable", user_command::watercircuitslinkdisable},
|
|
{"fuelpumptoggle", user_command::fuelpumptoggle},
|
|
{"fuelpumpenable", user_command::fuelpumpenable},
|
|
{"fuelpumpdisable", user_command::fuelpumpdisable},
|
|
{"oilpumptoggle", user_command::oilpumptoggle},
|
|
{"oilpumpenable", user_command::oilpumpenable},
|
|
{"oilpumpdisable", user_command::oilpumpdisable},
|
|
{"linebreakertoggle", user_command::linebreakertoggle},
|
|
{"linebreakeropen", user_command::linebreakeropen},
|
|
{"linebreakerclose", user_command::linebreakerclose},
|
|
{"convertertoggle", user_command::convertertoggle},
|
|
{"converterenable", user_command::converterenable},
|
|
{"converterdisable", user_command::converterdisable},
|
|
{"convertertogglelocal", user_command::convertertogglelocal},
|
|
{"converteroverloadrelayreset", user_command::converteroverloadrelayreset},
|
|
{"compressortoggle", user_command::compressortoggle},
|
|
{"compressorenable", user_command::compressorenable},
|
|
{"compressordisable", user_command::compressordisable},
|
|
{"compressortogglelocal", user_command::compressortogglelocal},
|
|
{"compressorpresetactivatenext", user_command::compressorpresetactivatenext},
|
|
{"compressorpresetactivateprevious", user_command::compressorpresetactivateprevious},
|
|
{"compressorpresetactivatedefault", user_command::compressorpresetactivatedefault},
|
|
{"motoroverloadrelaythresholdtoggle", user_command::motoroverloadrelaythresholdtoggle},
|
|
{"motoroverloadrelaythresholdsetlow", user_command::motoroverloadrelaythresholdsetlow},
|
|
{"motoroverloadrelaythresholdsethigh", user_command::motoroverloadrelaythresholdsethigh},
|
|
{"motoroverloadrelayreset", user_command::motoroverloadrelayreset},
|
|
{"universalrelayreset1", user_command::universalrelayreset1},
|
|
{"universalrelayreset2", user_command::universalrelayreset2},
|
|
{"universalrelayreset3", user_command::universalrelayreset3},
|
|
{"notchingrelaytoggle", user_command::notchingrelaytoggle},
|
|
{"epbrakecontroltoggle", user_command::epbrakecontroltoggle},
|
|
{"epbrakecontrolenable", user_command::epbrakecontrolenable},
|
|
{"epbrakecontroldisable", user_command::epbrakecontroldisable},
|
|
{"trainbrakeoperationmodeincrease", user_command::trainbrakeoperationmodeincrease},
|
|
{"trainbrakeoperationmodedecrease", user_command::trainbrakeoperationmodedecrease},
|
|
{"brakeactingspeedincrease", user_command::brakeactingspeedincrease},
|
|
{"brakeactingspeeddecrease", user_command::brakeactingspeeddecrease},
|
|
{"brakeactingspeedsetcargo", user_command::brakeactingspeedsetcargo},
|
|
{"brakeactingspeedsetpassenger", user_command::brakeactingspeedsetpassenger},
|
|
{"brakeactingspeedsetrapid", user_command::brakeactingspeedsetrapid},
|
|
{"brakeloadcompensationincrease", user_command::brakeloadcompensationincrease},
|
|
{"brakeloadcompensationdecrease", user_command::brakeloadcompensationdecrease},
|
|
{"mubrakingindicatortoggle", user_command::mubrakingindicatortoggle},
|
|
{"alerteracknowledge", user_command::alerteracknowledge},
|
|
{"cabsignalacknowledge", user_command::cabsignalacknowledge},
|
|
{"hornlowactivate", user_command::hornlowactivate},
|
|
{"hornhighactivate", user_command::hornhighactivate},
|
|
{"whistleactivate", user_command::whistleactivate},
|
|
{"radiotoggle", user_command::radiotoggle},
|
|
{"radioenable", user_command::radioenable},
|
|
{"radiodisable", user_command::radiodisable},
|
|
{"radiochannelincrease", user_command::radiochannelincrease},
|
|
{"radiochanneldecrease", user_command::radiochanneldecrease},
|
|
{"radiochannelset", user_command::radiochannelset},
|
|
{"radiostopsend", user_command::radiostopsend},
|
|
{"radiostopenable", user_command::radiostopenable},
|
|
{"radiostopdisable", user_command::radiostopdisable},
|
|
{"radiostoptest", user_command::radiostoptest},
|
|
{"radiocall1send", user_command::radiocall1send},
|
|
{"radiocall3send", user_command::radiocall3send},
|
|
{"radiovolumeincrease", user_command::radiovolumeincrease},
|
|
{"radiovolumedecrease", user_command::radiovolumedecrease},
|
|
{"radiovolumeset", user_command::radiovolumeset},
|
|
{"cabchangeforward", user_command::cabchangeforward},
|
|
{"cabchangebackward", user_command::cabchangebackward},
|
|
{"viewturn", user_command::viewturn},
|
|
{"movehorizontal", user_command::movehorizontal},
|
|
{"movehorizontalfast", user_command::movehorizontalfast},
|
|
{"movevertical", user_command::movevertical},
|
|
{"moveverticalfast", user_command::moveverticalfast},
|
|
{"moveleft", user_command::moveleft},
|
|
{"moveright", user_command::moveright},
|
|
{"moveforward", user_command::moveforward},
|
|
{"moveback", user_command::moveback},
|
|
{"moveup", user_command::moveup},
|
|
{"movedown", user_command::movedown},
|
|
{"nearestcarcouplingincrease", user_command::nearestcarcouplingincrease},
|
|
{"nearestcarcouplingdisconnect", user_command::nearestcarcouplingdisconnect},
|
|
{"nearestcarcoupleradapterattach", user_command::nearestcarcoupleradapterattach},
|
|
{"nearestcarcoupleradapterremove", user_command::nearestcarcoupleradapterremove},
|
|
{"occupiedcarcouplingdisconnect", user_command::occupiedcarcouplingdisconnect},
|
|
{"occupiedcarcouplingdisconnectback", user_command::occupiedcarcouplingdisconnectback},
|
|
{"doortoggleleft", user_command::doortoggleleft},
|
|
{"doortoggleright", user_command::doortoggleright},
|
|
{"doorpermitleft", user_command::doorpermitleft},
|
|
{"doorpermitright", user_command::doorpermitright},
|
|
{"doorpermitpresetactivatenext", user_command::doorpermitpresetactivatenext},
|
|
{"doorpermitpresetactivateprevious", user_command::doorpermitpresetactivateprevious},
|
|
{"dooropenleft", user_command::dooropenleft},
|
|
{"dooropenright", user_command::dooropenright},
|
|
{"dooropenall", user_command::dooropenall},
|
|
{"doorcloseleft", user_command::doorcloseleft},
|
|
{"doorcloseright", user_command::doorcloseright},
|
|
{"doorcloseall", user_command::doorcloseall},
|
|
{"doorsteptoggle", user_command::doorsteptoggle},
|
|
{"doormodetoggle", user_command::doormodetoggle},
|
|
{"mirrorstoggle", user_command::mirrorstoggle},
|
|
{"departureannounce", user_command::departureannounce},
|
|
{"doorlocktoggle", user_command::doorlocktoggle},
|
|
{"pantographcompressorvalvetoggle", user_command::pantographcompressorvalvetoggle},
|
|
{"pantographcompressorvalveenable", user_command::pantographcompressorvalveenable},
|
|
{"pantographcompressorvalvedisable", user_command::pantographcompressorvalvedisable},
|
|
{"pantographcompressoractivate", user_command::pantographcompressoractivate},
|
|
{"pantographtogglefront", user_command::pantographtogglefront},
|
|
{"pantographtogglerear", user_command::pantographtogglerear},
|
|
{"pantographraisefront", user_command::pantographraisefront},
|
|
{"pantographraiserear", user_command::pantographraiserear},
|
|
{"pantographlowerfront", user_command::pantographlowerfront},
|
|
{"pantographlowerrear", user_command::pantographlowerrear},
|
|
{"pantographlowerall", user_command::pantographlowerall},
|
|
{"pantographselectnext", user_command::pantographselectnext},
|
|
{"pantographselectprevious", user_command::pantographselectprevious},
|
|
{"pantographtoggleselected", user_command::pantographtoggleselected},
|
|
{"pantographraiseselected", user_command::pantographraiseselected},
|
|
{"pantographlowerselected", user_command::pantographlowerselected},
|
|
{"pantographvalvesupdate", user_command::pantographvalvesupdate},
|
|
{"pantographvalvesoff", user_command::pantographvalvesoff},
|
|
{"heatingtoggle", user_command::heatingtoggle},
|
|
{"heatingenable", user_command::heatingenable},
|
|
{"heatingdisable", user_command::heatingdisable},
|
|
{"lightspresetactivatenext", user_command::lightspresetactivatenext},
|
|
{"lightspresetactivateprevious", user_command::lightspresetactivateprevious},
|
|
{"headlighttoggleleft", user_command::headlighttoggleleft},
|
|
{"headlightenableleft", user_command::headlightenableleft},
|
|
{"headlightdisableleft", user_command::headlightdisableleft},
|
|
{"headlighttoggleright", user_command::headlighttoggleright},
|
|
{"headlightenableright", user_command::headlightenableright},
|
|
{"headlightdisableright", user_command::headlightdisableright},
|
|
{"headlighttoggleupper", user_command::headlighttoggleupper},
|
|
{"headlightenableupper", user_command::headlightenableupper},
|
|
{"headlightdisableupper", user_command::headlightdisableupper},
|
|
{"redmarkertoggleleft", user_command::redmarkertoggleleft},
|
|
{"redmarkerenableleft", user_command::redmarkerenableleft},
|
|
{"redmarkerdisableleft", user_command::redmarkerdisableleft},
|
|
{"redmarkertoggleright", user_command::redmarkertoggleright},
|
|
{"redmarkerenableright", user_command::redmarkerenableright},
|
|
{"redmarkerdisableright", user_command::redmarkerdisableright},
|
|
{"headlighttogglerearleft", user_command::headlighttogglerearleft},
|
|
{"headlightenablerearleft", user_command::headlightenablerearleft},
|
|
{"headlightdisablerearleft", user_command::headlightdisablerearleft},
|
|
{"headlighttogglerearright", user_command::headlighttogglerearright},
|
|
{"headlightenablerearright", user_command::headlightenablerearright},
|
|
{"headlightdisablerearright", user_command::headlightdisablerearright},
|
|
{"headlighttogglerearupper", user_command::headlighttogglerearupper},
|
|
{"headlightenablerearupper", user_command::headlightenablerearupper},
|
|
{"headlightdisablerearupper", user_command::headlightdisablerearupper},
|
|
{"redmarkertogglerearleft", user_command::redmarkertogglerearleft},
|
|
{"redmarkerenablerearleft", user_command::redmarkerenablerearleft},
|
|
{"redmarkerdisablerearleft", user_command::redmarkerdisablerearleft},
|
|
{"redmarkertogglerearright", user_command::redmarkertogglerearright},
|
|
{"redmarkerenablerearright", user_command::redmarkerenablerearright},
|
|
{"redmarkerdisablerearright", user_command::redmarkerdisablerearright},
|
|
{"redmarkerstoggle", user_command::redmarkerstoggle},
|
|
{"endsignalstoggle", user_command::endsignalstoggle},
|
|
{"headlightsdimtoggle", user_command::headlightsdimtoggle},
|
|
{"headlightsdimenable", user_command::headlightsdimenable},
|
|
{"headlightsdimdisable", user_command::headlightsdimdisable},
|
|
{"motorconnectorsopen", user_command::motorconnectorsopen},
|
|
{"motorconnectorsclose", user_command::motorconnectorsclose},
|
|
{"motordisconnect", user_command::motordisconnect},
|
|
{"interiorlighttoggle", user_command::interiorlighttoggle},
|
|
{"interiorlightenable", user_command::interiorlightenable},
|
|
{"interiorlightdisable", user_command::interiorlightdisable},
|
|
{"interiorlightdimtoggle", user_command::interiorlightdimtoggle},
|
|
{"interiorlightdimenable", user_command::interiorlightdimenable},
|
|
{"interiorlightdimdisable", user_command::interiorlightdimdisable},
|
|
{"compartmentlightstoggle", user_command::compartmentlightstoggle},
|
|
{"compartmentlightsenable", user_command::compartmentlightsenable},
|
|
{"compartmentlightsdisable", user_command::compartmentlightsdisable},
|
|
{"instrumentlighttoggle", user_command::instrumentlighttoggle},
|
|
{"instrumentlightenable", user_command::instrumentlightenable},
|
|
{"instrumentlightdisable", user_command::instrumentlightdisable},
|
|
{"dashboardlighttoggle", user_command::dashboardlighttoggle},
|
|
{"dashboardlightenable", user_command::dashboardlightenable},
|
|
{"dashboardlightdisable", user_command::dashboardlightdisable},
|
|
{"timetablelighttoggle", user_command::timetablelighttoggle},
|
|
{"timetablelightenable", user_command::timetablelightenable},
|
|
{"timetablelightdisable", user_command::timetablelightdisable},
|
|
{"generictoggle0", user_command::generictoggle0},
|
|
{"generictoggle1", user_command::generictoggle1},
|
|
{"generictoggle2", user_command::generictoggle2},
|
|
{"generictoggle3", user_command::generictoggle3},
|
|
{"generictoggle4", user_command::generictoggle4},
|
|
{"generictoggle5", user_command::generictoggle5},
|
|
{"generictoggle6", user_command::generictoggle6},
|
|
{"generictoggle7", user_command::generictoggle7},
|
|
{"generictoggle8", user_command::generictoggle8},
|
|
{"generictoggle9", user_command::generictoggle9},
|
|
{"generictoggle10", user_command::generictoggle10},
|
|
{"generictoggle11", user_command::generictoggle11},
|
|
{"generictoggle12", user_command::generictoggle12},
|
|
{"generictoggle13", user_command::generictoggle13},
|
|
{"generictoggle14", user_command::generictoggle14},
|
|
{"generictoggle15", user_command::generictoggle15},
|
|
{"generictoggle16", user_command::generictoggle16},
|
|
{"generictoggle17", user_command::generictoggle17},
|
|
{"generictoggle18", user_command::generictoggle18},
|
|
{"generictoggle19", user_command::generictoggle19},
|
|
{"generictoggle20", user_command::generictoggle20},
|
|
{"generictoggle21", user_command::generictoggle21},
|
|
{"generictoggle22", user_command::generictoggle22},
|
|
{"generictoggle23", user_command::generictoggle23},
|
|
{"generictoggle24", user_command::generictoggle24},
|
|
{"generictoggle25", user_command::generictoggle25},
|
|
{"generictoggle26", user_command::generictoggle26},
|
|
{"generictoggle27", user_command::generictoggle27},
|
|
{"generictoggle28", user_command::generictoggle28},
|
|
{"generictoggle29", user_command::generictoggle29},
|
|
|
|
{"batterytoggle", user_command::batterytoggle},
|
|
{"batteryenable", user_command::batteryenable},
|
|
{"batterydisable", user_command::batterydisable},
|
|
{"cabactivationtoggle", user_command::cabactivationtoggle},
|
|
{"cabactivationenable", user_command::cabactivationenable},
|
|
{"cabactivationdisable", user_command::cabactivationdisable},
|
|
{"motorblowerstogglefront", user_command::motorblowerstogglefront},
|
|
{"motorblowerstogglerear", user_command::motorblowerstogglerear},
|
|
{"motorblowersdisableall", user_command::motorblowersdisableall},
|
|
{"coolingfanstoggle", user_command::coolingfanstoggle},
|
|
{"tempomattoggle", user_command::tempomattoggle},
|
|
{"springbraketoggle", user_command::springbraketoggle},
|
|
{"springbrakeenable", user_command::springbrakeenable},
|
|
{"springbrakedisable", user_command::springbrakedisable},
|
|
{"springbrakeshutofftoggle", user_command::springbrakeshutofftoggle},
|
|
{"springbrakeshutoffenable", user_command::springbrakeshutoffenable},
|
|
{"springbrakeshutoffdisable", user_command::springbrakeshutoffdisable},
|
|
{"springbrakerelease", user_command::springbrakerelease},
|
|
{"distancecounteractivate", user_command::distancecounteractivate},
|
|
{"speedcontrolincrease", user_command::speedcontrolincrease},
|
|
{"speedcontroldecrease", user_command::speedcontroldecrease},
|
|
{"speedcontrolpowerincrease", user_command::speedcontrolpowerincrease},
|
|
{"speedcontrolpowerdecrease", user_command::speedcontrolpowerdecrease},
|
|
{"speedcontrolbutton0", user_command::speedcontrolbutton0},
|
|
{"speedcontrolbutton1", user_command::speedcontrolbutton1},
|
|
{"speedcontrolbutton2", user_command::speedcontrolbutton2},
|
|
{"speedcontrolbutton3", user_command::speedcontrolbutton3},
|
|
{"speedcontrolbutton4", user_command::speedcontrolbutton4},
|
|
{"speedcontrolbutton5", user_command::speedcontrolbutton5},
|
|
{"speedcontrolbutton6", user_command::speedcontrolbutton6},
|
|
{"speedcontrolbutton7", user_command::speedcontrolbutton7},
|
|
{"speedcontrolbutton8", user_command::speedcontrolbutton8},
|
|
{"speedcontrolbutton9", user_command::speedcontrolbutton9},
|
|
{"inverterenable1", user_command::inverterenable1},
|
|
{"inverterenable2", user_command::inverterenable2},
|
|
{"inverterenable3", user_command::inverterenable3},
|
|
{"inverterenable4", user_command::inverterenable4},
|
|
{"inverterenable5", user_command::inverterenable5},
|
|
{"inverterenable6", user_command::inverterenable6},
|
|
{"inverterenable7", user_command::inverterenable7},
|
|
{"inverterenable8", user_command::inverterenable8},
|
|
{"inverterenable9", user_command::inverterenable9},
|
|
{"inverterenable10", user_command::inverterenable10},
|
|
{"inverterenable11", user_command::inverterenable11},
|
|
{"inverterenable12", user_command::inverterenable12},
|
|
{"inverterdisable1", user_command::inverterdisable1},
|
|
{"inverterdisable2", user_command::inverterdisable2},
|
|
{"inverterdisable3", user_command::inverterdisable3},
|
|
{"inverterdisable4", user_command::inverterdisable4},
|
|
{"inverterdisable5", user_command::inverterdisable5},
|
|
{"inverterdisable6", user_command::inverterdisable6},
|
|
{"inverterdisable7", user_command::inverterdisable7},
|
|
{"inverterdisable8", user_command::inverterdisable8},
|
|
{"inverterdisable9", user_command::inverterdisable9},
|
|
{"inverterdisable10", user_command::inverterdisable10},
|
|
{"inverterdisable11", user_command::inverterdisable11},
|
|
{"inverterdisable12", user_command::inverterdisable12},
|
|
{"invertertoggle1", user_command::invertertoggle1},
|
|
{"invertertoggle2", user_command::invertertoggle2},
|
|
{"invertertoggle3", user_command::invertertoggle3},
|
|
{"invertertoggle4", user_command::invertertoggle4},
|
|
{"invertertoggle5", user_command::invertertoggle5},
|
|
{"invertertoggle6", user_command::invertertoggle6},
|
|
{"invertertoggle7", user_command::invertertoggle7},
|
|
{"invertertoggle8", user_command::invertertoggle8},
|
|
{"invertertoggle9", user_command::invertertoggle9},
|
|
{"invertertoggle10", user_command::invertertoggle10},
|
|
{"invertertoggle11", user_command::invertertoggle11},
|
|
{"invertertoggle12", user_command::invertertoggle12},
|
|
{"globalradiostop", user_command::globalradiostop},
|
|
{"timejump", user_command::timejump},
|
|
{"timejumplarge", user_command::timejumplarge},
|
|
{"timejumpsmall", user_command::timejumpsmall},
|
|
{"setdatetime", user_command::setdatetime},
|
|
{"setweather", user_command::setweather},
|
|
{"settemperature", user_command::settemperature},
|
|
{"vehiclemoveforwards", user_command::vehiclemoveforwards},
|
|
{"vehiclemovebackwards", user_command::vehiclemovebackwards},
|
|
{"vehicleboost", user_command::vehicleboost},
|
|
{"debugtoggle", user_command::debugtoggle},
|
|
{"focuspauseset", user_command::focuspauseset},
|
|
{"pausetoggle", user_command::pausetoggle},
|
|
{"entervehicle", user_command::entervehicle},
|
|
{"resetconsist", user_command::resetconsist},
|
|
{"fillcompressor", user_command::fillcompressor},
|
|
{"consistreleaser", user_command::consistreleaser},
|
|
{"queueevent", user_command::queueevent},
|
|
{"setlight", user_command::setlight},
|
|
{"insertmodel", user_command::insertmodel},
|
|
{"deletemodel", user_command::deletemodel},
|
|
{"dynamicmove", user_command::dynamicmove},
|
|
{"consistteleport", user_command::consistteleport},
|
|
{"pullalarmchain", user_command::pullalarmchain},
|
|
{"sendaicommand", user_command::sendaicommand},
|
|
{"spawntrainset", user_command::spawntrainset},
|
|
{"destroytrainset", user_command::destroytrainset},
|
|
{"quitsimulation", user_command::quitsimulation},
|
|
{"wiperswitchincrease", user_command::wiperswitchincrease},
|
|
{"wiperswitchdecrease", user_command::wiperswitchdecrease},
|
|
{"lightsset", user_command::lightsset},
|
|
{"oilfuelpumptoggle", user_command::oilfuelpumptoggle},
|
|
{"none", user_command::none}};
|
|
|
|
} // namespace simulation
|
|
|
|
void command_queue::update()
|
|
{
|
|
double delta = Timer::GetDeltaTime();
|
|
for (auto [activecommand, activerecipient] : m_active_continuous)
|
|
{
|
|
command_data data({activecommand, GLFW_REPEAT, 0.0, 0.0, delta, false, glm::vec3()}); // todo: improve
|
|
auto [queueiterator, queueinserted] = m_commands.try_emplace( activerecipient, commanddata_sequence() );
|
|
// recipient stack was either located or created, so we can add to it quite safely
|
|
queueiterator->second.emplace_back( data );
|
|
}
|
|
}
|
|
|
|
// posts specified command for specified recipient
|
|
void
|
|
command_queue::push( command_data const &Command, uint32_t const Recipient ) {
|
|
if (is_network_target(Recipient)) {
|
|
auto [queueiterator, queueinserted] = m_intercept_queue.try_emplace(Recipient, commanddata_sequence());
|
|
queueiterator->second.emplace_back(Command);
|
|
} else {
|
|
push_direct(Command, Recipient);
|
|
}
|
|
}
|
|
|
|
void command_queue::push_direct(const command_data &Command, const uint32_t Recipient) {
|
|
if (auto const &desc = simulation::Commands_descriptions[ static_cast<std::size_t>( Command.command ) ]; desc.mode == command_mode::continuous)
|
|
{
|
|
if (Command.action == GLFW_PRESS)
|
|
m_active_continuous.emplace(std::make_pair(Command.command, Recipient));
|
|
else if (Command.action == GLFW_RELEASE)
|
|
m_active_continuous.erase(std::make_pair(Command.command, Recipient));
|
|
else if (Command.action == GLFW_REPEAT)
|
|
return;
|
|
}
|
|
|
|
auto [queueiterator, queueinserted] = m_commands.try_emplace( Recipient, commanddata_sequence() );
|
|
// recipient stack was either located or created, so we can add to it quite safely
|
|
queueiterator->second.emplace_back( Command );
|
|
}
|
|
|
|
// retrieves oldest posted command for specified recipient, if any. returns: true on retrieval, false if there's nothing to retrieve
|
|
bool
|
|
command_queue::pop( command_data &Command, uint32_t const Recipient ) {
|
|
|
|
auto lookup = m_commands.find( Recipient );
|
|
if( lookup == m_commands.end() ) {
|
|
// no command stack for this recipient, so no commands
|
|
return false;
|
|
}
|
|
auto &commands = lookup->second;
|
|
if( true == commands.empty() ) {
|
|
|
|
return false;
|
|
}
|
|
// we have command stack with command(s) on it, retrieve and pop the first one
|
|
Command = commands.front();
|
|
commands.pop_front();
|
|
|
|
return true;
|
|
}
|
|
|
|
bool command_queue::is_network_target(uint32_t const Recipient) const {
|
|
|
|
if (const auto target = (command_target)(Recipient & ~0xffff); target == command_target::entity)
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
command_queue::commands_map command_queue::pop_intercept_queue() {
|
|
commands_map map(m_intercept_queue);
|
|
m_intercept_queue.clear();
|
|
return map;
|
|
}
|
|
|
|
void command_queue::push_commands(const commands_map &commands) {
|
|
for (auto const &[recipient, sequence] : commands)
|
|
for (command_data const &data : sequence)
|
|
push_direct(data, recipient);
|
|
}
|
|
|
|
void
|
|
command_relay::post(user_command const Command, double const Param1, double const Param2,
|
|
int const Action, uint16_t Recipient, glm::vec3 Position, const std::string *Payload) const {
|
|
|
|
auto const &command = simulation::Commands_descriptions[ static_cast<std::size_t>( Command ) ];
|
|
|
|
if (command.target == command_target::vehicle && Recipient == 0) {
|
|
// default 0 recipient is currently controlled train
|
|
if (simulation::Train == nullptr)
|
|
return;
|
|
Recipient = simulation::Train->id();
|
|
}
|
|
|
|
if( command.target == command_target::vehicle
|
|
&& true == FreeFlyModeFlag
|
|
&& false == DebugModeFlag && true == Global.RealisticControlMode ) {
|
|
// in realistic control mode don't pass vehicle commands if the user isn't in one, unless we're in debug mode
|
|
return;
|
|
}
|
|
|
|
if (Position == glm::vec3(0.0f))
|
|
Position = Global.pCamera.Pos;
|
|
|
|
uint32_t combined_recipient = static_cast<uint32_t>( command.target ) | Recipient;
|
|
command_data commanddata({Command, Action, Param1, Param2, Timer::GetDeltaTime(), FreeFlyModeFlag, Position });
|
|
if (Payload)
|
|
commanddata.payload = *Payload;
|
|
|
|
simulation::Commands.push(commanddata, combined_recipient);
|
|
}
|