mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
potential vbo render path crash fix, minor bug fixes
This commit is contained in:
13
Event.cpp
13
Event.cpp
@@ -886,9 +886,14 @@ whois_event::run_() {
|
||||
auto *targetcell { static_cast<TMemCell *>( std::get<scene::basic_node *>( target ) ) };
|
||||
if( targetcell == nullptr ) { continue; }
|
||||
// event effect code
|
||||
// +24: vehicle type, consist brake level, obstacle distance
|
||||
// +16: load type, load amount, max load amount
|
||||
// +8: destination, direction, engine power
|
||||
// +0: train name, station count, stop on next station
|
||||
if( m_input.flags & flags::load ) {
|
||||
// +16 or +24
|
||||
// jeśli pytanie o ładunek
|
||||
if( m_input.flags & flags::mode_add ) {
|
||||
if( m_input.flags & flags::mode_alt ) {
|
||||
// jeśli typ pojazdu
|
||||
// TODO: define and recognize individual request types
|
||||
auto const owner { (
|
||||
@@ -912,7 +917,7 @@ whois_event::run_() {
|
||||
|
||||
WriteLog(
|
||||
"Type: WhoIs (" + to_string( m_input.flags ) + ") - "
|
||||
+ "[name: " + m_activator->MoverParameters->TypeName + "], "
|
||||
+ "[type: " + m_activator->MoverParameters->TypeName + "], "
|
||||
+ "[consist brake level: " + to_string( consistbrakelevel, 2 ) + "], "
|
||||
+ "[obstacle distance: " + to_string( collisiondistance, 2 ) + " m]" );
|
||||
}
|
||||
@@ -931,7 +936,8 @@ whois_event::run_() {
|
||||
+ "[max load: " + to_string( m_activator->MoverParameters->MaxLoad, 2 ) + "]" );
|
||||
}
|
||||
}
|
||||
else if( m_input.flags & flags::mode_add ) { // jeśli miejsce docelowe pojazdu
|
||||
// +8
|
||||
else if( m_input.flags & flags::mode_alt ) { // jeśli miejsce docelowe pojazdu
|
||||
targetcell->UpdateValues(
|
||||
m_activator->asDestination, // adres docelowy
|
||||
m_activator->DirectionGet(), // kierunek pojazdu względem czoła składu (1=zgodny,-1=przeciwny)
|
||||
@@ -944,6 +950,7 @@ whois_event::run_() {
|
||||
+ "[direction: " + to_string( m_activator->DirectionGet() ) + "], "
|
||||
+ "[engine power: " + to_string( m_activator->MoverParameters->Power, 2 ) + "]" );
|
||||
}
|
||||
// +0
|
||||
else if( m_activator->Mechanik ) {
|
||||
if( m_activator->Mechanik->Primary() ) { // tylko jeśli ktoś tam siedzi - nie powinno dotyczyć pasażera!
|
||||
targetcell->UpdateValues(
|
||||
|
||||
6
Event.h
6
Event.h
@@ -25,8 +25,10 @@ public:
|
||||
value_1 = 1 << 1,
|
||||
value_2 = 1 << 2,
|
||||
// update values
|
||||
load = 1 << 3,
|
||||
mode_add = 1 << 4,
|
||||
mode_add = 1 << 3,
|
||||
// whois
|
||||
mode_alt = 1 << 3,
|
||||
load = 1 << 4,
|
||||
// condition values
|
||||
track_busy = 1 << 3,
|
||||
track_free = 1 << 4,
|
||||
|
||||
27
TrkFoll.cpp
27
TrkFoll.cpp
@@ -96,10 +96,6 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
|
||||
// bPrimary=true - jest pierwszą osią w pojeździe, czyli generuje eventy i przepisuje pojazd
|
||||
// Ra: zwraca false, jeśli pojazd ma być usunięty
|
||||
auto const ismoving { ( std::abs( fDistance ) > 0.01 ) && ( Owner->GetVelocity() > 0.01 ) };
|
||||
int const eventfilter { (
|
||||
( ( true == ismoving ) && ( Owner->ctOwner != nullptr ) ) ?
|
||||
Owner->ctOwner->Direction() * ( Owner->ctOwner->Vehicle()->DirectionGet() == Owner->DirectionGet() ? 1 : -1 ) * ( fDirection > 0 ? 1 : -1 ) :
|
||||
0 ) };
|
||||
fDistance *= fDirection; // dystans mnożnony przez kierunek
|
||||
double s; // roboczy dystans
|
||||
double dir; // zapamiętany kierunek do sprawdzenia, czy się zmienił
|
||||
@@ -110,6 +106,13 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
|
||||
// TODO: refactor following block as track method
|
||||
if( pCurrentTrack->m_events ) { // sumaryczna informacja o eventach
|
||||
// omijamy cały ten blok, gdy tor nie ma on żadnych eventów (większość nie ma)
|
||||
int const eventfilter { (
|
||||
false == ismoving ? 0 : // only moving vehicles activate events type 1/2
|
||||
false == bPrimary ? 0 : // only primary axle activates events type 1/2
|
||||
Owner->ctOwner == nullptr ?
|
||||
( fDistance > 0 ? 1 : -1 ) : // loose vehicle has no means to determine 'intended' direction so the filter does effectively nothing in such case
|
||||
( fDirection > 0 ? 1 : -1 ) * Owner->ctOwner->Direction() * ( Owner->ctOwner->Vehicle()->DirectionGet() == Owner->DirectionGet() ? 1 : -1 ) ) };
|
||||
|
||||
if( false == ismoving ) {
|
||||
//McZapkie-140602: wyzwalanie zdarzenia gdy pojazd stoi
|
||||
if( ( Owner->Mechanik != nullptr )
|
||||
@@ -127,16 +130,12 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
|
||||
&& ( Owner->Mechanik->Primary() ) ) {
|
||||
// tylko dla jednego członu
|
||||
// McZapkie-280503: wyzwalanie event tylko dla pojazdow z obsada
|
||||
if( true == bPrimary ) {
|
||||
pCurrentTrack->QueueEvents( pCurrentTrack->m_events1, Owner );
|
||||
}
|
||||
pCurrentTrack->QueueEvents( pCurrentTrack->m_events1, Owner );
|
||||
}
|
||||
}
|
||||
if( SetFlag( iEventallFlag, -1 ) ) {
|
||||
// McZapkie-280503: wyzwalanie eventall dla wszystkich pojazdow
|
||||
if( true == bPrimary ) {
|
||||
pCurrentTrack->QueueEvents( pCurrentTrack->m_events1all, Owner );
|
||||
}
|
||||
pCurrentTrack->QueueEvents( pCurrentTrack->m_events1all, Owner );
|
||||
}
|
||||
}
|
||||
else if( ( fDistance > 0 ) && ( eventfilter > 0 ) ) {
|
||||
@@ -146,16 +145,12 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
|
||||
if( ( Owner->Mechanik != nullptr )
|
||||
&& ( Owner->Mechanik->Primary() ) ) {
|
||||
// tylko dla jednego członu
|
||||
if( true == bPrimary ) {
|
||||
pCurrentTrack->QueueEvents( pCurrentTrack->m_events2, Owner );
|
||||
}
|
||||
pCurrentTrack->QueueEvents( pCurrentTrack->m_events2, Owner );
|
||||
}
|
||||
}
|
||||
if( SetFlag( iEventallFlag, -2 ) ) {
|
||||
// sprawdza i zeruje na przyszłość, true jeśli zmieni z 2 na 0
|
||||
if( true == bPrimary ) {
|
||||
pCurrentTrack->QueueEvents( pCurrentTrack->m_events2all, Owner );
|
||||
}
|
||||
pCurrentTrack->QueueEvents( pCurrentTrack->m_events2all, Owner );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,6 +174,7 @@ opengl_vbogeometrybank::draw_( gfx::geometry_handle const &Geometry, gfx::stream
|
||||
// try to set up the buffer we need
|
||||
::glGenBuffers( 1, &m_buffer );
|
||||
bind_buffer();
|
||||
if( m_buffer == 0 ) { return; } // if we didn't get a buffer we'll try again during the next draw call
|
||||
// NOTE: we're using static_draw since it's generally true for all we have implemented at the moment
|
||||
// TODO: allow to specify usage hint at the object creation, and pass it here
|
||||
::glBufferData(
|
||||
|
||||
Reference in New Issue
Block a user