From 7440b1d902aa8511b3a15e9e45a4b4ff5cc700a1 Mon Sep 17 00:00:00 2001 From: tmj-fstate Date: Sat, 24 Feb 2018 02:38:41 +0100 Subject: [PATCH] passenger stop departure horn fix --- Driver.cpp | 28 ++++++++++++++++------------ uilayer.cpp | 35 ++++++++++++++--------------------- version.h | 2 +- 3 files changed, 31 insertions(+), 34 deletions(-) diff --git a/Driver.cpp b/Driver.cpp index 52585c06..0dc1d019 100644 --- a/Driver.cpp +++ b/Driver.cpp @@ -919,7 +919,11 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN } if (TrainParams->UpdateMTable( simulation::Time, asNextStop) ) { // 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 auto const exchangetime { simulation::Station.update_load( pVehicles[ 0 ], *TrainParams ) }; // TBD: adjust time to load exchange size @@ -947,6 +951,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN // przyjazd o czasie iDrivigFlags &= ~moveLate; } + if (TrainParams->DirectionChange()) { // jeśli "@" w rozkładzie, to wykonanie dalszych komend // 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) { // jeśli są dalsze stacje, czekamy do godziny odjazdu - if (TrainParams->IsTimeToGo(simulation::Time.data().wHour, simulation::Time.data().wMinute)) { // z dalszą akcją czekamy do godziny odjazdu /* 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) + " next " + asNextStop); // informacja #endif - if (int(floor(sSpeedTable[i].evEvent->ValueGet(1))) & 1) - iDrivigFlags |= moveStopHere; // nie podjeżdżać do semafora, - // jeśli droga nie jest wolna - else - iDrivigFlags &= ~moveStopHere; //po czasie jedź dalej - iDrivigFlags |= moveStopCloser; // do następnego W4 podjechać - // blisko (z dociąganiem) - iDrivigFlags &= ~moveStartHorn; // bez trąbienia przed odjazdem - sSpeedTable[i].iFlags = - 0; // nie liczy się już zupełnie (nie wyśle SetVelocity) + if( int( floor( sSpeedTable[ i ].evEvent->ValueGet( 1 ) ) ) & 1 ) { + // nie podjeżdżać do semafora, jeśli droga nie jest wolna + iDrivigFlags |= moveStopHere; + } + else { + //po czasie jedź dalej + iDrivigFlags &= ~moveStopHere; + } + iDrivigFlags |= moveStopCloser; // do następnego W4 podjechać blisko (z dociąganiem) + sSpeedTable[i].iFlags = 0; // nie liczy się już zupełnie (nie wyśle SetVelocity) sSpeedTable[i].fVelNext = -1; // można jechać za W4 if (go == cm_Unknown) // jeśli nie było komendy wcześniej go = cm_Ready; // gotów do odjazdu z W4 (semafor może diff --git a/uilayer.cpp b/uilayer.cpp index c857866e..c5b218e2 100644 --- a/uilayer.cpp +++ b/uilayer.cpp @@ -74,12 +74,22 @@ ui_layer::render() { glDisable( GL_LIGHTING ); glDisable( GL_DEPTH_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_background(); render_texture(); + + glDisable( GL_TEXTURE_2D ); + glDisable( GL_TEXTURE_CUBE_MAP ); + render_progress(); + + glDisable( GL_BLEND ); + render_panels(); render_tooltip(); @@ -113,9 +123,6 @@ ui_layer::render_progress() { if( (m_progress == 0.0f) && (m_subtaskprogress == 0.0f) ) return; - glPushAttrib( GL_ENABLE_BIT ); - glDisable( GL_TEXTURE_2D ); - glm::vec2 origin, size; if( m_progressbottom == true ) { 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 ) ); print( m_progresstext ); } - - glPopAttrib(); } void @@ -170,9 +175,6 @@ ui_layer::render_panels() { if( m_panels.empty() ) { return; } - glPushAttrib( GL_ENABLE_BIT ); - glDisable( GL_TEXTURE_2D ); - float const width = std::min( 4.f / 3.f, static_cast(Global.iWindowWidth) / std::max( 1, Global.iWindowHeight ) ) * Global.iWindowHeight; float const height = Global.iWindowHeight / 768.f; @@ -181,7 +183,7 @@ ui_layer::render_panels() { int lineidx = 0; for( auto const &line : panel->text_lines ) { - ::glColor4fv( &line.color.x ); + ::glColor4fv( glm::value_ptr( line.color ) ); ::glRasterPos2f( 0.5f * ( Global.iWindowWidth - width ) + panel->origin_x * height, panel->origin_y * height + 20.f * lineidx ); @@ -189,8 +191,6 @@ ui_layer::render_panels() { ++lineidx; } } - - glPopAttrib(); } void @@ -201,13 +201,9 @@ ui_layer::render_tooltip() { glm::dvec2 mousepos; glfwGetCursorPos( m_window, &mousepos.x, &mousepos.y ); - glPushAttrib( GL_ENABLE_BIT ); - glDisable( GL_TEXTURE_2D ); - ::glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); + ::glColor4fv( glm::value_ptr( colors::white ) ); ::glRasterPos2f( mousepos.x + 20.0f, mousepos.y + 25.0f ); print( m_tooltip ); - - glPopAttrib(); } void @@ -236,8 +232,7 @@ void ui_layer::render_texture() { if( m_texture != 0 ) { - ::glColor4f( 1.f, 1.f, 1.f, 1.f ); - ::glDisable( GL_BLEND ); + ::glColor4fv( glm::value_ptr( colors::white ) ); GfxRenderer.Bind_Texture( null_handle ); ::glBindTexture( GL_TEXTURE_2D, m_texture ); @@ -255,8 +250,6 @@ ui_layer::render_texture() { glEnd(); ::glBindTexture( GL_TEXTURE_2D, 0 ); - - ::glEnable( GL_BLEND ); } } diff --git a/version.h b/version.h index ff584265..b579d2b0 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #pragma once #define VERSION_MAJOR 18 -#define VERSION_MINOR 215 +#define VERSION_MINOR 223 #define VERSION_REVISION 0