support for binding multiple events to path pieces

This commit is contained in:
tmj-fstate
2018-06-13 21:42:22 +02:00
parent c2f0df9a0b
commit 0fe653cab9
6 changed files with 195 additions and 278 deletions

View File

@@ -418,15 +418,17 @@ void TController::TableClear()
eSignSkip = nullptr; // nic nie pomijamy
};
TEvent * TController::CheckTrackEvent( TTrack *Track, double const fDirection ) const
std::vector<TEvent *> TController::CheckTrackEvent( TTrack *Track, double const fDirection ) const
{ // sprawdzanie eventów na podanym torze do podstawowego skanowania
TEvent *e = (fDirection > 0) ? Track->evEvent2 : Track->evEvent1;
if (!e)
return NULL;
if (e->bEnabled)
return NULL;
// jednak wszystkie W4 do tabelki, bo jej czyszczenie na przystanku wprowadza zamieszanie
return e;
std::vector<TEvent *> events;
auto const &eventsequence { ( fDirection > 0 ? Track->m_events2 : Track->m_events1 ) };
for( auto const &event : eventsequence ) {
if( ( event.second != nullptr )
&& ( false == event.second->bEnabled ) ) {
events.emplace_back( event.second );
}
}
return events;
}
bool TController::TableAddNew()
@@ -462,7 +464,6 @@ void TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle)
TTrack *pTrack{ nullptr }; // zaczynamy od ostatniego analizowanego toru
double fTrackLength{ 0.0 }; // długość aktualnego toru (krótsza dla pierwszego)
double fCurrentDistance{ 0.0 }; // aktualna przeskanowana długość
TEvent *pEvent{ nullptr };
double fLastDir{ 0.0 };
if (iTableDirection != iDirection ) {
@@ -538,47 +539,50 @@ void TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle)
WriteLog( "Speed table for " + OwnerName() + " tracing through track " + pTrack->name() );
}
if( ( pEvent = CheckTrackEvent( pTrack, fLastDir ) ) != nullptr ) // jeśli jest semafor na tym torze
{ // trzeba sprawdzić tabelkę, bo dodawanie drugi raz tego samego przystanku nie jest korzystne
if (TableNotFound(pEvent)) // jeśli nie ma
{
TableAddNew(); // zawsze jest true
auto const events { CheckTrackEvent( pTrack, fLastDir ) };
for( auto *pEvent : events ) {
if( pEvent != nullptr ) // jeśli jest semafor na tym torze
{ // trzeba sprawdzić tabelkę, bo dodawanie drugi raz tego samego przystanku nie jest korzystne
if (TableNotFound(pEvent)) // jeśli nie ma
{
TableAddNew(); // zawsze jest true
if (Global.iWriteLogEnabled & 8) {
WriteLog("Speed table for " + OwnerName() + " found new event, " + pEvent->asName);
}
auto &newspeedpoint = sSpeedTable[iLast];
if (Global.iWriteLogEnabled & 8) {
WriteLog("Speed table for " + OwnerName() + " found new event, " + pEvent->asName);
}
auto &newspeedpoint = sSpeedTable[iLast];
/*
if( newspeedpoint.Set(
pEvent,
fCurrentDistance + ProjectEventOnTrack( pEvent, pTrack, fLastDir ),
OrderCurrentGet() ) ) {
if( newspeedpoint.Set(
pEvent,
fCurrentDistance + ProjectEventOnTrack( pEvent, pTrack, fLastDir ),
OrderCurrentGet() ) ) {
*/
if( newspeedpoint.Set(
pEvent,
GetDistanceToEvent( pTrack, pEvent, fLastDir, fCurrentDistance ),
OrderCurrentGet() ) ) {
if( newspeedpoint.Set(
pEvent,
GetDistanceToEvent( pTrack, pEvent, fLastDir, fCurrentDistance ),
OrderCurrentGet() ) ) {
fDistance = newspeedpoint.fDist; // jeśli sygnał stop, to nie ma potrzeby dalej skanować
SemNextStopIndex = iLast;
if (SemNextIndex == -1) {
SemNextIndex = iLast;
fDistance = newspeedpoint.fDist; // jeśli sygnał stop, to nie ma potrzeby dalej skanować
SemNextStopIndex = iLast;
if (SemNextIndex == -1) {
SemNextIndex = iLast;
}
if (Global.iWriteLogEnabled & 8) {
WriteLog("(stop signal from "
+ (SemNextStopIndex != -1 ? sSpeedTable[SemNextStopIndex].GetName() : "unknown semaphor")
+ ")");
}
}
if (Global.iWriteLogEnabled & 8) {
WriteLog("(stop signal from "
+ (SemNextStopIndex != -1 ? sSpeedTable[SemNextStopIndex].GetName() : "unknown semaphor")
+ ")");
}
}
else {
if ((true == newspeedpoint.IsProperSemaphor(OrderCurrentGet()))
&& (SemNextIndex == -1)) {
SemNextIndex = iLast; // sprawdzamy czy pierwszy na drodze
}
if (Global.iWriteLogEnabled & 8) {
WriteLog("(forward signal for "
+ (SemNextIndex != -1 ? sSpeedTable[SemNextIndex].GetName() : "unknown semaphor")
+ ")");
else {
if( ( true == newspeedpoint.IsProperSemaphor( OrderCurrentGet() ) )
&& ( SemNextIndex == -1 ) ) {
SemNextIndex = iLast; // sprawdzamy czy pierwszy na drodze
}
if (Global.iWriteLogEnabled & 8) {
WriteLog("(forward signal for "
+ (SemNextIndex != -1 ? sSpeedTable[SemNextIndex].GetName() : "unknown semaphor")
+ ")");
}
}
}
}
@@ -5563,12 +5567,17 @@ bool TController::BackwardTrackBusy(TTrack *Track)
TEvent * TController::CheckTrackEventBackward(double fDirection, TTrack *Track)
{ // sprawdzanie eventu w torze, czy jest sygnałowym - skanowanie do tyłu
TEvent *e = (fDirection > 0) ? Track->evEvent2 : Track->evEvent1;
if (e)
if (!e->bEnabled) // jeśli sygnałowy (nie dodawany do kolejki)
if (e->Type == tp_GetValues) // PutValues nie może się zmienić
return e;
return NULL;
// NOTE: this method returns only one event which meets the conditions, due to limitations in the caller
// TBD, TODO: clean up the caller and return all suitable events, as in theory things will go awry if the track has more than one signal
auto const &eventsequence { ( fDirection > 0 ? Track->m_events2 : Track->m_events1 ) };
for( auto const &event : eventsequence ) {
if( ( event.second != nullptr )
&& ( false == event.second->bEnabled )
&& ( event.second->Type == tp_GetValues ) ) {
return event.second;
}
}
return nullptr;
};
TTrack * TController::BackwardTraceRoute(double &fDistance, double &fDirection, TTrack *Track, TEvent *&Event)

View File

@@ -349,7 +349,7 @@ private:
int OrderDirectionChange(int newdir, TMoverParameters *Vehicle);
void Lights(int head, int rear);
// Ra: metody obsługujące skanowanie toru
TEvent *CheckTrackEvent(TTrack *Track, double const fDirection ) const;
std::vector<TEvent *> CheckTrackEvent(TTrack *Track, double const fDirection ) const;
bool TableAddNew();
bool TableNotFound(TEvent const *Event) const;
void TableTraceRoute(double fDistance, TDynamicObject *pVehicle = nullptr);

234
Track.cpp
View File

@@ -763,37 +763,37 @@ void TTrack::Load(cParser *parser, Math3D::vector3 pOrigin)
{
parser->getTokens();
*parser >> token;
asEvent0Name = token;
m_events0.emplace_back( token, nullptr );
}
else if (str == "event1")
{
parser->getTokens();
*parser >> token;
asEvent1Name = token;
m_events1.emplace_back( token, nullptr );
}
else if (str == "event2")
{
parser->getTokens();
*parser >> token;
asEvent2Name = token;
m_events2.emplace_back( token, nullptr );
}
else if (str == "eventall0")
{
parser->getTokens();
*parser >> token;
asEventall0Name = token;
m_events0all.emplace_back( token, nullptr );
}
else if (str == "eventall1")
{
parser->getTokens();
*parser >> token;
asEventall1Name = token;
m_events1all.emplace_back( token, nullptr );
}
else if (str == "eventall2")
{
parser->getTokens();
*parser >> token;
asEventall2Name = token;
m_events2all.emplace_back( token, nullptr );
}
else if (str == "velocity")
{
@@ -869,153 +869,44 @@ void TTrack::Load(cParser *parser, Math3D::vector3 pOrigin)
/ 3.0 } );
}
// TODO: refactor this mess
bool TTrack::AssignEvents(TEvent *NewEvent0, TEvent *NewEvent1, TEvent *NewEvent2, bool const Explicit )
{
bool bError = false;
bool TTrack::AssignEvents() {
if( NewEvent0 == nullptr ) {
if( false == asEvent0Name.empty() ) {
bError = true;
if( true == Explicit ) {
ErrorLog( "Bad event: event \"" + asEvent0Name + "\" assigned to track \"" + m_name + "\" does not exist" );
bool lookupfail { false };
std::vector< std::pair< std::string, event_sequence * > > const eventsequences {
{ "event0", &m_events0 }, { "eventall0", &m_events0all },
{ "event1", &m_events1 }, { "eventall1", &m_events1all },
{ "event2", &m_events2 }, { "eventall2", &m_events2all } };
for( auto &eventsequence : eventsequences ) {
for( auto &event : *( eventsequence.second ) ) {
event.second = simulation::Events.FindEvent( event.first );
if( event.second != nullptr ) {
m_events = true;
}
else {
ErrorLog( "Bad event: event \"" + event.first + "\" assigned to track \"" + m_name + "\" does not exist" );
lookupfail = true;
}
}
}
else {
if( evEvent0 == nullptr ) {
evEvent0 = NewEvent0;
/*
// preserve event names, we'll need them if we want the scenario export to be unaffected by missing events and such
asEvent0Name = "";
*/
iEvents |= 1; // sumaryczna informacja o eventach
}
else {
ErrorLog( "Bad track: event \"" + NewEvent0->asName + "\" cannot be assigned to track, track already has one" );
bError = true;
}
}
if( NewEvent1 == nullptr ) {
if( false == asEvent1Name.empty() ) {
bError = true;
if( true == Explicit ) {
ErrorLog( "Bad event: event \"" + asEvent1Name + "\" assigned to track \"" + m_name + "\" does not exist" );
auto const trackname { name() };
if( ( Global.iHiddenEvents & 1 )
&& ( false == trackname.empty() ) ) {
// jeśli podana jest nazwa torów, można szukać eventów skojarzonych przez nazwę
for( auto &eventsequence : eventsequences ) {
auto *event = simulation::Events.FindEvent( trackname + ':' + eventsequence.first );
if( event != nullptr ) {
// HACK: auto-associated events come with empty lookup string, to avoid including them in the text format export
eventsequence.second->emplace_back( "", event );
m_events = true;
}
}
}
else {
if( evEvent1 == nullptr ) {
evEvent1 = NewEvent1;
/*
asEvent1Name = "";
*/
iEvents |= 2; // sumaryczna informacja o eventach
}
else {
ErrorLog( "Bad track: event \"" + NewEvent1->asName + "\" cannot be assigned to track, track already has one" );
bError = true;
}
}
if( NewEvent2 == nullptr ) {
if( false == asEvent2Name.empty() ) {
bError = true;
if( true == Explicit ) {
ErrorLog( "Bad event: event \"" + asEvent2Name + "\" assigned to track \"" + m_name + "\" does not exist" );
}
}
}
else {
if( evEvent2 == nullptr ) {
evEvent2 = NewEvent2;
/*
asEvent2Name = "";
*/
iEvents |= 4; // sumaryczna informacja o eventach
}
else {
ErrorLog( "Bad track: event \"" + NewEvent2->asName + "\" cannot be assigned to track, track already has one" );
bError = true;
}
}
return ( bError == false );
}
bool TTrack::AssignallEvents(TEvent *NewEvent0, TEvent *NewEvent1, TEvent *NewEvent2, bool const Explicit)
{
bool bError = false;
if( NewEvent0 == nullptr ) {
if( false == asEventall0Name.empty() ) {
bError = true;
if( true == Explicit ) {
ErrorLog( "Bad event: event \"" + asEventall0Name + "\" assigned to track \"" + m_name + "\" does not exist" );
}
}
}
else {
if( evEventall0 == nullptr ) {
evEventall0 = NewEvent0;
/*
// preserve event names, we'll need them if we want the scenario export to be unaffected by missing events and such
asEventall0Name = "";
*/
iEvents |= 8; // sumaryczna informacja o eventach
}
else {
ErrorLog( "Bad track: event \"" + NewEvent0->asName + "\" cannot be assigned to track, track already has one" );
bError = true;
}
}
if( NewEvent1 == nullptr ) {
if( false == asEventall1Name.empty() ) {
bError = true;
if( true == Explicit ) {
ErrorLog( "Bad event: event \"" + asEventall1Name + "\" assigned to track \"" + m_name + "\" does not exist" );
}
}
}
else {
if( evEventall1 == nullptr ) {
evEventall1 = NewEvent1;
/*
asEventall1Name = "";
*/
iEvents |= 16; // sumaryczna informacja o eventach
}
else {
ErrorLog( "Bad track: event \"" + NewEvent1->asName + "\" cannot be assigned to track, track already has one" );
bError = true;
}
}
if( NewEvent2 == nullptr ) {
if( false == asEventall2Name.empty() ) {
bError = true;
if( true == Explicit ) {
ErrorLog( "Bad event: event \"" + asEventall2Name + "\" assigned to track \"" + m_name + "\" does not exist" );
}
}
}
else {
if( evEventall2 == nullptr ) {
evEventall2 = NewEvent2;
/*
asEventall2Name = "";
*/
iEvents |= 32; // sumaryczna informacja o eventach
}
else {
ErrorLog( "Bad track: event \"" + NewEvent2->asName + "\" cannot be assigned to track, track already has one" );
bError = true;
}
}
return ( bError == false );
return ( lookupfail == false );
}
bool TTrack::AssignForcedEvents(TEvent *NewEventPlus, TEvent *NewEventMinus)
@@ -2903,23 +2794,19 @@ TTrack::export_as_text_( std::ostream &Output ) const {
<< path.radius << ' ';
}
// optional attributes
if( false == asEvent0Name.empty() ) {
Output << "event0 " << asEvent0Name << ' ';
}
if( false == asEvent1Name.empty() ) {
Output << "event1 " << asEvent1Name << ' ';
}
if( false == asEvent2Name.empty() ) {
Output << "event2 " << asEvent2Name << ' ';
}
if( false == asEventall0Name.empty() ) {
Output << "eventall0 " << asEventall0Name << ' ';
}
if( false == asEventall1Name.empty() ) {
Output << "eventall1 " << asEventall1Name << ' ';
}
if( false == asEventall2Name.empty() ) {
Output << "eventall2 " << asEventall2Name << ' ';
std::vector< std::pair< std::string, event_sequence const * > > const eventsequences {
{ "event0", &m_events0 }, { "eventall0", &m_events0all },
{ "event1", &m_events1 }, { "eventall1", &m_events1all },
{ "event2", &m_events2 }, { "eventall2", &m_events2all } };
for( auto &eventsequence : eventsequences ) {
for( auto &event : *( eventsequence.second ) ) {
if( false == event.first.empty() ) {
Output
<< eventsequence.first << ' '
<< event.first << ' ';
}
}
}
if( ( SwitchExtension )
&& ( SwitchExtension->fVelocity != -1.0 ) ) {
@@ -3063,33 +2950,10 @@ path_table::InitTracks() {
for( auto first = std::rbegin(m_items); first != std::rend(m_items); ++first ) {
auto *track = *first;
#endif
track->AssignEvents(
simulation::Events.FindEvent( track->asEvent0Name ),
simulation::Events.FindEvent( track->asEvent1Name ),
simulation::Events.FindEvent( track->asEvent2Name ) );
track->AssignallEvents(
simulation::Events.FindEvent( track->asEventall0Name ),
simulation::Events.FindEvent( track->asEventall1Name ),
simulation::Events.FindEvent( track->asEventall2Name ) );
track->AssignEvents();
auto const trackname { track->name() };
if( ( Global.iHiddenEvents & 1 )
&& ( false == trackname.empty() ) ) {
// jeśli podana jest nazwa torów, można szukać eventów skojarzonych przez nazwę
track->AssignEvents(
simulation::Events.FindEvent( trackname + ":event0" ),
simulation::Events.FindEvent( trackname + ":event1" ),
simulation::Events.FindEvent( trackname + ":event2" ),
false );
track->AssignallEvents(
simulation::Events.FindEvent( trackname + ":eventall0" ),
simulation::Events.FindEvent( trackname + ":eventall1" ),
simulation::Events.FindEvent( trackname + ":eventall2" ),
false );
}
switch (track->eType) {
// TODO: re-enable
case tt_Table: {

20
Track.h
View File

@@ -149,16 +149,26 @@ private:
glm::dvec3 m_origin;
material_handle m_material1 = 0; // tekstura szyn albo nawierzchni
material_handle m_material2 = 0; // tekstura automatycznej podsypki albo pobocza
typedef std::vector<gfx::geometry_handle> geometryhandle_sequence;
using geometryhandle_sequence = std::vector<gfx::geometry_handle>;
geometryhandle_sequence Geometry1; // geometry chunks textured with texture 1
geometryhandle_sequence Geometry2; // geometry chunks textured with texture 2
std::vector<segment_data> m_paths; // source data for owned paths
public:
typedef std::deque<TDynamicObject *> dynamics_sequence;
using dynamics_sequence = std::deque<TDynamicObject *>;
using event_sequence = std::vector<std::pair<std::string, TEvent *> >;
dynamics_sequence Dynamics;
int iEvents = 0; // Ra: flaga informująca o obecności eventów
event_sequence
m_events0all,
m_events1all,
m_events2all,
m_events0,
m_events1,
m_events2;
bool m_events { false }; // Ra: flaga informująca o obecności eventów
/*
TEvent *evEventall0 = nullptr; // McZapkie-140302: wyzwalany gdy pojazd stoi
TEvent *evEventall1 = nullptr;
TEvent *evEventall2 = nullptr;
@@ -171,6 +181,7 @@ public:
std::string asEvent0Name;
std::string asEvent1Name;
std::string asEvent2Name;
*/
int iNextDirection = 0; // 0:Point1, 1:Point2, 3:do odchylonego na zwrotnicy
int iPrevDirection = 0; // domyślnie wirtualne odcinki dołączamy stroną od Point1
TTrackType eType = tt_Normal; // domyślnie zwykły
@@ -234,8 +245,7 @@ public:
SwitchExtension->iRoads - 1 :
1 ); }
void Load(cParser *parser, Math3D::vector3 pOrigin);
bool AssignEvents(TEvent *NewEvent0, TEvent *NewEvent1, TEvent *NewEvent2, bool const Explicit = true );
bool AssignallEvents(TEvent *NewEvent0, TEvent *NewEvent1, TEvent *NewEvent2, bool const Explicit = true );
bool AssignEvents();
bool AssignForcedEvents(TEvent *NewEventPlus, TEvent *NewEventMinus);
bool CheckDynamicObject(TDynamicObject *Dynamic);
bool AddDynamicObject(TDynamicObject *Dynamic);

View File

@@ -101,7 +101,7 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
{ // pętla przesuwająca wózek przez kolejne tory, aż do trafienia w jakiś
if( pCurrentTrack == nullptr ) { return false; } // nie ma toru, to nie ma przesuwania
// TODO: refactor following block as track method
if( pCurrentTrack->iEvents ) { // sumaryczna informacja o eventach
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)
if( ( std::abs( fDistance ) < 0.01 )
&& ( Owner->GetVelocity() < 0.01 ) ) {
@@ -109,14 +109,18 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
if( ( Owner->Mechanik != nullptr )
&& ( Owner->Mechanik->Primary() ) ) {
// tylko dla jednego członu
if( ( pCurrentTrack->evEvent0 )
&& ( pCurrentTrack->evEvent0->iQueued == 0 ) ) {
simulation::Events.AddToQuery( pCurrentTrack->evEvent0, Owner );
for( auto &event : pCurrentTrack->m_events0 ) {
if( ( event.second != nullptr )
&& ( event.second->iQueued == 0 ) ) {
simulation::Events.AddToQuery( event.second, Owner );
}
}
}
if( ( pCurrentTrack->evEventall0 )
&& ( pCurrentTrack->evEventall0->iQueued == 0 ) ) {
simulation::Events.AddToQuery( pCurrentTrack->evEventall0, Owner );
for( auto &event : pCurrentTrack->m_events0all ) {
if( ( event.second != nullptr )
&& ( event.second->iQueued == 0 ) ) {
simulation::Events.AddToQuery( event.second, Owner );
}
}
}
else if (fDistance < 0) {
@@ -127,20 +131,27 @@ 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->evEvent1 != nullptr )
&& ( pCurrentTrack->evEvent1->iQueued == 0 ) ) {
// dodanie do kolejki
simulation::Events.AddToQuery( pCurrentTrack->evEvent1, Owner );
if( true == bPrimary ) {
for( auto &event : pCurrentTrack->m_events1 ) {
if( ( event.second != nullptr )
&& ( event.second->iQueued == 0 ) ) {
// dodanie do kolejki
simulation::Events.AddToQuery( event.second, Owner );
}
}
}
}
}
if( SetFlag( iEventallFlag, -1 ) ) {
// McZapkie-280503: wyzwalanie eventall dla wszystkich pojazdow
if( ( true == bPrimary )
&& ( pCurrentTrack->evEventall1 != nullptr )
&& ( pCurrentTrack->evEventall1->iQueued == 0 ) ) {
simulation::Events.AddToQuery( pCurrentTrack->evEventall1, Owner ); // dodanie do kolejki
if( true == bPrimary ) {
for( auto &event : pCurrentTrack->m_events1all ) {
if( ( event.second != nullptr )
&& ( event.second->iQueued == 0 ) ) {
// dodanie do kolejki
simulation::Events.AddToQuery( event.second, Owner );
}
}
}
}
}
@@ -151,19 +162,27 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
if( ( Owner->Mechanik != nullptr )
&& ( Owner->Mechanik->Primary() ) ) {
// tylko dla jednego członu
if( ( true == bPrimary )
&& ( pCurrentTrack->evEvent2 != nullptr )
&& ( pCurrentTrack->evEvent2->iQueued == 0 ) ) {
simulation::Events.AddToQuery( pCurrentTrack->evEvent2, Owner );
if( true == bPrimary ) {
for( auto &event : pCurrentTrack->m_events2 ) {
if( ( event.second != nullptr )
&& ( event.second->iQueued == 0 ) ) {
// dodanie do kolejki
simulation::Events.AddToQuery( event.second, Owner );
}
}
}
}
}
if( SetFlag( iEventallFlag, -2 ) ) {
// sprawdza i zeruje na przyszłość, true jeśli zmieni z 2 na 0
if( ( true == bPrimary )
&& ( pCurrentTrack->evEventall2 != nullptr )
&& ( pCurrentTrack->evEventall2->iQueued == 0 ) ) {
simulation::Events.AddToQuery( pCurrentTrack->evEventall2, Owner );
if( true == bPrimary ) {
for( auto &event : pCurrentTrack->m_events2all ) {
if( ( event.second != nullptr )
&& ( event.second->iQueued == 0 ) ) {
// dodanie do kolejki
simulation::Events.AddToQuery( event.second, Owner );
}
}
}
}
}
@@ -258,18 +277,33 @@ bool TTrackFollower::Move(double fDistance, bool bPrimary)
{ // gdy zostaje na tym samym torze (przesuwanie już nie zmienia toru)
if (bPrimary)
{ // tylko gdy początkowe ustawienie, dodajemy eventy stania do kolejki
if (Owner->MoverParameters->ActiveCab != 0)
// if (Owner->MoverParameters->CabNo!=0)
{
if (pCurrentTrack->evEvent1 && pCurrentTrack->evEvent1->fDelay <= -1.0f)
simulation::Events.AddToQuery(pCurrentTrack->evEvent1, Owner);
if (pCurrentTrack->evEvent2 && pCurrentTrack->evEvent2->fDelay <= -1.0f)
simulation::Events.AddToQuery(pCurrentTrack->evEvent2, Owner);
if (Owner->MoverParameters->ActiveCab != 0) {
for( auto &event : pCurrentTrack->m_events1 ) {
if( ( event.second != nullptr )
&& ( event.second->fDelay <= -1.0 ) ) {
simulation::Events.AddToQuery( event.second, Owner );
}
}
for( auto &event : pCurrentTrack->m_events2 ) {
if( ( event.second != nullptr )
&& ( event.second->fDelay <= -1.0 ) ) {
simulation::Events.AddToQuery( event.second, Owner );
}
}
}
for( auto &event : pCurrentTrack->m_events1all ) {
if( ( event.second != nullptr )
&& ( event.second->fDelay <= -1.0 ) ) {
simulation::Events.AddToQuery( event.second, Owner );
}
}
for( auto &event : pCurrentTrack->m_events2all ) {
if( ( event.second != nullptr )
&& ( event.second->fDelay <= -1.0 ) ) {
simulation::Events.AddToQuery( event.second, Owner );
}
}
if (pCurrentTrack->evEventall1 && pCurrentTrack->evEventall1->fDelay <= -1.0f)
simulation::Events.AddToQuery(pCurrentTrack->evEventall1, Owner);
if (pCurrentTrack->evEventall2 && pCurrentTrack->evEventall2->fDelay <= -1.0f)
simulation::Events.AddToQuery(pCurrentTrack->evEventall2, Owner);
}
fCurrentDistance = s;
// fDistance=0;

View File

@@ -789,7 +789,7 @@ state_manager::deserialize_dynamic( cParser &Input, scene::scratch_data &Scratch
}
if( ( true == Scratchpad.trainset.vehicles.empty() ) // jeśli pierwszy pojazd,
&& ( false == path->asEvent0Name.empty() ) // tor ma Event0
&& ( false == path->m_events0.empty() ) // tor ma Event0
&& ( std::abs( velocity ) <= 1.f ) // a skład stoi
&& ( Scratchpad.trainset.offset >= 0.0 ) // ale może nie sięgać na owy tor
&& ( Scratchpad.trainset.offset < 8.0 ) ) { // i raczej nie sięga