mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 05:49:19 +02:00
passenger stop departure horn fix
This commit is contained in:
28
Driver.cpp
28
Driver.cpp
@@ -919,7 +919,11 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
|||||||
}
|
}
|
||||||
if (TrainParams->UpdateMTable( simulation::Time, asNextStop) ) {
|
if (TrainParams->UpdateMTable( simulation::Time, asNextStop) ) {
|
||||||
// to się wykona tylko raz po zatrzymaniu na W4
|
// to się wykona tylko raz po zatrzymaniu na W4
|
||||||
|
if( TrainParams->StationIndex < TrainParams->StationCount ) {
|
||||||
|
// jeśli są dalsze stacje, bez trąbienia przed odjazdem
|
||||||
|
// also ignore any horn cue that may be potentially set below 1 km/h and before the actual full stop
|
||||||
|
iDrivigFlags &= ~( moveStartHorn | moveStartHornNow );
|
||||||
|
}
|
||||||
// perform loading/unloading
|
// perform loading/unloading
|
||||||
auto const exchangetime { simulation::Station.update_load( pVehicles[ 0 ], *TrainParams ) };
|
auto const exchangetime { simulation::Station.update_load( pVehicles[ 0 ], *TrainParams ) };
|
||||||
// TBD: adjust time to load exchange size
|
// TBD: adjust time to load exchange size
|
||||||
@@ -947,6 +951,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
|||||||
// przyjazd o czasie
|
// przyjazd o czasie
|
||||||
iDrivigFlags &= ~moveLate;
|
iDrivigFlags &= ~moveLate;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TrainParams->DirectionChange()) {
|
if (TrainParams->DirectionChange()) {
|
||||||
// jeśli "@" w rozkładzie, to wykonanie dalszych komend
|
// jeśli "@" w rozkładzie, to wykonanie dalszych komend
|
||||||
// wykonanie kolejnej komendy, nie dotyczy ostatniej stacji
|
// wykonanie kolejnej komendy, nie dotyczy ostatniej stacji
|
||||||
@@ -985,7 +990,6 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
|||||||
}
|
}
|
||||||
if (TrainParams->StationIndex < TrainParams->StationCount)
|
if (TrainParams->StationIndex < TrainParams->StationCount)
|
||||||
{ // jeśli są dalsze stacje, czekamy do godziny odjazdu
|
{ // jeśli są dalsze stacje, czekamy do godziny odjazdu
|
||||||
|
|
||||||
if (TrainParams->IsTimeToGo(simulation::Time.data().wHour, simulation::Time.data().wMinute))
|
if (TrainParams->IsTimeToGo(simulation::Time.data().wHour, simulation::Time.data().wMinute))
|
||||||
{ // z dalszą akcją czekamy do godziny odjazdu
|
{ // z dalszą akcją czekamy do godziny odjazdu
|
||||||
/* potencjalny problem z ruszaniem z w4
|
/* potencjalny problem z ruszaniem z w4
|
||||||
@@ -1008,16 +1012,16 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
|||||||
+ ": at " + std::to_string(simulation::Time.data().wHour) + ":" + std::to_string(simulation::Time.data().wMinute)
|
+ ": at " + std::to_string(simulation::Time.data().wHour) + ":" + std::to_string(simulation::Time.data().wMinute)
|
||||||
+ " next " + asNextStop); // informacja
|
+ " next " + asNextStop); // informacja
|
||||||
#endif
|
#endif
|
||||||
if (int(floor(sSpeedTable[i].evEvent->ValueGet(1))) & 1)
|
if( int( floor( sSpeedTable[ i ].evEvent->ValueGet( 1 ) ) ) & 1 ) {
|
||||||
iDrivigFlags |= moveStopHere; // nie podjeżdżać do semafora,
|
// nie podjeżdżać do semafora, jeśli droga nie jest wolna
|
||||||
// jeśli droga nie jest wolna
|
iDrivigFlags |= moveStopHere;
|
||||||
else
|
}
|
||||||
iDrivigFlags &= ~moveStopHere; //po czasie jedź dalej
|
else {
|
||||||
iDrivigFlags |= moveStopCloser; // do następnego W4 podjechać
|
//po czasie jedź dalej
|
||||||
// blisko (z dociąganiem)
|
iDrivigFlags &= ~moveStopHere;
|
||||||
iDrivigFlags &= ~moveStartHorn; // bez trąbienia przed odjazdem
|
}
|
||||||
sSpeedTable[i].iFlags =
|
iDrivigFlags |= moveStopCloser; // do następnego W4 podjechać blisko (z dociąganiem)
|
||||||
0; // nie liczy się już zupełnie (nie wyśle SetVelocity)
|
sSpeedTable[i].iFlags = 0; // nie liczy się już zupełnie (nie wyśle SetVelocity)
|
||||||
sSpeedTable[i].fVelNext = -1; // można jechać za W4
|
sSpeedTable[i].fVelNext = -1; // można jechać za W4
|
||||||
if (go == cm_Unknown) // jeśli nie było komendy wcześniej
|
if (go == cm_Unknown) // jeśli nie było komendy wcześniej
|
||||||
go = cm_Ready; // gotów do odjazdu z W4 (semafor może
|
go = cm_Ready; // gotów do odjazdu z W4 (semafor może
|
||||||
|
|||||||
35
uilayer.cpp
35
uilayer.cpp
@@ -74,12 +74,22 @@ ui_layer::render() {
|
|||||||
glDisable( GL_LIGHTING );
|
glDisable( GL_LIGHTING );
|
||||||
glDisable( GL_DEPTH_TEST );
|
glDisable( GL_DEPTH_TEST );
|
||||||
glDisable( GL_ALPHA_TEST );
|
glDisable( GL_ALPHA_TEST );
|
||||||
glEnable( GL_BLEND );
|
glEnable( GL_TEXTURE_2D );
|
||||||
|
glEnable( GL_BLEND );
|
||||||
|
|
||||||
|
::glColor4fv( glm::value_ptr( colors::white ) );
|
||||||
|
|
||||||
// render code here
|
// render code here
|
||||||
render_background();
|
render_background();
|
||||||
render_texture();
|
render_texture();
|
||||||
|
|
||||||
|
glDisable( GL_TEXTURE_2D );
|
||||||
|
glDisable( GL_TEXTURE_CUBE_MAP );
|
||||||
|
|
||||||
render_progress();
|
render_progress();
|
||||||
|
|
||||||
|
glDisable( GL_BLEND );
|
||||||
|
|
||||||
render_panels();
|
render_panels();
|
||||||
render_tooltip();
|
render_tooltip();
|
||||||
|
|
||||||
@@ -113,9 +123,6 @@ ui_layer::render_progress() {
|
|||||||
|
|
||||||
if( (m_progress == 0.0f) && (m_subtaskprogress == 0.0f) ) return;
|
if( (m_progress == 0.0f) && (m_subtaskprogress == 0.0f) ) return;
|
||||||
|
|
||||||
glPushAttrib( GL_ENABLE_BIT );
|
|
||||||
glDisable( GL_TEXTURE_2D );
|
|
||||||
|
|
||||||
glm::vec2 origin, size;
|
glm::vec2 origin, size;
|
||||||
if( m_progressbottom == true ) {
|
if( m_progressbottom == true ) {
|
||||||
origin = glm::vec2{ 0.0f, 768.0f - 20.0f };
|
origin = glm::vec2{ 0.0f, 768.0f - 20.0f };
|
||||||
@@ -161,8 +168,6 @@ ui_layer::render_progress() {
|
|||||||
( 0.5f * ( Global.iWindowHeight - height ) + origin.y * heightratio ) + ( charsize ) + ( ( size.y * heightratio - textheight ) * 0.5f * heightratio ) );
|
( 0.5f * ( Global.iWindowHeight - height ) + origin.y * heightratio ) + ( charsize ) + ( ( size.y * heightratio - textheight ) * 0.5f * heightratio ) );
|
||||||
print( m_progresstext );
|
print( m_progresstext );
|
||||||
}
|
}
|
||||||
|
|
||||||
glPopAttrib();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -170,9 +175,6 @@ ui_layer::render_panels() {
|
|||||||
|
|
||||||
if( m_panels.empty() ) { return; }
|
if( m_panels.empty() ) { return; }
|
||||||
|
|
||||||
glPushAttrib( GL_ENABLE_BIT );
|
|
||||||
glDisable( GL_TEXTURE_2D );
|
|
||||||
|
|
||||||
float const width = std::min( 4.f / 3.f, static_cast<float>(Global.iWindowWidth) / std::max( 1, Global.iWindowHeight ) ) * Global.iWindowHeight;
|
float const width = std::min( 4.f / 3.f, static_cast<float>(Global.iWindowWidth) / std::max( 1, Global.iWindowHeight ) ) * Global.iWindowHeight;
|
||||||
float const height = Global.iWindowHeight / 768.f;
|
float const height = Global.iWindowHeight / 768.f;
|
||||||
|
|
||||||
@@ -181,7 +183,7 @@ ui_layer::render_panels() {
|
|||||||
int lineidx = 0;
|
int lineidx = 0;
|
||||||
for( auto const &line : panel->text_lines ) {
|
for( auto const &line : panel->text_lines ) {
|
||||||
|
|
||||||
::glColor4fv( &line.color.x );
|
::glColor4fv( glm::value_ptr( line.color ) );
|
||||||
::glRasterPos2f(
|
::glRasterPos2f(
|
||||||
0.5f * ( Global.iWindowWidth - width ) + panel->origin_x * height,
|
0.5f * ( Global.iWindowWidth - width ) + panel->origin_x * height,
|
||||||
panel->origin_y * height + 20.f * lineidx );
|
panel->origin_y * height + 20.f * lineidx );
|
||||||
@@ -189,8 +191,6 @@ ui_layer::render_panels() {
|
|||||||
++lineidx;
|
++lineidx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glPopAttrib();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -201,13 +201,9 @@ ui_layer::render_tooltip() {
|
|||||||
glm::dvec2 mousepos;
|
glm::dvec2 mousepos;
|
||||||
glfwGetCursorPos( m_window, &mousepos.x, &mousepos.y );
|
glfwGetCursorPos( m_window, &mousepos.x, &mousepos.y );
|
||||||
|
|
||||||
glPushAttrib( GL_ENABLE_BIT );
|
::glColor4fv( glm::value_ptr( colors::white ) );
|
||||||
glDisable( GL_TEXTURE_2D );
|
|
||||||
::glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
|
||||||
::glRasterPos2f( mousepos.x + 20.0f, mousepos.y + 25.0f );
|
::glRasterPos2f( mousepos.x + 20.0f, mousepos.y + 25.0f );
|
||||||
print( m_tooltip );
|
print( m_tooltip );
|
||||||
|
|
||||||
glPopAttrib();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -236,8 +232,7 @@ void
|
|||||||
ui_layer::render_texture() {
|
ui_layer::render_texture() {
|
||||||
|
|
||||||
if( m_texture != 0 ) {
|
if( m_texture != 0 ) {
|
||||||
::glColor4f( 1.f, 1.f, 1.f, 1.f );
|
::glColor4fv( glm::value_ptr( colors::white ) );
|
||||||
::glDisable( GL_BLEND );
|
|
||||||
|
|
||||||
GfxRenderer.Bind_Texture( null_handle );
|
GfxRenderer.Bind_Texture( null_handle );
|
||||||
::glBindTexture( GL_TEXTURE_2D, m_texture );
|
::glBindTexture( GL_TEXTURE_2D, m_texture );
|
||||||
@@ -255,8 +250,6 @@ ui_layer::render_texture() {
|
|||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
::glBindTexture( GL_TEXTURE_2D, 0 );
|
::glBindTexture( GL_TEXTURE_2D, 0 );
|
||||||
|
|
||||||
::glEnable( GL_BLEND );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user