mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 15:09:19 +02:00
consist heating activation logic tweak, smoke in tunnel clipping through terrain hack/fix, door cab controls logic change
This commit is contained in:
13
Driver.cpp
13
Driver.cpp
@@ -505,7 +505,7 @@ void TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle)
|
|||||||
VelSignalLast = -1.0;
|
VelSignalLast = -1.0;
|
||||||
}
|
}
|
||||||
iTableDirection = iDirection; // ustalenie w jakim kierunku jest wypełniana tabelka względem pojazdu
|
iTableDirection = iDirection; // ustalenie w jakim kierunku jest wypełniana tabelka względem pojazdu
|
||||||
pTrack = pVehicle->RaTrackGet(); // odcinek, na którym stoi
|
pTrack = pVehicle->GetTrack(); // odcinek, na którym stoi
|
||||||
fTrackLength = pVehicle->RaTranslationGet(); // pozycja na tym torze (odległość od Point1)
|
fTrackLength = pVehicle->RaTranslationGet(); // pozycja na tym torze (odległość od Point1)
|
||||||
fLastDir = pVehicle->DirectionGet() * pVehicle->RaDirectionGet(); // ustalenie kierunku skanowania na torze
|
fLastDir = pVehicle->DirectionGet() * pVehicle->RaDirectionGet(); // ustalenie kierunku skanowania na torze
|
||||||
if( fLastDir < 0.0 ) {
|
if( fLastDir < 0.0 ) {
|
||||||
@@ -2126,22 +2126,19 @@ bool TController::CheckVehicles(TOrders user)
|
|||||||
p = pVehicles[0];
|
p = pVehicles[0];
|
||||||
while (p)
|
while (p)
|
||||||
{
|
{
|
||||||
// HACK: wagony muszą mieć baterię załączoną do otwarcia drzwi...
|
|
||||||
if( p != pVehicle ) {
|
if( p != pVehicle ) {
|
||||||
if( ( ( p->MoverParameters->Couplers[ end::front ].CouplingFlag & ( coupling::control ) ) == 0 )
|
if( ( ( p->MoverParameters->Couplers[ end::front ].CouplingFlag & ( coupling::control ) ) == 0 )
|
||||||
&& ( ( p->MoverParameters->Couplers[ end::rear ].CouplingFlag & ( coupling::control ) ) == 0 ) ) {
|
&& ( ( p->MoverParameters->Couplers[ end::rear ].CouplingFlag & ( coupling::control ) ) == 0 ) ) {
|
||||||
// NOTE: don't set battery in the occupied vehicle, let the user/ai do it explicitly
|
// NOTE: don't set battery in controllable vehicles, let the user/ai do it explicitly
|
||||||
|
// HACK: wagony muszą mieć baterię załączoną do otwarcia drzwi...
|
||||||
p->MoverParameters->BatterySwitch( true );
|
p->MoverParameters->BatterySwitch( true );
|
||||||
}
|
|
||||||
}
|
|
||||||
// enable heating and converter in carriages with can be heated
|
// enable heating and converter in carriages with can be heated
|
||||||
// NOTE: don't touch the controlled vehicle, let the user/ai handle it explicitly
|
|
||||||
if( p->MoverParameters != mvControlling ) {
|
|
||||||
if( p->MoverParameters->HeatingPower > 0 ) {
|
if( p->MoverParameters->HeatingPower > 0 ) {
|
||||||
p->MoverParameters->HeatingAllow = true;
|
p->MoverParameters->HeatingAllow = true;
|
||||||
p->MoverParameters->ConverterSwitch( true, range_t::local );
|
p->MoverParameters->ConverterSwitch( true, range_t::local );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (p->asDestination == "none")
|
if (p->asDestination == "none")
|
||||||
p->DestinationSet(TrainParams->Relation2, TrainParams->TrainName); // relacja docelowa, jeśli nie było
|
p->DestinationSet(TrainParams->Relation2, TrainParams->TrainName); // relacja docelowa, jeśli nie było
|
||||||
@@ -6563,7 +6560,7 @@ TCommandType TController::BackwardScan()
|
|||||||
double scandist = scanmax; // zmodyfikuje na rzeczywiście przeskanowane
|
double scandist = scanmax; // zmodyfikuje na rzeczywiście przeskanowane
|
||||||
basic_event *e = NULL; // event potencjalnie od semafora
|
basic_event *e = NULL; // event potencjalnie od semafora
|
||||||
// opcjonalnie może być skanowanie od "wskaźnika" z przodu, np. W5, Tm=Ms1, koniec toru wg drugiej osi w kierunku ruchu
|
// opcjonalnie może być skanowanie od "wskaźnika" z przodu, np. W5, Tm=Ms1, koniec toru wg drugiej osi w kierunku ruchu
|
||||||
TTrack *scantrack = BackwardTraceRoute(scandist, scandir, pVehicles[0]->RaTrackGet(), e);
|
TTrack *scantrack = BackwardTraceRoute(scandist, scandir, pVehicles[0]->GetTrack(), e);
|
||||||
auto const dir = startdir * pVehicles[0]->VectorFront(); // wektor w kierunku jazdy/szukania
|
auto const dir = startdir * pVehicles[0]->VectorFront(); // wektor w kierunku jazdy/szukania
|
||||||
if( !scantrack ) {
|
if( !scantrack ) {
|
||||||
// jeśli wstecz wykryto koniec toru to raczej nic się nie da w takiej sytuacji zrobić
|
// jeśli wstecz wykryto koniec toru to raczej nic się nie da w takiej sytuacji zrobić
|
||||||
|
|||||||
24
Train.cpp
24
Train.cpp
@@ -4255,9 +4255,8 @@ void TTrain::OnCommand_doortoggleleft( TTrain *Train, command_data const &Comman
|
|||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
// NOTE: test how the door state check works with consists where the occupied vehicle doesn't have opening doors
|
// NOTE: test how the door state check works with consists where the occupied vehicle doesn't have opening doors
|
||||||
if( false == (
|
if( false == (
|
||||||
Train->mvOccupied->ActiveCab == 1 ?
|
( Train->ggDoorLeftButton.GetDesiredValue() > 0.5 )
|
||||||
Train->mvOccupied->Doors.instances[side::left].is_opening || Train->mvOccupied->Doors.instances[ side::left ].is_open :
|
|| ( Train->ggDoorLeftOnButton.GetDesiredValue() > 0.5 ) ) ) {
|
||||||
Train->mvOccupied->Doors.instances[side::right].is_opening || Train->mvOccupied->Doors.instances[ side::right ].is_open ) ) {
|
|
||||||
// open
|
// open
|
||||||
OnCommand_dooropenleft( Train, Command );
|
OnCommand_dooropenleft( Train, Command );
|
||||||
}
|
}
|
||||||
@@ -4277,9 +4276,8 @@ void TTrain::OnCommand_doortoggleleft( TTrain *Train, command_data const &Comman
|
|||||||
else if( Command.action == GLFW_RELEASE ) {
|
else if( Command.action == GLFW_RELEASE ) {
|
||||||
|
|
||||||
if( true == (
|
if( true == (
|
||||||
Train->mvOccupied->ActiveCab == 1 ?
|
( Train->ggDoorLeftButton.GetDesiredValue() > 0.5 )
|
||||||
Train->mvOccupied->Doors.instances[side::left].is_opening || Train->mvOccupied->Doors.instances[ side::left ].is_open :
|
|| ( Train->ggDoorLeftOnButton.GetDesiredValue() > 0.5 ) ) ) {
|
||||||
Train->mvOccupied->Doors.instances[side::right].is_opening || Train->mvOccupied->Doors.instances[ side::right ].is_open ) ) {
|
|
||||||
// open
|
// open
|
||||||
if( ( Train->mvOccupied->Doors.has_autowarning )
|
if( ( Train->mvOccupied->Doors.has_autowarning )
|
||||||
&& ( Train->mvOccupied->DepartureSignal ) ) {
|
&& ( Train->mvOccupied->DepartureSignal ) ) {
|
||||||
@@ -4339,7 +4337,7 @@ void TTrain::OnCommand_doorpermitleft( TTrain *Train, command_data const &Comman
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// two-state switch
|
// two-state switch
|
||||||
auto const newstate { !( Train->mvOccupied->Doors.instances[ side ].open_permit ) };
|
auto const newstate { !( Train->ggDoorLeftPermitButton.GetDesiredValue() > 0.5 ) };
|
||||||
|
|
||||||
Train->mvOccupied->PermitDoors( side, newstate );
|
Train->mvOccupied->PermitDoors( side, newstate );
|
||||||
// visual feedback
|
// visual feedback
|
||||||
@@ -4375,7 +4373,7 @@ void TTrain::OnCommand_doorpermitright( TTrain *Train, command_data const &Comma
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// two-state switch
|
// two-state switch
|
||||||
auto const newstate { !( Train->mvOccupied->Doors.instances[ side ].open_permit ) };
|
auto const newstate { !( Train->ggDoorRightPermitButton.GetDesiredValue() > 0.5 ) };
|
||||||
|
|
||||||
Train->mvOccupied->PermitDoors( side, newstate );
|
Train->mvOccupied->PermitDoors( side, newstate );
|
||||||
// visual feedback
|
// visual feedback
|
||||||
@@ -4514,9 +4512,8 @@ void TTrain::OnCommand_doortoggleright( TTrain *Train, command_data const &Comma
|
|||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
// NOTE: test how the door state check works with consists where the occupied vehicle doesn't have opening doors
|
// NOTE: test how the door state check works with consists where the occupied vehicle doesn't have opening doors
|
||||||
if( false == (
|
if( false == (
|
||||||
Train->mvOccupied->ActiveCab == 1 ?
|
( Train->ggDoorRightButton.GetDesiredValue() > 0.5 )
|
||||||
Train->mvOccupied->Doors.instances[side::right].is_opening || Train->mvOccupied->Doors.instances[ side::right ].is_open :
|
|| ( Train->ggDoorRightOnButton.GetDesiredValue() > 0.5 ) ) ) {
|
||||||
Train->mvOccupied->Doors.instances[side::left].is_opening || Train->mvOccupied->Doors.instances[ side::left ].is_open ) ) {
|
|
||||||
// open
|
// open
|
||||||
OnCommand_dooropenright( Train, Command );
|
OnCommand_dooropenright( Train, Command );
|
||||||
}
|
}
|
||||||
@@ -4536,9 +4533,8 @@ void TTrain::OnCommand_doortoggleright( TTrain *Train, command_data const &Comma
|
|||||||
else if( Command.action == GLFW_RELEASE ) {
|
else if( Command.action == GLFW_RELEASE ) {
|
||||||
|
|
||||||
if( true == (
|
if( true == (
|
||||||
Train->mvOccupied->ActiveCab == 1 ?
|
( Train->ggDoorRightButton.GetDesiredValue() > 0.5 )
|
||||||
Train->mvOccupied->Doors.instances[side::right].is_opening || Train->mvOccupied->Doors.instances[ side::right ].is_open :
|
|| ( Train->ggDoorRightOnButton.GetDesiredValue() > 0.5 ) ) ) {
|
||||||
Train->mvOccupied->Doors.instances[side::left].is_opening || Train->mvOccupied->Doors.instances[ side::left ].is_open ) ) {
|
|
||||||
// open
|
// open
|
||||||
if( ( Train->mvOccupied->Doors.has_autowarning )
|
if( ( Train->mvOccupied->Doors.has_autowarning )
|
||||||
&& ( Train->mvOccupied->DepartureSignal ) ) {
|
&& ( Train->mvOccupied->DepartureSignal ) ) {
|
||||||
|
|||||||
@@ -167,6 +167,11 @@ smoke_source::update( double const Timedelta, bool const Onlydespawn ) {
|
|||||||
std::min<float>(
|
std::min<float>(
|
||||||
m_spawncount + ( m_spawnrate * Timedelta * Global.SmokeFidelity ),
|
m_spawncount + ( m_spawnrate * Timedelta * Global.SmokeFidelity ),
|
||||||
m_max_particles ) );
|
m_max_particles ) );
|
||||||
|
// HACK: don't spawn particles in tunnels, to prevent smoke clipping through 'terrain' outside
|
||||||
|
if( ( m_ownertype == owner_type::vehicle )
|
||||||
|
&& ( m_owner.vehicle->RaTrackGet()->eEnvironment == e_tunnel ) ) {
|
||||||
|
m_spawncount = 0.f;
|
||||||
|
}
|
||||||
// update spawned particles
|
// update spawned particles
|
||||||
for( auto particleiterator { std::begin( m_particles ) }; particleiterator != std::end( m_particles ); ++particleiterator ) {
|
for( auto particleiterator { std::begin( m_particles ) }; particleiterator != std::end( m_particles ); ++particleiterator ) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user