mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 12:49:18 +02:00
ai disconnect logic fix, non modal debug mode pause, minor render code reverts to track down potential crash source
This commit is contained in:
19
Driver.cpp
19
Driver.cpp
@@ -996,7 +996,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OrderCurrentGet() == Shunt) {
|
if (OrderCurrentGet() & Shunt) {
|
||||||
OrderNext(Obey_train); // uruchomić jazdę pociągową
|
OrderNext(Obey_train); // uruchomić jazdę pociągową
|
||||||
CheckVehicles(); // zmienić światła
|
CheckVehicles(); // zmienić światła
|
||||||
}
|
}
|
||||||
@@ -1060,12 +1060,11 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
|||||||
sSpeedTable[i].iFlags = 0; // W4 nie liczy się już (nie wyśle SetVelocity)
|
sSpeedTable[i].iFlags = 0; // W4 nie liczy się już (nie wyśle SetVelocity)
|
||||||
sSpeedTable[i].fVelNext = -1; // można jechać za W4
|
sSpeedTable[i].fVelNext = -1; // można jechać za W4
|
||||||
fLastStopExpDist = -1.0f; // nie ma rozkładu, nie ma usuwania stacji
|
fLastStopExpDist = -1.0f; // nie ma rozkładu, nie ma usuwania stacji
|
||||||
/*
|
|
||||||
// NOTE: disabled as it's no longer needed, required time is calculated as part of loading/unloading procedure
|
|
||||||
WaitingSet(60); // tak ze 2 minuty, aż wszyscy wysiądą
|
|
||||||
*/
|
|
||||||
// wykonanie kolejnego rozkazu (Change_direction albo Shunt)
|
// wykonanie kolejnego rozkazu (Change_direction albo Shunt)
|
||||||
|
// FIX: don't automatically advance if there's disconnect procedure in progress
|
||||||
|
if( false == TestFlag( OrderCurrentGet(), Disconnect ) ) {
|
||||||
JumpToNextOrder();
|
JumpToNextOrder();
|
||||||
|
}
|
||||||
// ma się nie ruszać aż do momentu podania sygnału
|
// ma się nie ruszać aż do momentu podania sygnału
|
||||||
iDrivigFlags |= moveStopHere | moveStartHorn;
|
iDrivigFlags |= moveStopHere | moveStartHorn;
|
||||||
continue; // nie analizować prędkości
|
continue; // nie analizować prędkości
|
||||||
@@ -2061,7 +2060,7 @@ bool TController::CheckVehicles(TOrders user)
|
|||||||
}
|
}
|
||||||
if (AIControllFlag)
|
if (AIControllFlag)
|
||||||
{ // jeśli prowadzi komputer
|
{ // jeśli prowadzi komputer
|
||||||
if (OrderCurrentGet() == Obey_train) {
|
if( true == TestFlag( OrderCurrentGet(), Obey_train ) ) {
|
||||||
// jeśli jazda pociągowa
|
// jeśli jazda pociągowa
|
||||||
// światła pociągowe (Pc1) i końcówki (Pc5)
|
// światła pociągowe (Pc1) i końcówki (Pc5)
|
||||||
auto const frontlights { (
|
auto const frontlights { (
|
||||||
@@ -2098,7 +2097,7 @@ bool TController::CheckVehicles(TOrders user)
|
|||||||
light::headlight_right ); //światła manewrowe (Tb1) na pojeździe z napędem
|
light::headlight_right ); //światła manewrowe (Tb1) na pojeździe z napędem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( OrderCurrentGet() == Disconnect ) {
|
else if( true == TestFlag( OrderCurrentGet(), Disconnect ) ) {
|
||||||
if( mvOccupied->ActiveDir > 0 ) {
|
if( mvOccupied->ActiveDir > 0 ) {
|
||||||
// jak ma kierunek do przodu
|
// jak ma kierunek do przodu
|
||||||
// światła manewrowe (Tb1) tylko z przodu, aby nie pozostawić odczepionego ze światłem
|
// światła manewrowe (Tb1) tylko z przodu, aby nie pozostawić odczepionego ze światłem
|
||||||
@@ -3666,7 +3665,7 @@ bool TController::PutCommand( std::string NewCommand, double NewValue1, double N
|
|||||||
// set consist lights pattern hints
|
// set consist lights pattern hints
|
||||||
m_lighthints[ side::front ] = static_cast<int>( NewValue1 );
|
m_lighthints[ side::front ] = static_cast<int>( NewValue1 );
|
||||||
m_lighthints[ side::rear ] = static_cast<int>( NewValue2 );
|
m_lighthints[ side::rear ] = static_cast<int>( NewValue2 );
|
||||||
if( OrderCurrentGet() == Obey_train ) {
|
if( true == TestFlag( OrderCurrentGet(), Obey_train ) ) {
|
||||||
// light hints only apply in the obey_train mode
|
// light hints only apply in the obey_train mode
|
||||||
CheckVehicles();
|
CheckVehicles();
|
||||||
}
|
}
|
||||||
@@ -4296,7 +4295,7 @@ TController::UpdateSituation(double dt) {
|
|||||||
IncSpeed(); // dla (Ready)==false nie ruszy
|
IncSpeed(); // dla (Ready)==false nie ruszy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((mvOccupied->Vel == 0.0) && !(iDrivigFlags & movePress))
|
if ((mvOccupied->Vel < 0.01) && !(iDrivigFlags & movePress))
|
||||||
{ // 2. faza odczepiania: zmień kierunek na przeciwny i dociśnij
|
{ // 2. faza odczepiania: zmień kierunek na przeciwny i dociśnij
|
||||||
// za radą yB ustawiamy pozycję 3 kranu (ruszanie kranem w innych miejscach
|
// za radą yB ustawiamy pozycję 3 kranu (ruszanie kranem w innych miejscach
|
||||||
// powino zostać wyłączone)
|
// powino zostać wyłączone)
|
||||||
@@ -4333,7 +4332,7 @@ TController::UpdateSituation(double dt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if( mvOccupied->Vel > 0.0 ) {
|
if( mvOccupied->Vel > 0.01 ) {
|
||||||
// 1st phase(?)
|
// 1st phase(?)
|
||||||
// bring it to stop if it's not already stopped
|
// bring it to stop if it's not already stopped
|
||||||
SetVelocity( 0, 0, stopJoin ); // wyłączyć przyspieszanie
|
SetVelocity( 0, 0, stopJoin ); // wyłączyć przyspieszanie
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ void
|
|||||||
driver_ui::update() {
|
driver_ui::update() {
|
||||||
|
|
||||||
auto const pausemask { 1 | 2 };
|
auto const pausemask { 1 | 2 };
|
||||||
auto ispaused { ( Global.iPause & pausemask ) != 0 };
|
auto ispaused { ( false == DebugModeFlag ) && ( ( Global.iPause & pausemask ) != 0 ) };
|
||||||
if( ( ispaused != m_paused )
|
if( ( ispaused != m_paused )
|
||||||
&& ( false == Global.ControlPicking ) ) {
|
&& ( false == Global.ControlPicking ) ) {
|
||||||
set_cursor( ispaused );
|
set_cursor( ispaused );
|
||||||
|
|||||||
24
renderer.cpp
24
renderer.cpp
@@ -1528,8 +1528,8 @@ opengl_renderer::Render( world_environment *Environment ) {
|
|||||||
if( Environment->m_clouds.mdCloud ) {
|
if( Environment->m_clouds.mdCloud ) {
|
||||||
// setup
|
// setup
|
||||||
Disable_Lights();
|
Disable_Lights();
|
||||||
::glEnable( GL_LIGHT0 ); // other lights will be enabled during lights update
|
|
||||||
::glEnable( GL_LIGHTING );
|
::glEnable( GL_LIGHTING );
|
||||||
|
::glEnable( GL_LIGHT0 ); // other lights will be enabled during lights update
|
||||||
::glLightModelfv(
|
::glLightModelfv(
|
||||||
GL_LIGHT_MODEL_AMBIENT,
|
GL_LIGHT_MODEL_AMBIENT,
|
||||||
glm::value_ptr(
|
glm::value_ptr(
|
||||||
@@ -1538,7 +1538,7 @@ opengl_renderer::Render( world_environment *Environment ) {
|
|||||||
* 0.5f // arbitrary adjustment factor
|
* 0.5f // arbitrary adjustment factor
|
||||||
) );
|
) );
|
||||||
// render
|
// render
|
||||||
// Render( Environment->m_clouds.mdCloud, nullptr, 100.0 );
|
Render( Environment->m_clouds.mdCloud, nullptr, 100.0 );
|
||||||
Render_Alpha( Environment->m_clouds.mdCloud, nullptr, 100.0 );
|
Render_Alpha( Environment->m_clouds.mdCloud, nullptr, 100.0 );
|
||||||
// post-render cleanup
|
// post-render cleanup
|
||||||
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, glm::value_ptr( colors::none ) );
|
::glLightModelfv( GL_LIGHT_MODEL_AMBIENT, glm::value_ptr( colors::none ) );
|
||||||
@@ -3518,7 +3518,7 @@ opengl_renderer::Update_Mouse_Position() {
|
|||||||
|
|
||||||
void
|
void
|
||||||
opengl_renderer::Update( double const Deltatime ) {
|
opengl_renderer::Update( double const Deltatime ) {
|
||||||
|
/*
|
||||||
m_pickupdateaccumulator += Deltatime;
|
m_pickupdateaccumulator += Deltatime;
|
||||||
|
|
||||||
if( m_updateaccumulator > 0.5 ) {
|
if( m_updateaccumulator > 0.5 ) {
|
||||||
@@ -3542,7 +3542,7 @@ opengl_renderer::Update( double const Deltatime ) {
|
|||||||
m_picksceneryitem = nullptr;
|
m_picksceneryitem = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
m_updateaccumulator += Deltatime;
|
m_updateaccumulator += Deltatime;
|
||||||
|
|
||||||
if( m_updateaccumulator < 1.0 ) {
|
if( m_updateaccumulator < 1.0 ) {
|
||||||
@@ -3595,6 +3595,22 @@ opengl_renderer::Update( double const Deltatime ) {
|
|||||||
m_debugtimestext += m_textures.info();
|
m_debugtimestext += m_textures.info();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( ( true == Global.ControlPicking )
|
||||||
|
&& ( false == FreeFlyModeFlag ) ) {
|
||||||
|
Update_Pick_Control();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_pickcontrolitem = nullptr;
|
||||||
|
}
|
||||||
|
// temporary conditions for testing. eventually will be coupled with editor mode
|
||||||
|
if( ( true == Global.ControlPicking )
|
||||||
|
&& ( true == DebugModeFlag )
|
||||||
|
&& ( true == FreeFlyModeFlag ) ) {
|
||||||
|
Update_Pick_Node();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_picksceneryitem = nullptr;
|
||||||
|
}
|
||||||
// dump last opengl error, if any
|
// dump last opengl error, if any
|
||||||
auto const glerror = ::glGetError();
|
auto const glerror = ::glGetError();
|
||||||
if( glerror != GL_NO_ERROR ) {
|
if( glerror != GL_NO_ERROR ) {
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ private:
|
|||||||
unsigned int m_framestamp; // id of currently rendered gfx frame
|
unsigned int m_framestamp; // id of currently rendered gfx frame
|
||||||
float m_framerate;
|
float m_framerate;
|
||||||
double m_updateaccumulator { 0.0 };
|
double m_updateaccumulator { 0.0 };
|
||||||
double m_pickupdateaccumulator { 0.0 };
|
// double m_pickupdateaccumulator { 0.0 };
|
||||||
std::string m_debugtimestext;
|
std::string m_debugtimestext;
|
||||||
std::string m_pickdebuginfo;
|
std::string m_pickdebuginfo;
|
||||||
debug_stats m_debugstats;
|
debug_stats m_debugstats;
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ init() {
|
|||||||
"nastawa hamulca",
|
"nastawa hamulca",
|
||||||
"nastawa hamulca: towarowy",
|
"nastawa hamulca: towarowy",
|
||||||
"nastawa hamulca: pospieszny",
|
"nastawa hamulca: pospieszny",
|
||||||
"rozruch niski/wysoki",
|
"zakres pradu rozruchu",
|
||||||
"pompa wody",
|
"pompa wody",
|
||||||
"wylacznik samoczynny pompy wody",
|
"wylacznik samoczynny pompy wody",
|
||||||
"podgrzewacz wody",
|
"podgrzewacz wody",
|
||||||
|
|||||||
Reference in New Issue
Block a user