mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Merge branch 'gfx-work' into sim
This commit is contained in:
43
Train.cpp
43
Train.cpp
@@ -30,6 +30,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "Console.h"
|
||||
#include "application.h"
|
||||
#include "renderer.h"
|
||||
#include "dictionary.h"
|
||||
/*
|
||||
namespace input {
|
||||
|
||||
@@ -552,31 +553,8 @@ dictionary_source *TTrain::GetTrainState() {
|
||||
dict->insert( "velnext", driver->VelNext );
|
||||
dict->insert( "actualproximitydist", driver->ActualProximityDist );
|
||||
// train data
|
||||
auto const *timetable{ driver->TrainTimetable() };
|
||||
|
||||
dict->insert( "trainnumber", driver->TrainName() );
|
||||
dict->insert( "train_brakingmassratio", timetable->BrakeRatio );
|
||||
dict->insert( "train_enginetype", timetable->LocSeries );
|
||||
dict->insert( "train_engineload", timetable->LocLoad );
|
||||
|
||||
dict->insert( "train_stationindex", driver->iStationStart );
|
||||
auto const stationcount { driver->StationCount() };
|
||||
dict->insert( "train_stationcount", stationcount );
|
||||
if( stationcount > 0 ) {
|
||||
// timetable stations data, if there's any
|
||||
for( auto stationidx = 1; stationidx <= stationcount; ++stationidx ) {
|
||||
auto const stationlabel { "train_station" + std::to_string( stationidx ) + "_" };
|
||||
auto const &timetableline { timetable->TimeTable[ stationidx ] };
|
||||
dict->insert( ( stationlabel + "name" ), Bezogonkow( timetableline.StationName ) );
|
||||
dict->insert( ( stationlabel + "fclt" ), Bezogonkow( timetableline.StationWare ) );
|
||||
dict->insert( ( stationlabel + "lctn" ), timetableline.km );
|
||||
dict->insert( ( stationlabel + "vmax" ), timetableline.vmax );
|
||||
dict->insert( ( stationlabel + "ah" ), timetableline.Ah );
|
||||
dict->insert( ( stationlabel + "am" ), timetableline.Am );
|
||||
dict->insert( ( stationlabel + "dh" ), timetableline.Dh );
|
||||
dict->insert( ( stationlabel + "dm" ), timetableline.Dm );
|
||||
}
|
||||
}
|
||||
driver->TrainTimetable()->serialize( dict );
|
||||
dict->insert( "train_stationstart", driver->iStationStart );
|
||||
dict->insert( "train_atpassengerstop", driver->IsAtPassengerStop );
|
||||
// world state data
|
||||
dict->insert( "scenario", Global.SceneryFile );
|
||||
@@ -4148,7 +4126,7 @@ void TTrain::OnCommand_heatingtoggle( TTrain *Train, command_data const &Command
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
if( false == Train->mvControlled->Heating ) {
|
||||
if( false == Train->mvControlled->HeatingAllow ) {
|
||||
// turn on
|
||||
OnCommand_heatingenable( Train, Command );
|
||||
}
|
||||
@@ -4162,24 +4140,20 @@ void TTrain::OnCommand_heatingtoggle( TTrain *Train, command_data const &Command
|
||||
void TTrain::OnCommand_heatingenable( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
|
||||
Train->mvControlled->HeatingAllow = true;
|
||||
// visual feedback
|
||||
Train->ggTrainHeatingButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||
|
||||
if( true == Train->mvControlled->Heating ) { return; } // already enabled
|
||||
|
||||
Train->mvControlled->Heating = true;
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_heatingdisable( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
|
||||
Train->mvControlled->HeatingAllow = false;
|
||||
// visual feedback
|
||||
Train->ggTrainHeatingButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||
|
||||
if( false == Train->mvControlled->Heating ) { return; } // already disabled
|
||||
|
||||
Train->mvControlled->Heating = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6028,7 +6002,6 @@ bool TTrain::Update( double const Deltatime )
|
||||
//---------
|
||||
// hunter-080812: poprawka na ogrzewanie w elektrykach - usuniete uzaleznienie od przetwornicy
|
||||
if( ( mvControlled->Heating == true )
|
||||
&& ( mvControlled->Mains == true )
|
||||
&& ( mvControlled->ConvOvldFlag == false ) )
|
||||
btLampkaOgrzewanieSkladu.Turn( true );
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user