mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-24 12:09:19 +02:00
maintenance: fixes for some of cppcheck warnings
This commit is contained in:
141
Driver.cpp
141
Driver.cpp
@@ -873,9 +873,9 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
|||||||
{
|
{
|
||||||
// porównuje do następnej stacji, więc trzeba przewinąć do poprzedniej
|
// porównuje do następnej stacji, więc trzeba przewinąć do poprzedniej
|
||||||
// nastepnie ustawić następną na aktualną tak żeby prawidłowo ją obsłużył w następnym kroku
|
// nastepnie ustawić następną na aktualną tak żeby prawidłowo ją obsłużył w następnym kroku
|
||||||
if( true == TrainParams->RewindTimeTable( sSpeedTable[ i ].evEvent->input_text() ) ) {
|
if( true == TrainParams.RewindTimeTable( sSpeedTable[ i ].evEvent->input_text() ) ) {
|
||||||
asNextStop = TrainParams->NextStop();
|
asNextStop = TrainParams.NextStop();
|
||||||
iStationStart = TrainParams->StationIndex;
|
iStationStart = TrainParams.StationIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( sSpeedTable[ i ].fDist < -fLength ) {
|
else if( sSpeedTable[ i ].fDist < -fLength ) {
|
||||||
@@ -886,7 +886,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
|||||||
}
|
}
|
||||||
else if (iDrivigFlags & moveStopPoint) // jeśli pomijanie W4, to nie sprawdza czasu odjazdu
|
else if (iDrivigFlags & moveStopPoint) // jeśli pomijanie W4, to nie sprawdza czasu odjazdu
|
||||||
{ // tylko gdy nazwa zatrzymania się zgadza
|
{ // tylko gdy nazwa zatrzymania się zgadza
|
||||||
if (!TrainParams->IsStop())
|
if (false == TrainParams.IsStop())
|
||||||
{ // jeśli nie ma tu postoju
|
{ // jeśli nie ma tu postoju
|
||||||
sSpeedTable[i].fVelNext = -1; // maksymalna prędkość w tym miejscu
|
sSpeedTable[i].fVelNext = -1; // maksymalna prędkość w tym miejscu
|
||||||
// przy 160km/h jedzie 44m/s, to da dokładność rzędu 5 sekund
|
// przy 160km/h jedzie 44m/s, to da dokładność rzędu 5 sekund
|
||||||
@@ -894,16 +894,16 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
|||||||
// zaliczamy posterunek w pewnej odległości przed (choć W4 nie zasłania już semafora)
|
// zaliczamy posterunek w pewnej odległości przed (choć W4 nie zasłania już semafora)
|
||||||
#if LOGSTOPS
|
#if LOGSTOPS
|
||||||
WriteLog(
|
WriteLog(
|
||||||
pVehicle->asName + " as " + TrainParams->TrainName
|
pVehicle->asName + " as " + TrainParams.TrainName
|
||||||
+ ": 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)
|
||||||
+ " passed " + asNextStop); // informacja
|
+ " passed " + asNextStop); // informacja
|
||||||
#endif
|
#endif
|
||||||
// przy jakim dystansie (stanie licznika) ma przesunąć na następny postój
|
// przy jakim dystansie (stanie licznika) ma przesunąć na następny postój
|
||||||
fLastStopExpDist = mvOccupied->DistCounter + 0.250 + 0.001 * fLength;
|
fLastStopExpDist = mvOccupied->DistCounter + 0.250 + 0.001 * fLength;
|
||||||
TrainParams->UpdateMTable( simulation::Time, asNextStop );
|
TrainParams.UpdateMTable( simulation::Time, asNextStop );
|
||||||
UpdateDelayFlag();
|
UpdateDelayFlag();
|
||||||
TrainParams->StationIndexInc(); // przejście do następnej
|
TrainParams.StationIndexInc(); // przejście do następnej
|
||||||
asNextStop = TrainParams->NextStop(); // pobranie kolejnego miejsca zatrzymania
|
asNextStop = TrainParams.NextStop(); // pobranie kolejnego miejsca zatrzymania
|
||||||
sSpeedTable[i].iFlags = 0; // nie liczy się już
|
sSpeedTable[i].iFlags = 0; // nie liczy się już
|
||||||
continue; // nie analizować prędkości
|
continue; // nie analizować prędkości
|
||||||
}
|
}
|
||||||
@@ -971,9 +971,9 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
|||||||
Doors( true, static_cast<int>( std::floor( std::abs( sSpeedTable[ i ].evEvent->input_value( 2 ) ) ) ) % 10 );
|
Doors( true, static_cast<int>( std::floor( std::abs( sSpeedTable[ i ].evEvent->input_value( 2 ) ) ) ) % 10 );
|
||||||
}
|
}
|
||||||
|
|
||||||
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 ) {
|
if( TrainParams.StationIndex < TrainParams.StationCount ) {
|
||||||
// jeśli są dalsze stacje, bez trąbienia przed odjazdem
|
// 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
|
// also ignore any horn cue that may be potentially set below 1 km/h and before the actual full stop
|
||||||
iDrivigFlags &= ~( moveStartHorn | moveStartHornNow );
|
iDrivigFlags &= ~( moveStartHorn | moveStartHornNow );
|
||||||
@@ -985,12 +985,12 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
|||||||
// TODO: remove the check once the station system is in place
|
// TODO: remove the check once the station system is in place
|
||||||
if( m_lastexchangestop != asNextStop ) {
|
if( m_lastexchangestop != asNextStop ) {
|
||||||
auto const platformside = static_cast<int>( std::floor( std::abs( sSpeedTable[ i ].evEvent->input_value( 2 ) ) ) ) % 10;
|
auto const platformside = static_cast<int>( std::floor( std::abs( sSpeedTable[ i ].evEvent->input_value( 2 ) ) ) ) % 10;
|
||||||
auto const exchangetime = simulation::Station.update_load( pVehicles[ 0 ], *TrainParams, platformside );
|
auto const exchangetime = simulation::Station.update_load( pVehicles[ 0 ], TrainParams, platformside );
|
||||||
WaitingSet( exchangetime );
|
WaitingSet( exchangetime );
|
||||||
m_lastexchangestop = asNextStop;
|
m_lastexchangestop = asNextStop;
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
if (iDrivigFlags & movePushPull) {
|
if (iDrivigFlags & movePushPull) {
|
||||||
@@ -999,7 +999,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
|||||||
if (OrderNextGet() != Change_direction) {
|
if (OrderNextGet() != Change_direction) {
|
||||||
OrderPush(Change_direction); // zmiana kierunku
|
OrderPush(Change_direction); // zmiana kierunku
|
||||||
OrderPush(
|
OrderPush(
|
||||||
TrainParams->StationIndex < TrainParams->StationCount ?
|
TrainParams.StationIndex < TrainParams.StationCount ?
|
||||||
Obey_train :
|
Obey_train :
|
||||||
Shunt); // to dalej wg rozkładu
|
Shunt); // to dalej wg rozkładu
|
||||||
}
|
}
|
||||||
@@ -1027,18 +1027,18 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
|||||||
CheckVehicles(); // zmienić światła
|
CheckVehicles(); // zmienić światła
|
||||||
}
|
}
|
||||||
|
|
||||||
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 + simulation::Time.data().wSecond*0.0167 )) {
|
if (TrainParams.IsTimeToGo(simulation::Time.data().wHour, simulation::Time.data().wMinute + simulation::Time.data().wSecond*0.0167 )) {
|
||||||
// z dalszą akcją czekamy do godziny odjazdu
|
// z dalszą akcją czekamy do godziny odjazdu
|
||||||
IsAtPassengerStop = false;
|
IsAtPassengerStop = false;
|
||||||
// przy jakim dystansie (stanie licznika) ma przesunąć na następny postój
|
// przy jakim dystansie (stanie licznika) ma przesunąć na następny postój
|
||||||
fLastStopExpDist = mvOccupied->DistCounter + 0.050 + 0.001 * fLength;
|
fLastStopExpDist = mvOccupied->DistCounter + 0.050 + 0.001 * fLength;
|
||||||
TrainParams->StationIndexInc(); // przejście do następnej
|
TrainParams.StationIndexInc(); // przejście do następnej
|
||||||
asNextStop = TrainParams->NextStop(); // pobranie kolejnego miejsca zatrzymania
|
asNextStop = TrainParams.NextStop(); // pobranie kolejnego miejsca zatrzymania
|
||||||
#if LOGSTOPS
|
#if LOGSTOPS
|
||||||
WriteLog(
|
WriteLog(
|
||||||
pVehicle->asName + " as " + TrainParams->TrainName
|
pVehicle->asName + " as " + TrainParams.TrainName
|
||||||
+ ": 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
|
||||||
@@ -1074,12 +1074,12 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
|||||||
// jeśli dojechaliśmy do końca rozkładu
|
// jeśli dojechaliśmy do końca rozkładu
|
||||||
#if LOGSTOPS
|
#if LOGSTOPS
|
||||||
WriteLog(
|
WriteLog(
|
||||||
pVehicle->asName + " as " + TrainParams->TrainName
|
pVehicle->asName + " as " + TrainParams.TrainName
|
||||||
+ ": 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)
|
||||||
+ " end of route."); // informacja
|
+ " end of route."); // informacja
|
||||||
#endif
|
#endif
|
||||||
asNextStop = TrainParams->NextStop(); // informacja o końcu trasy
|
asNextStop = TrainParams.NextStop(); // informacja o końcu trasy
|
||||||
TrainParams->NewName("none"); // czyszczenie nieaktualnego rozkładu
|
TrainParams.NewName("none"); // czyszczenie nieaktualnego rozkładu
|
||||||
// ma nie podjeżdżać pod W4 i ma je pomijać
|
// ma nie podjeżdżać pod W4 i ma je pomijać
|
||||||
iDrivigFlags &= ~( moveStopCloser );
|
iDrivigFlags &= ~( moveStopCloser );
|
||||||
if( false == TestFlag( iDrivigFlags, movePushPull ) ) {
|
if( false == TestFlag( iDrivigFlags, movePushPull ) ) {
|
||||||
@@ -1644,9 +1644,9 @@ TController::TController(bool AI, TDynamicObject *NewControll, bool InitPsyche,
|
|||||||
}
|
}
|
||||||
// TrainParams=NewTrainParams;
|
// TrainParams=NewTrainParams;
|
||||||
// if (TrainParams)
|
// if (TrainParams)
|
||||||
// asNextStop=TrainParams->NextStop();
|
// asNextStop=TrainParams.NextStop();
|
||||||
// else
|
// else
|
||||||
TrainParams = new TTrainParameters("none"); // rozkład jazdy
|
TrainParams = TTrainParameters("none"); // rozkład jazdy
|
||||||
// OrderCommand="";
|
// OrderCommand="";
|
||||||
// OrderValue=0;
|
// OrderValue=0;
|
||||||
OrdersClear();
|
OrdersClear();
|
||||||
@@ -1694,7 +1694,6 @@ void TController::CloseLog()
|
|||||||
|
|
||||||
TController::~TController()
|
TController::~TController()
|
||||||
{ // wykopanie mechanika z roboty
|
{ // wykopanie mechanika z roboty
|
||||||
delete TrainParams;
|
|
||||||
CloseLog();
|
CloseLog();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2160,7 +2159,7 @@ bool TController::CheckVehicles(TOrders user)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (p->asDestination == "none")
|
if (p->asDestination == "none")
|
||||||
p->DestinationSet(TrainParams->Relation2, TrainParams->TrainName); // relacja docelowa, jeśli nie było
|
p->DestinationSet(TrainParams.Relation2, TrainParams.TrainName); // relacja docelowa, jeśli nie było
|
||||||
if (AIControllFlag) // jeśli prowadzi komputer
|
if (AIControllFlag) // jeśli prowadzi komputer
|
||||||
p->RaLightsSet(0, 0); // gasimy światła
|
p->RaLightsSet(0, 0); // gasimy światła
|
||||||
if (p->MoverParameters->EnginePowerSource.SourceType == TPowerSource::CurrentCollector)
|
if (p->MoverParameters->EnginePowerSource.SourceType == TPowerSource::CurrentCollector)
|
||||||
@@ -2601,13 +2600,13 @@ bool TController::PrepareEngine()
|
|||||||
eStopReason = stopNone;
|
eStopReason = stopNone;
|
||||||
}
|
}
|
||||||
eAction = TAction::actUnknown;
|
eAction = TAction::actUnknown;
|
||||||
iEngineActive = 1;
|
iEngineActive = true;
|
||||||
iDrivigFlags |= moveActive; // może skanować sygnały i reagować na komendy
|
iDrivigFlags |= moveActive; // może skanować sygnały i reagować na komendy
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
iEngineActive = 0;
|
iEngineActive = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -2703,7 +2702,7 @@ bool TController::ReleaseEngine() {
|
|||||||
|
|
||||||
if (OK) {
|
if (OK) {
|
||||||
// jeśli się zatrzymał
|
// jeśli się zatrzymał
|
||||||
iEngineActive = 0;
|
iEngineActive = false;
|
||||||
eStopReason = stopSleep; // stoimy z powodu wyłączenia
|
eStopReason = stopSleep; // stoimy z powodu wyłączenia
|
||||||
eAction = TAction::actSleep; //śpi (wygaszony)
|
eAction = TAction::actSleep; //śpi (wygaszony)
|
||||||
|
|
||||||
@@ -3934,22 +3933,19 @@ bool TController::PutCommand( std::string NewCommand, double NewValue1, double N
|
|||||||
#if LOGSTOPS
|
#if LOGSTOPS
|
||||||
WriteLog("New timetable for " + pVehicle->asName + ": " + NewCommand); // informacja
|
WriteLog("New timetable for " + pVehicle->asName + ": " + NewCommand); // informacja
|
||||||
#endif
|
#endif
|
||||||
if (!TrainParams)
|
TrainParams = TTrainParameters(NewCommand); // rozkład jazdy
|
||||||
TrainParams = new TTrainParameters(NewCommand); // rozkład jazdy
|
|
||||||
else
|
|
||||||
TrainParams->NewName(NewCommand); // czyści tabelkę przystanków
|
|
||||||
tsGuardSignal = sound_source { sound_placement::internal, 2 * EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // wywalenie kierownika
|
tsGuardSignal = sound_source { sound_placement::internal, 2 * EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // wywalenie kierownika
|
||||||
m_lastexchangestop.clear();
|
m_lastexchangestop.clear();
|
||||||
if (NewCommand != "none")
|
if (NewCommand != "none")
|
||||||
{
|
{
|
||||||
if (!TrainParams->LoadTTfile(
|
if (false == TrainParams.LoadTTfile(
|
||||||
std::string(Global.asCurrentSceneryPath.c_str()), floor(NewValue2 + 0.5),
|
std::string(Global.asCurrentSceneryPath.c_str()), floor(NewValue2 + 0.5),
|
||||||
NewValue1)) // pierwszy parametr to przesunięcie rozkładu w czasie
|
NewValue1)) // pierwszy parametr to przesunięcie rozkładu w czasie
|
||||||
{
|
{
|
||||||
if (ConversionError == -8)
|
if (ConversionError == -8)
|
||||||
ErrorLog("Missed timetable: " + NewCommand);
|
ErrorLog("Missed timetable: " + NewCommand);
|
||||||
WriteLog("Cannot load timetable file " + NewCommand + "\r\nError " +
|
WriteLog("Cannot load timetable file " + NewCommand + "\r\nError " +
|
||||||
std::to_string(ConversionError) + " in position " + std::to_string(TrainParams->StationCount));
|
std::to_string(ConversionError) + " in position " + std::to_string(TrainParams.StationCount));
|
||||||
NewCommand = ""; // puste, dla wymiennej tekstury
|
NewCommand = ""; // puste, dla wymiennej tekstury
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -3957,10 +3953,10 @@ bool TController::PutCommand( std::string NewCommand, double NewValue1, double N
|
|||||||
// HACK: clear the potentially set door state flag to ensure door get opened if applicable
|
// HACK: clear the potentially set door state flag to ensure door get opened if applicable
|
||||||
iDrivigFlags &= ~( moveDoorOpened );
|
iDrivigFlags &= ~( moveDoorOpened );
|
||||||
|
|
||||||
TrainParams->UpdateMTable( simulation::Time, TrainParams->NextStationName );
|
TrainParams.UpdateMTable( simulation::Time, TrainParams.NextStationName );
|
||||||
TrainParams->StationIndexInc(); // przejście do następnej
|
TrainParams.StationIndexInc(); // przejście do następnej
|
||||||
iStationStart = TrainParams->StationIndex;
|
iStationStart = TrainParams.StationIndex;
|
||||||
asNextStop = TrainParams->NextStop();
|
asNextStop = TrainParams.NextStop();
|
||||||
iDrivigFlags |= movePrimary; // skoro dostał rozkład, to jest teraz głównym
|
iDrivigFlags |= movePrimary; // skoro dostał rozkład, to jest teraz głównym
|
||||||
// NewCommand = Global.asCurrentSceneryPath + NewCommand;
|
// NewCommand = Global.asCurrentSceneryPath + NewCommand;
|
||||||
auto lookup =
|
auto lookup =
|
||||||
@@ -3974,7 +3970,7 @@ bool TController::PutCommand( std::string NewCommand, double NewValue1, double N
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
NewCommand += "radio";
|
NewCommand += "radio";
|
||||||
auto lookup =
|
lookup =
|
||||||
FileExists(
|
FileExists(
|
||||||
{ Global.asCurrentSceneryPath + NewCommand, szSoundPath + NewCommand },
|
{ Global.asCurrentSceneryPath + NewCommand, szSoundPath + NewCommand },
|
||||||
{ ".ogg", ".flac", ".wav" } );
|
{ ".ogg", ".flac", ".wav" } );
|
||||||
@@ -3984,13 +3980,13 @@ bool TController::PutCommand( std::string NewCommand, double NewValue1, double N
|
|||||||
iGuardRadio = iRadioChannel;
|
iGuardRadio = iRadioChannel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NewCommand = TrainParams->Relation2; // relacja docelowa z rozkładu
|
NewCommand = TrainParams.Relation2; // relacja docelowa z rozkładu
|
||||||
}
|
}
|
||||||
// jeszcze poustawiać tekstury na wyświetlaczach
|
// jeszcze poustawiać tekstury na wyświetlaczach
|
||||||
TDynamicObject *p = pVehicles[0];
|
TDynamicObject *p = pVehicles[0];
|
||||||
while (p)
|
while (p)
|
||||||
{
|
{
|
||||||
p->DestinationSet(NewCommand, TrainParams->TrainName); // relacja docelowa
|
p->DestinationSet(NewCommand, TrainParams.TrainName); // relacja docelowa
|
||||||
p = p->Next(); // pojazd podłączony od tyłu (licząc od czoła)
|
p = p->Next(); // pojazd podłączony od tyłu (licząc od czoła)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4048,7 +4044,7 @@ bool TController::PutCommand( std::string NewCommand, double NewValue1, double N
|
|||||||
vCommandLocation = *NewLocation;
|
vCommandLocation = *NewLocation;
|
||||||
if ((NewValue1 != 0.0) && (OrderCurrentGet() != Obey_train))
|
if ((NewValue1 != 0.0) && (OrderCurrentGet() != Obey_train))
|
||||||
{ // o ile jazda
|
{ // o ile jazda
|
||||||
if( iEngineActive == 0 ) {
|
if( false == iEngineActive ) {
|
||||||
// trzeba odpalić silnik najpierw, światła ustawi
|
// trzeba odpalić silnik najpierw, światła ustawi
|
||||||
OrderNext( Prepare_engine );
|
OrderNext( Prepare_engine );
|
||||||
}
|
}
|
||||||
@@ -4079,7 +4075,7 @@ bool TController::PutCommand( std::string NewCommand, double NewValue1, double N
|
|||||||
if (NewLocation)
|
if (NewLocation)
|
||||||
vCommandLocation = *NewLocation;
|
vCommandLocation = *NewLocation;
|
||||||
// if (OrderList[OrderPos]=Obey_train) and (NewValue1<>0))
|
// if (OrderList[OrderPos]=Obey_train) and (NewValue1<>0))
|
||||||
if (!iEngineActive)
|
if (false == iEngineActive)
|
||||||
OrderNext(Prepare_engine); // trzeba odpalić silnik najpierw
|
OrderNext(Prepare_engine); // trzeba odpalić silnik najpierw
|
||||||
OrderNext(Shunt); // zamieniamy w aktualnej pozycji, albo dodajey za odpaleniem silnika
|
OrderNext(Shunt); // zamieniamy w aktualnej pozycji, albo dodajey za odpaleniem silnika
|
||||||
if (NewValue1 != 0.0)
|
if (NewValue1 != 0.0)
|
||||||
@@ -4126,7 +4122,7 @@ bool TController::PutCommand( std::string NewCommand, double NewValue1, double N
|
|||||||
if (NewCommand == "Change_direction")
|
if (NewCommand == "Change_direction")
|
||||||
{
|
{
|
||||||
TOrders o = OrderCurrentGet(); // co robił przed zmianą kierunku
|
TOrders o = OrderCurrentGet(); // co robił przed zmianą kierunku
|
||||||
if (!iEngineActive)
|
if (false == iEngineActive)
|
||||||
OrderNext(Prepare_engine); // trzeba odpalić silnik najpierw
|
OrderNext(Prepare_engine); // trzeba odpalić silnik najpierw
|
||||||
if (NewValue1 == 0.0)
|
if (NewValue1 == 0.0)
|
||||||
iDirectionOrder = -iDirection; // zmiana na przeciwny niż obecny
|
iDirectionOrder = -iDirection; // zmiana na przeciwny niż obecny
|
||||||
@@ -4186,7 +4182,7 @@ bool TController::PutCommand( std::string NewCommand, double NewValue1, double N
|
|||||||
// x,-y - podłączyć się do składu (sprzęgiem y>=1), a następnie odczepić i zabrać (x) wagonów
|
// x,-y - podłączyć się do składu (sprzęgiem y>=1), a następnie odczepić i zabrać (x) wagonów
|
||||||
// 1, 0 - odczepienie lokomotywy z jednym wagonem
|
// 1, 0 - odczepienie lokomotywy z jednym wagonem
|
||||||
iDrivigFlags &= ~moveStopHere; // podjeżanie do semaforów zezwolone
|
iDrivigFlags &= ~moveStopHere; // podjeżanie do semaforów zezwolone
|
||||||
if (!iEngineActive)
|
if (false == iEngineActive)
|
||||||
OrderNext(Prepare_engine); // trzeba odpalić silnik najpierw
|
OrderNext(Prepare_engine); // trzeba odpalić silnik najpierw
|
||||||
if (NewValue2 != 0) // jeśli podany jest sprzęg
|
if (NewValue2 != 0) // jeśli podany jest sprzęg
|
||||||
{
|
{
|
||||||
@@ -4415,7 +4411,7 @@ TController::UpdateSituation(double dt) {
|
|||||||
if( ( fLastStopExpDist > 0.0 )
|
if( ( fLastStopExpDist > 0.0 )
|
||||||
&& ( mvOccupied->DistCounter > fLastStopExpDist ) ) {
|
&& ( mvOccupied->DistCounter > fLastStopExpDist ) ) {
|
||||||
// zaktualizować wyświetlanie rozkładu
|
// zaktualizować wyświetlanie rozkładu
|
||||||
iStationStart = TrainParams->StationIndex;
|
iStationStart = TrainParams.StationIndex;
|
||||||
fLastStopExpDist = -1.0; // usunąć licznik
|
fLastStopExpDist = -1.0; // usunąć licznik
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4703,7 +4699,7 @@ TController::UpdateSituation(double dt) {
|
|||||||
|
|
||||||
if( ( true == TestFlag( iDrivigFlags, moveStartHornNow ) )
|
if( ( true == TestFlag( iDrivigFlags, moveStartHornNow ) )
|
||||||
&& ( true == Ready )
|
&& ( true == Ready )
|
||||||
&& ( iEngineActive != 0 )
|
&& ( true == iEngineActive )
|
||||||
&& ( mvControlling->MainCtrlPowerPos() > 0 ) ) {
|
&& ( mvControlling->MainCtrlPowerPos() > 0 ) ) {
|
||||||
// uruchomienie trąbienia przed ruszeniem
|
// uruchomienie trąbienia przed ruszeniem
|
||||||
fWarningDuration = 0.3; // czas trąbienia
|
fWarningDuration = 0.3; // czas trąbienia
|
||||||
@@ -5153,7 +5149,7 @@ TController::UpdateSituation(double dt) {
|
|||||||
} // Change_direction (tylko dla AI)
|
} // Change_direction (tylko dla AI)
|
||||||
|
|
||||||
if( ( true == AIControllFlag )
|
if( ( true == AIControllFlag )
|
||||||
&& ( iEngineActive == 0 )
|
&& ( false == iEngineActive )
|
||||||
&& ( OrderCurrentGet() & ( Change_direction | Connect | Disconnect | Shunt | Loose_shunt | Obey_train | Bank ) ) ) {
|
&& ( OrderCurrentGet() & ( Change_direction | Connect | Disconnect | Shunt | Loose_shunt | Obey_train | Bank ) ) ) {
|
||||||
// jeśli coś ma robić to niech odpala do skutku
|
// jeśli coś ma robić to niech odpala do skutku
|
||||||
PrepareEngine();
|
PrepareEngine();
|
||||||
@@ -5170,10 +5166,9 @@ TController::UpdateSituation(double dt) {
|
|||||||
// no chyba żeby to uwzgldnić już w (ActualProximityDist)
|
// no chyba żeby to uwzgldnić już w (ActualProximityDist)
|
||||||
VelDesired = fVelMax; // wstępnie prędkość maksymalna dla pojazdu(-ów), będzie
|
VelDesired = fVelMax; // wstępnie prędkość maksymalna dla pojazdu(-ów), będzie
|
||||||
// następnie ograniczana
|
// następnie ograniczana
|
||||||
if( ( TrainParams )
|
if( TrainParams.TTVmax > 0.0 ) {
|
||||||
&& ( TrainParams->TTVmax > 0.0 ) ) {
|
|
||||||
// jeśli ma rozkład i ograniczenie w rozkładzie to nie przekraczać rozkladowej
|
// jeśli ma rozkład i ograniczenie w rozkładzie to nie przekraczać rozkladowej
|
||||||
VelDesired = min_speed( VelDesired, TrainParams->TTVmax );
|
VelDesired = min_speed( VelDesired, TrainParams.TTVmax );
|
||||||
}
|
}
|
||||||
// szukanie optymalnych wartości
|
// szukanie optymalnych wartości
|
||||||
AccDesired = AccPreferred; // AccPreferred wynika z osobowości mechanika
|
AccDesired = AccPreferred; // AccPreferred wynika z osobowości mechanika
|
||||||
@@ -5537,13 +5532,13 @@ TController::UpdateSituation(double dt) {
|
|||||||
|
|
||||||
if( ( OrderCurrentGet() & Obey_train ) != 0 ) {
|
if( ( OrderCurrentGet() & Obey_train ) != 0 ) {
|
||||||
|
|
||||||
if( ( TrainParams->CheckTrainLatency() < 5.0 )
|
if( ( TrainParams.CheckTrainLatency() < 5.0 )
|
||||||
&& ( TrainParams->TTVmax > 0.0 ) ) {
|
&& ( TrainParams.TTVmax > 0.0 ) ) {
|
||||||
// jesli nie spozniony to nie przekraczać rozkladowej
|
// jesli nie spozniony to nie przekraczać rozkladowej
|
||||||
VelDesired =
|
VelDesired =
|
||||||
min_speed(
|
min_speed(
|
||||||
VelDesired,
|
VelDesired,
|
||||||
TrainParams->TTVmax );
|
TrainParams.TTVmax );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6408,7 +6403,7 @@ void TController::OrdersInit(double fVel)
|
|||||||
// ustawienie kolejności komend, niezależnie kto prowadzi
|
// ustawienie kolejności komend, niezależnie kto prowadzi
|
||||||
OrdersClear(); // usunięcie poprzedniej tabeli
|
OrdersClear(); // usunięcie poprzedniej tabeli
|
||||||
OrderPush(Prepare_engine); // najpierw odpalenie silnika
|
OrderPush(Prepare_engine); // najpierw odpalenie silnika
|
||||||
if (TrainParams->TrainName == "none")
|
if (TrainParams.TrainName == "none")
|
||||||
{ // brak rozkładu to jazda manewrowa
|
{ // brak rozkładu to jazda manewrowa
|
||||||
if (fVel > 0.05) // typowo 0.1 oznacza gotowość do jazdy, 0.01 tylko załączenie silnika
|
if (fVel > 0.05) // typowo 0.1 oznacza gotowość do jazdy, 0.01 tylko załączenie silnika
|
||||||
OrderPush(Shunt); // jeśli nie ma rozkładu, to manewruje
|
OrderPush(Shunt); // jeśli nie ma rozkładu, to manewruje
|
||||||
@@ -6417,23 +6412,21 @@ void TController::OrdersInit(double fVel)
|
|||||||
{ // jeśli z rozkładem, to jedzie na szlak
|
{ // jeśli z rozkładem, to jedzie na szlak
|
||||||
if ((fVel > 0.0) && (fVel < 0.02))
|
if ((fVel > 0.0) && (fVel < 0.02))
|
||||||
OrderPush(Shunt); // dla prędkości 0.01 włączamy jazdę manewrową
|
OrderPush(Shunt); // dla prędkości 0.01 włączamy jazdę manewrową
|
||||||
else if (TrainParams ?
|
else if (TrainParams.DirectionChange() ? // jeśli obrót na pierwszym przystanku
|
||||||
(TrainParams->DirectionChange() ? // jeśli obrót na pierwszym przystanku
|
|
||||||
((iDrivigFlags & movePushPull) ? // SZT również! SN61 zależnie od wagonów...
|
((iDrivigFlags & movePushPull) ? // SZT również! SN61 zależnie od wagonów...
|
||||||
(TrainParams->TimeTable[1].StationName == TrainParams->Relation1) :
|
(TrainParams.TimeTable[1].StationName == TrainParams.Relation1) :
|
||||||
false) :
|
false) :
|
||||||
false) :
|
false)
|
||||||
true)
|
|
||||||
OrderPush(Shunt); // a teraz start będzie w manewrowym, a tryb pociągowy włączy W4
|
OrderPush(Shunt); // a teraz start będzie w manewrowym, a tryb pociągowy włączy W4
|
||||||
else
|
else
|
||||||
// jeśli start z pierwszej stacji i jednocześnie jest na niej zmiana kierunku, to EZT ma mieć Shunt
|
// jeśli start z pierwszej stacji i jednocześnie jest na niej zmiana kierunku, to EZT ma mieć Shunt
|
||||||
OrderPush(Obey_train); // dla starych scenerii start w trybie pociagowym
|
OrderPush(Obey_train); // dla starych scenerii start w trybie pociagowym
|
||||||
if (DebugModeFlag) // normalnie nie ma po co tego wypisywać
|
if (DebugModeFlag) // normalnie nie ma po co tego wypisywać
|
||||||
WriteLog("/* Timetable: " + TrainParams->ShowRelation());
|
WriteLog("/* Timetable: " + TrainParams.ShowRelation());
|
||||||
TMTableLine *t;
|
TMTableLine *t;
|
||||||
for (int i = 0; i <= TrainParams->StationCount; ++i)
|
for (int i = 0; i <= TrainParams.StationCount; ++i)
|
||||||
{
|
{
|
||||||
t = TrainParams->TimeTable + i;
|
t = TrainParams.TimeTable + i;
|
||||||
if (DebugModeFlag) {
|
if (DebugModeFlag) {
|
||||||
// normalnie nie ma po co tego wypisywa?
|
// normalnie nie ma po co tego wypisywa?
|
||||||
WriteLog(
|
WriteLog(
|
||||||
@@ -6453,7 +6446,7 @@ void TController::OrdersInit(double fVel)
|
|||||||
OrderPush(Disconnect); // odczepienie lokomotywy
|
OrderPush(Disconnect); // odczepienie lokomotywy
|
||||||
OrderPush(Shunt); // a dalej manewry
|
OrderPush(Shunt); // a dalej manewry
|
||||||
}
|
}
|
||||||
if (i < TrainParams->StationCount) // jak nie ostatnia stacja
|
if (i < TrainParams.StationCount) // jak nie ostatnia stacja
|
||||||
OrderPush(Obey_train); // to dalej wg rozkładu
|
OrderPush(Obey_train); // to dalej wg rozkładu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6818,10 +6811,8 @@ std::string TController::NextStop() const
|
|||||||
if (asNextStop == "[End of route]")
|
if (asNextStop == "[End of route]")
|
||||||
return ""; // nie zawiera nazwy stacji, gdy dojechał do końca
|
return ""; // nie zawiera nazwy stacji, gdy dojechał do końca
|
||||||
// dodać godzinę odjazdu
|
// dodać godzinę odjazdu
|
||||||
if (!TrainParams)
|
auto nextstop{ Bezogonkow( asNextStop, true ) };
|
||||||
return ""; // tu nie powinno nigdy wejść
|
auto const *t{ TrainParams.TimeTable + TrainParams.StationIndex };
|
||||||
std::string nextstop = Bezogonkow( asNextStop, true );
|
|
||||||
TMTableLine *t = TrainParams->TimeTable + TrainParams->StationIndex;
|
|
||||||
if( t->Ah >= 0 ) {
|
if( t->Ah >= 0 ) {
|
||||||
// przyjazd
|
// przyjazd
|
||||||
nextstop += " przyj." + std::to_string( t->Ah ) + ":"
|
nextstop += " przyj." + std::to_string( t->Ah ) + ":"
|
||||||
@@ -6838,7 +6829,7 @@ std::string TController::NextStop() const
|
|||||||
|
|
||||||
void TController::UpdateDelayFlag() {
|
void TController::UpdateDelayFlag() {
|
||||||
|
|
||||||
if( TrainParams->CheckTrainLatency() < 0.0 ) {
|
if( TrainParams.CheckTrainLatency() < 0.0 ) {
|
||||||
// odnotowano spóźnienie
|
// odnotowano spóźnienie
|
||||||
iDrivigFlags |= moveLate;
|
iDrivigFlags |= moveLate;
|
||||||
}
|
}
|
||||||
@@ -6940,34 +6931,34 @@ void TController::ZeroDirection() {
|
|||||||
while( ( mvOccupied->ActiveDir < 0 ) && ( mvOccupied->DirectionForward() ) ) { ; }
|
while( ( mvOccupied->ActiveDir < 0 ) && ( mvOccupied->DirectionForward() ) ) { ; }
|
||||||
}
|
}
|
||||||
|
|
||||||
Mtable::TTrainParameters const *
|
Mtable::TTrainParameters const &
|
||||||
TController::TrainTimetable() const {
|
TController::TrainTimetable() const {
|
||||||
return TrainParams;
|
return TrainParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TController::Relation() const
|
std::string TController::Relation() const
|
||||||
{ // zwraca relację pociągu
|
{ // zwraca relację pociągu
|
||||||
return TrainParams->ShowRelation();
|
return TrainParams.ShowRelation();
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string TController::TrainName() const
|
std::string TController::TrainName() const
|
||||||
{ // zwraca numer pociągu
|
{ // zwraca numer pociągu
|
||||||
return TrainParams->TrainName;
|
return TrainParams.TrainName;
|
||||||
};
|
};
|
||||||
|
|
||||||
int TController::StationCount() const
|
int TController::StationCount() const
|
||||||
{ // zwraca ilość stacji (miejsc zatrzymania)
|
{ // zwraca ilość stacji (miejsc zatrzymania)
|
||||||
return TrainParams->StationCount;
|
return TrainParams.StationCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
int TController::StationIndex() const
|
int TController::StationIndex() const
|
||||||
{ // zwraca indeks aktualnej stacji (miejsca zatrzymania)
|
{ // zwraca indeks aktualnej stacji (miejsca zatrzymania)
|
||||||
return TrainParams->StationIndex;
|
return TrainParams.StationIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool TController::IsStop() const
|
bool TController::IsStop() const
|
||||||
{ // informuje, czy jest zatrzymanie na najbliższej stacji
|
{ // informuje, czy jest zatrzymanie na najbliższej stacji
|
||||||
return TrainParams->IsStop();
|
return TrainParams.IsStop();
|
||||||
};
|
};
|
||||||
|
|
||||||
// returns most recently calculated distance to potential obstacle ahead
|
// returns most recently calculated distance to potential obstacle ahead
|
||||||
|
|||||||
7
Driver.h
7
Driver.h
@@ -14,6 +14,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#include "MOVER.h"
|
#include "MOVER.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "DynObj.h"
|
#include "DynObj.h"
|
||||||
|
#include "mtable.h"
|
||||||
|
|
||||||
enum TOrders
|
enum TOrders
|
||||||
{ // rozkazy dla AI
|
{ // rozkazy dla AI
|
||||||
@@ -421,7 +422,7 @@ private:
|
|||||||
// methods
|
// methods
|
||||||
public:
|
public:
|
||||||
std::string TrainName() const;
|
std::string TrainName() const;
|
||||||
Mtable::TTrainParameters const * TrainTimetable() const;
|
Mtable::TTrainParameters const & TrainTimetable() const;
|
||||||
private:
|
private:
|
||||||
std::string Relation() const;
|
std::string Relation() const;
|
||||||
int StationIndex() const;
|
int StationIndex() const;
|
||||||
@@ -431,7 +432,7 @@ private:
|
|||||||
// tests whether the train is delayed and sets accordingly a driving flag
|
// tests whether the train is delayed and sets accordingly a driving flag
|
||||||
void UpdateDelayFlag();
|
void UpdateDelayFlag();
|
||||||
// members
|
// members
|
||||||
Mtable::TTrainParameters *TrainParams = nullptr; // rozkład jazdy zawsze jest, nawet jeśli pusty
|
Mtable::TTrainParameters TrainParams; // rozkład jazdy zawsze jest, nawet jeśli pusty
|
||||||
std::string asNextStop; // nazwa następnego punktu zatrzymania wg rozkładu
|
std::string asNextStop; // nazwa następnego punktu zatrzymania wg rozkładu
|
||||||
int iStationStart = 0; // numer pierwszej stacji pokazywanej na podglądzie rozkładu
|
int iStationStart = 0; // numer pierwszej stacji pokazywanej na podglądzie rozkładu
|
||||||
std::string m_lastexchangestop; // HACK: safeguard to prevent multiple load exchanges per station
|
std::string m_lastexchangestop; // HACK: safeguard to prevent multiple load exchanges per station
|
||||||
@@ -456,7 +457,7 @@ private:
|
|||||||
double fMass = 0.0; // całkowita masa do liczenia stycznej składowej grawitacji
|
double fMass = 0.0; // całkowita masa do liczenia stycznej składowej grawitacji
|
||||||
double fAccGravity = 0.0; // przyspieszenie składowej stycznej grawitacji
|
double fAccGravity = 0.0; // przyspieszenie składowej stycznej grawitacji
|
||||||
int iVehicles = 0; // ilość pojazdów w składzie
|
int iVehicles = 0; // ilość pojazdów w składzie
|
||||||
int iEngineActive = 0; // ABu: Czy silnik byl juz zalaczony; Ra: postęp w załączaniu
|
bool iEngineActive{ false }; // ABu: Czy silnik byl juz zalaczony
|
||||||
bool IsCargoTrain{ false };
|
bool IsCargoTrain{ false };
|
||||||
bool IsHeavyCargoTrain{ false };
|
bool IsHeavyCargoTrain{ false };
|
||||||
bool IsLineBreakerClosed{ false }; // state of line breaker in all powered vehicles under control
|
bool IsLineBreakerClosed{ false }; // state of line breaker in all powered vehicles under control
|
||||||
|
|||||||
16
DynObj.cpp
16
DynObj.cpp
@@ -3328,8 +3328,7 @@ bool TDynamicObject::Update(double dt, double dt1)
|
|||||||
if (dWheelAngle[2] > 360.0)
|
if (dWheelAngle[2] > 360.0)
|
||||||
dWheelAngle[2] -= 360.0;
|
dWheelAngle[2] -= 360.0;
|
||||||
}
|
}
|
||||||
if (pants) // pantograf może być w wagonie kuchennym albo pojeździe rewizyjnym
|
if (pants) // pantograf może być w wagonie kuchennym albo pojeździe rewizyjnym (np. SR61)
|
||||||
// (np. SR61)
|
|
||||||
{ // przeliczanie kątów dla pantografów
|
{ // przeliczanie kątów dla pantografów
|
||||||
double k; // tymczasowy kąt
|
double k; // tymczasowy kąt
|
||||||
double PantDiff;
|
double PantDiff;
|
||||||
@@ -3341,17 +3340,12 @@ bool TDynamicObject::Update(double dt, double dt1)
|
|||||||
+ MoverParameters->TotalCurrent; // prąd pobierany przez pojazd - bez
|
+ MoverParameters->TotalCurrent; // prąd pobierany przez pojazd - bez
|
||||||
// sensu z tym (TotalCurrent)
|
// sensu z tym (TotalCurrent)
|
||||||
// TotalCurrent to bedzie prad nietrakcyjny (niezwiazany z napedem)
|
// TotalCurrent to bedzie prad nietrakcyjny (niezwiazany z napedem)
|
||||||
// fCurrent+=fabs(MoverParameters->Voltage)*1e-6; //prąd płynący przez
|
// fCurrent+=fabs(MoverParameters->Voltage)*1e-6; //prąd płynący przez woltomierz, rozładowuje kondensator orgromowy 4µF
|
||||||
// woltomierz,
|
|
||||||
// rozładowuje kondensator orgromowy 4µF
|
|
||||||
double fPantCurrent = fCurrent; // normalnie cały prąd przez jeden pantograf
|
double fPantCurrent = fCurrent; // normalnie cały prąd przez jeden pantograf
|
||||||
if (pants)
|
if (iAnimType[ANIM_PANTS] > 1) // a jeśli są dwa pantografy //Ra 1014-11: proteza, trzeba zrobić sensowniej
|
||||||
if (iAnimType[ANIM_PANTS] > 1) // a jeśli są dwa pantografy //Ra 1014-11:
|
|
||||||
// proteza, trzeba zrobić sensowniej
|
|
||||||
if (pants[0].fParamPants->hvPowerWire &&
|
if (pants[0].fParamPants->hvPowerWire &&
|
||||||
pants[1].fParamPants->hvPowerWire) // i oba podłączone do drutów
|
pants[1].fParamPants->hvPowerWire) // i oba podłączone do drutów
|
||||||
fPantCurrent = fCurrent * 0.5; // to dzielimy prąd równo na oba (trochę bez
|
fPantCurrent = fCurrent * 0.5; // to dzielimy prąd równo na oba (trochę bez sensu, ale lepiej tak niż podwoić prąd)
|
||||||
// sensu, ale lepiej tak niż podwoić prąd)
|
|
||||||
for (int i = 0; i < iAnimType[ANIM_PANTS]; ++i)
|
for (int i = 0; i < iAnimType[ANIM_PANTS]; ++i)
|
||||||
{ // pętla po wszystkich pantografach
|
{ // pętla po wszystkich pantografach
|
||||||
p = pants[i].fParamPants;
|
p = pants[i].fParamPants;
|
||||||
@@ -6436,7 +6430,7 @@ TDynamicObject::update_shake( double const Timedelta ) {
|
|||||||
// ABu: rzucamy kabina tylko przy duzym FPS!
|
// ABu: rzucamy kabina tylko przy duzym FPS!
|
||||||
// Mala histereza, zeby bez przerwy nie przelaczalo przy FPS~17
|
// Mala histereza, zeby bez przerwy nie przelaczalo przy FPS~17
|
||||||
// Granice mozna ustalic doswiadczalnie. Ja proponuje 14:20
|
// Granice mozna ustalic doswiadczalnie. Ja proponuje 14:20
|
||||||
if( false == Global.iSlowMotion ) { // musi być pełna prędkość
|
if( Global.iSlowMotion == 0 ) { // musi być pełna prędkość
|
||||||
|
|
||||||
Math3D::vector3 shakevector;
|
Math3D::vector3 shakevector;
|
||||||
if( ( MoverParameters->EngineType == TEngineType::DieselElectric )
|
if( ( MoverParameters->EngineType == TEngineType::DieselElectric )
|
||||||
|
|||||||
@@ -8416,10 +8416,11 @@ bool TMoverParameters::readCompressorList(std::string const &Input) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int idx = LISTLINE++;
|
int idx = LISTLINE++;
|
||||||
if (idx > 8) {
|
if (idx > 8 - 1) {
|
||||||
WriteLog("Read CompressorList: number of entries exceeded capacity of the data table");
|
WriteLog("Read CompressorList: number of entries exceeded capacity of the data table");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// NOTE: content of slot [x][0] is hardcoded elsewhere
|
||||||
parser
|
parser
|
||||||
>> CompressorList[ 0 ][ idx + 1 ]
|
>> CompressorList[ 0 ][ idx + 1 ]
|
||||||
>> CompressorList[ 1 ][ idx + 1 ]
|
>> CompressorList[ 1 ][ idx + 1 ]
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ static double const BPT_394[7][2] = { {13 , 10.0} , {5 , 5.0} , {0 , -1} , {5 ,
|
|||||||
//double *BPT_394 = zero_based_BPT_394[1]; //tablica pozycji hamulca dla zakresu -1..5
|
//double *BPT_394 = zero_based_BPT_394[1]; //tablica pozycji hamulca dla zakresu -1..5
|
||||||
// BPT: array[-2..6] of array [0..1] of real= ((0, 5.0), (12, 5.4), (9, 5.0), (9, 4.6), (9, 4.2), (9, 3.8), (9, 3.4), (9, 2.8), (34, 2.8));
|
// BPT: array[-2..6] of array [0..1] of real= ((0, 5.0), (12, 5.4), (9, 5.0), (9, 4.6), (9, 4.2), (9, 3.8), (9, 3.4), (9, 2.8), (34, 2.8));
|
||||||
// BPT: array[-2..6] of array [0..1] of real= ((0, 0),(0, 0),(0, 0),(0, 0),(0, 0),(0, 0),(0, 0),(0, 0),(0, 0));
|
// BPT: array[-2..6] of array [0..1] of real= ((0, 0),(0, 0),(0, 0),(0, 0),(0, 0),(0, 0),(0, 0),(0, 0),(0, 0));
|
||||||
static int const i_bcpno = 6;
|
static int const i_bcpno = 5;
|
||||||
// static double const pi = 3.141592653589793; //definicja w mctools
|
// static double const pi = 3.141592653589793; //definicja w mctools
|
||||||
|
|
||||||
enum TUniversalBrake // możliwe działania uniwersalnego przycisku hamulca
|
enum TUniversalBrake // możliwe działania uniwersalnego przycisku hamulca
|
||||||
|
|||||||
@@ -603,7 +603,7 @@ dictionary_source *TTrain::GetTrainState() {
|
|||||||
dict->insert( "velnext", driver->VelNext );
|
dict->insert( "velnext", driver->VelNext );
|
||||||
dict->insert( "actualproximitydist", driver->ActualProximityDist );
|
dict->insert( "actualproximitydist", driver->ActualProximityDist );
|
||||||
// train data
|
// train data
|
||||||
driver->TrainTimetable()->serialize( dict );
|
driver->TrainTimetable().serialize( dict );
|
||||||
dict->insert( "train_stationstart", driver->iStationStart );
|
dict->insert( "train_stationstart", driver->iStationStart );
|
||||||
dict->insert( "train_atpassengerstop", driver->IsAtPassengerStop );
|
dict->insert( "train_atpassengerstop", driver->IsAtPassengerStop );
|
||||||
dict->insert( "train_length", driver->fLength );
|
dict->insert( "train_length", driver->fLength );
|
||||||
|
|||||||
4
Train.h
4
Train.h
@@ -22,8 +22,6 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
|
|
||||||
// typedef enum {st_Off, st_Starting, st_On, st_ShuttingDown} T4State;
|
// typedef enum {st_Off, st_Starting, st_On, st_ShuttingDown} T4State;
|
||||||
|
|
||||||
const int maxcab = 2;
|
|
||||||
|
|
||||||
const double fCzuwakBlink = 0.15;
|
const double fCzuwakBlink = 0.15;
|
||||||
const float fConverterPrzekaznik = 1.5f; // hunter-261211: do przekaznika nadmiarowego przetwornicy
|
const float fConverterPrzekaznik = 1.5f; // hunter-261211: do przekaznika nadmiarowego przetwornicy
|
||||||
// 0.33f
|
// 0.33f
|
||||||
@@ -685,7 +683,7 @@ public: // reszta może by?publiczna
|
|||||||
bool bCabLightDim; // hunter-091012: czy przyciemnienie kabiny jest zapalone?
|
bool bCabLightDim; // hunter-091012: czy przyciemnienie kabiny jest zapalone?
|
||||||
*/
|
*/
|
||||||
// McZapkie: opis kabiny - obszar poruszania sie mechanika oraz zajetosc
|
// McZapkie: opis kabiny - obszar poruszania sie mechanika oraz zajetosc
|
||||||
std::array<TCab, maxcab + 1> Cabine; // przedzial maszynowy, kabina 1 (A), kabina 2 (B)
|
std::array<TCab, 3> Cabine; // przedzial maszynowy, kabina 1 (A), kabina 2 (B)
|
||||||
int iCabn { 0 }; // 0: mid, 1: front, 2: rear
|
int iCabn { 0 }; // 0: mid, 1: front, 2: rear
|
||||||
// McZapkie: do poruszania sie po kabinie
|
// McZapkie: do poruszania sie po kabinie
|
||||||
Math3D::vector3 pMechSittingPosition; // ABu 180404
|
Math3D::vector3 pMechSittingPosition; // ABu 180404
|
||||||
|
|||||||
@@ -41,13 +41,8 @@ dictionary_source::dictionary_source( std::string const &Input ) {
|
|||||||
vehicle == nullptr ? nullptr :
|
vehicle == nullptr ? nullptr :
|
||||||
vehicle->ctOwner == nullptr ? vehicle->Mechanik :
|
vehicle->ctOwner == nullptr ? vehicle->Mechanik :
|
||||||
vehicle->ctOwner ) };
|
vehicle->ctOwner ) };
|
||||||
auto const *timetable { (
|
if( controller != nullptr ) {
|
||||||
controller != nullptr ?
|
controller->TrainTimetable().serialize( this );
|
||||||
controller->TrainTimetable() :
|
|
||||||
nullptr ) };
|
|
||||||
|
|
||||||
if( timetable != nullptr ) {
|
|
||||||
timetable->serialize( this );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -653,7 +653,7 @@ driver_mode::OnKeyDown(int cKey) {
|
|||||||
int i = cKey - GLFW_KEY_0; // numer klawisza
|
int i = cKey - GLFW_KEY_0; // numer klawisza
|
||||||
if (Global.shiftState) {
|
if (Global.shiftState) {
|
||||||
// z [Shift] uruchomienie eventu
|
// z [Shift] uruchomienie eventu
|
||||||
if( ( false == Global.iPause ) // podczas pauzy klawisze nie działają
|
if( ( Global.iPause == 0 ) // podczas pauzy klawisze nie działają
|
||||||
&& ( KeyEvents[ i ] != nullptr ) ) {
|
&& ( KeyEvents[ i ] != nullptr ) ) {
|
||||||
simulation::Events.AddToQuery( KeyEvents[ i ], NULL );
|
simulation::Events.AddToQuery( KeyEvents[ i ], NULL );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -268,8 +268,7 @@ timetable_panel::update() {
|
|||||||
vehicle->ctOwner );
|
vehicle->ctOwner );
|
||||||
if( owner == nullptr ) { return; }
|
if( owner == nullptr ) { return; }
|
||||||
|
|
||||||
auto const *table = owner->TrainTimetable();
|
auto const &table = owner->TrainTimetable();
|
||||||
if( table == nullptr ) { return; }
|
|
||||||
|
|
||||||
// destination
|
// destination
|
||||||
{
|
{
|
||||||
@@ -310,14 +309,14 @@ timetable_panel::update() {
|
|||||||
std::snprintf(
|
std::snprintf(
|
||||||
m_buffer.data(), m_buffer.size(),
|
m_buffer.data(), m_buffer.size(),
|
||||||
locale::strings[ locale::string::driver_timetable_consistdata ].c_str(),
|
locale::strings[ locale::string::driver_timetable_consistdata ].c_str(),
|
||||||
static_cast<int>( table->LocLoad ),
|
static_cast<int>( table.LocLoad ),
|
||||||
static_cast<int>( consistmass / 1000 ),
|
static_cast<int>( consistmass / 1000 ),
|
||||||
static_cast<int>( consistlength ) );
|
static_cast<int>( consistlength ) );
|
||||||
|
|
||||||
text_lines.emplace_back( m_buffer.data(), Global.UITextColor );
|
text_lines.emplace_back( m_buffer.data(), Global.UITextColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( 0 == table->StationCount ) {
|
if( 0 == table.StationCount ) {
|
||||||
// only bother if there's stations to list
|
// only bother if there's stations to list
|
||||||
text_lines.emplace_back( locale::strings[ locale::string::driver_timetable_notimetable ], Global.UITextColor );
|
text_lines.emplace_back( locale::strings[ locale::string::driver_timetable_notimetable ], Global.UITextColor );
|
||||||
}
|
}
|
||||||
@@ -331,9 +330,9 @@ timetable_panel::update() {
|
|||||||
m_tablelines.emplace_back( u8"┌─────┬────────────────────────────────────┬─────────┬─────┐", Global.UITextColor );
|
m_tablelines.emplace_back( u8"┌─────┬────────────────────────────────────┬─────────┬─────┐", Global.UITextColor );
|
||||||
|
|
||||||
TMTableLine const *tableline;
|
TMTableLine const *tableline;
|
||||||
for( int i = owner->iStationStart; i <= table->StationCount; ++i ) {
|
for( int i = owner->iStationStart; i <= table.StationCount; ++i ) {
|
||||||
// wyświetlenie pozycji z rozkładu
|
// wyświetlenie pozycji z rozkładu
|
||||||
tableline = table->TimeTable + i; // linijka rozkładu
|
tableline = table.TimeTable + i; // linijka rozkładu
|
||||||
|
|
||||||
bool vmaxchange { true };
|
bool vmaxchange { true };
|
||||||
if( i > owner->iStationStart ) {
|
if( i > owner->iStationStart ) {
|
||||||
@@ -366,16 +365,16 @@ timetable_panel::update() {
|
|||||||
to_string( int( 100 + tableline->Dh ) ).substr( 1, 2 ) + ":" + to_minutes_str( tableline->Dm, true, 3 ) :
|
to_string( int( 100 + tableline->Dh ) ).substr( 1, 2 ) + ":" + to_minutes_str( tableline->Dm, true, 3 ) :
|
||||||
u8" │ " ) };
|
u8" │ " ) };
|
||||||
auto const candeparture { (
|
auto const candeparture { (
|
||||||
( owner->iStationStart < table->StationIndex )
|
( owner->iStationStart < table.StationIndex )
|
||||||
&& ( i < table->StationIndex )
|
&& ( i < table.StationIndex )
|
||||||
&& ( ( tableline->Ah < 0 ) // pass-through, always valid
|
&& ( ( tableline->Ah < 0 ) // pass-through, always valid
|
||||||
|| ( time.wHour * 60 + time.wMinute + time.wSecond * 0.0167 >= tableline->Dh * 60 + tableline->Dm ) ) ) };
|
|| ( time.wHour * 60 + time.wMinute + time.wSecond * 0.0167 >= tableline->Dh * 60 + tableline->Dm ) ) ) };
|
||||||
auto const loadchangeinprogress { ( ( static_cast<int>( std::ceil( -1.0 * owner->fStopTime ) ) ) > 0 ) };
|
auto const loadchangeinprogress { ( ( static_cast<int>( std::ceil( -1.0 * owner->fStopTime ) ) ) > 0 ) };
|
||||||
auto const isatpassengerstop { ( true == owner->IsAtPassengerStop ) && ( vehicle->MoverParameters->Vel < 1.0 ) };
|
auto const isatpassengerstop { ( true == owner->IsAtPassengerStop ) && ( vehicle->MoverParameters->Vel < 1.0 ) };
|
||||||
auto const traveltime { (
|
auto const traveltime { (
|
||||||
i < 2 ? " " :
|
i < 2 ? " " :
|
||||||
tableline->Ah >= 0 ? to_minutes_str( CompareTime( table->TimeTable[ i - 1 ].Dh, table->TimeTable[ i - 1 ].Dm, tableline->Ah, tableline->Am ), false, 3 ) :
|
tableline->Ah >= 0 ? to_minutes_str( CompareTime( table.TimeTable[ i - 1 ].Dh, table.TimeTable[ i - 1 ].Dm, tableline->Ah, tableline->Am ), false, 3 ) :
|
||||||
to_minutes_str( std::max( 0.0, CompareTime( table->TimeTable[ i - 1 ].Dh, table->TimeTable[ i - 1 ].Dm, tableline->Dh, tableline->Dm ) - 0.5 ), false, 3 ) ) };
|
to_minutes_str( std::max( 0.0, CompareTime( table.TimeTable[ i - 1 ].Dh, table.TimeTable[ i - 1 ].Dm, tableline->Dh, tableline->Dm ) - 0.5 ), false, 3 ) ) };
|
||||||
auto const linecolor { (
|
auto const linecolor { (
|
||||||
( i != owner->iStationStart ) ? Global.UITextColor :
|
( i != owner->iStationStart ) ? Global.UITextColor :
|
||||||
loadchangeinprogress ? loadingcolor :
|
loadchangeinprogress ? loadingcolor :
|
||||||
@@ -390,7 +389,7 @@ timetable_panel::update() {
|
|||||||
( u8"│ │ " + location + tableline->StationWare + trackcount + departure + u8" │ │" ),
|
( u8"│ │ " + location + tableline->StationWare + trackcount + departure + u8" │ │" ),
|
||||||
linecolor );
|
linecolor );
|
||||||
// divider/footer
|
// divider/footer
|
||||||
if( i < table->StationCount ) {
|
if( i < table.StationCount ) {
|
||||||
auto const *nexttableline { tableline + 1 };
|
auto const *nexttableline { tableline + 1 };
|
||||||
std::string const vmaxnext{ ( tableline->vmax == nexttableline->vmax ? u8"│ ├" : u8"├─────┼" ) };
|
std::string const vmaxnext{ ( tableline->vmax == nexttableline->vmax ? u8"│ ├" : u8"├─────┼" ) };
|
||||||
auto const trackcountnext{ ( nexttableline->TrackNo == 1 ? u8"╂" : u8"╫" ) };
|
auto const trackcountnext{ ( nexttableline->TrackNo == 1 ? u8"╂" : u8"╫" ) };
|
||||||
|
|||||||
2
mtable.h
2
mtable.h
@@ -77,7 +77,7 @@ class TTrainParameters
|
|||||||
bool UpdateMTable(double hh, double mm, std::string const &NewName);
|
bool UpdateMTable(double hh, double mm, std::string const &NewName);
|
||||||
bool UpdateMTable( scenario_time const &Time, std::string const &NewName );
|
bool UpdateMTable( scenario_time const &Time, std::string const &NewName );
|
||||||
bool RewindTimeTable( std::string actualStationName );
|
bool RewindTimeTable( std::string actualStationName );
|
||||||
TTrainParameters( std::string const &NewTrainName );
|
TTrainParameters( std::string const &NewTrainName = "none" );
|
||||||
void NewName(std::string const &NewTrainName);
|
void NewName(std::string const &NewTrainName);
|
||||||
void UpdateVelocity(int StationCount, double vActual);
|
void UpdateVelocity(int StationCount, double vActual);
|
||||||
bool LoadTTfile(std::string scnpath, int iPlus, double vmax);
|
bool LoadTTfile(std::string scnpath, int iPlus, double vmax);
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ void
|
|||||||
opengl_vbogeometrybank::bind_streams( gfx::stream_units const &Units, unsigned int const Streams ) {
|
opengl_vbogeometrybank::bind_streams( gfx::stream_units const &Units, unsigned int const Streams ) {
|
||||||
|
|
||||||
if( Streams & gfx::stream::position ) {
|
if( Streams & gfx::stream::position ) {
|
||||||
::glVertexPointer( 3, GL_FLOAT, sizeof( gfx::basic_vertex ), static_cast<char *>( nullptr ) );
|
::glVertexPointer( 3, GL_FLOAT, sizeof( gfx::basic_vertex ), reinterpret_cast<void const *>( 0 ) );
|
||||||
::glEnableClientState( GL_VERTEX_ARRAY );
|
::glEnableClientState( GL_VERTEX_ARRAY );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -162,14 +162,14 @@ opengl_vbogeometrybank::bind_streams( gfx::stream_units const &Units, unsigned i
|
|||||||
}
|
}
|
||||||
// NOTE: normal and color streams share the data, making them effectively mutually exclusive
|
// NOTE: normal and color streams share the data, making them effectively mutually exclusive
|
||||||
if( Streams & gfx::stream::normal ) {
|
if( Streams & gfx::stream::normal ) {
|
||||||
::glNormalPointer( GL_FLOAT, sizeof( gfx::basic_vertex ), static_cast<char *>( nullptr ) + sizeof( float ) * 3 );
|
::glNormalPointer( GL_FLOAT, sizeof( gfx::basic_vertex ), reinterpret_cast<void const *>( sizeof( float ) * 3 ) );
|
||||||
::glEnableClientState( GL_NORMAL_ARRAY );
|
::glEnableClientState( GL_NORMAL_ARRAY );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
::glDisableClientState( GL_NORMAL_ARRAY );
|
::glDisableClientState( GL_NORMAL_ARRAY );
|
||||||
}
|
}
|
||||||
if( Streams & gfx::stream::color ) {
|
if( Streams & gfx::stream::color ) {
|
||||||
::glColorPointer( 3, GL_FLOAT, sizeof( gfx::basic_vertex ), static_cast<char *>( nullptr ) + sizeof( float ) * 3 );
|
::glColorPointer( 3, GL_FLOAT, sizeof( gfx::basic_vertex ), reinterpret_cast<void const *>( sizeof( float ) * 3 ) );
|
||||||
::glEnableClientState( GL_COLOR_ARRAY );
|
::glEnableClientState( GL_COLOR_ARRAY );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -178,7 +178,7 @@ opengl_vbogeometrybank::bind_streams( gfx::stream_units const &Units, unsigned i
|
|||||||
if( Streams & gfx::stream::texture ) {
|
if( Streams & gfx::stream::texture ) {
|
||||||
for( auto unit : Units.texture ) {
|
for( auto unit : Units.texture ) {
|
||||||
::glClientActiveTexture( unit );
|
::glClientActiveTexture( unit );
|
||||||
::glTexCoordPointer( 2, GL_FLOAT, sizeof( gfx::basic_vertex ), static_cast<char *>( nullptr ) + 24 );
|
::glTexCoordPointer( 2, GL_FLOAT, sizeof( gfx::basic_vertex ), reinterpret_cast<void const *>( 24 ) );
|
||||||
::glEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
::glEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||||
}
|
}
|
||||||
m_activetexturearrays = Units.texture;
|
m_activetexturearrays = Units.texture;
|
||||||
|
|||||||
@@ -141,10 +141,10 @@ opengl_particles::render( int const Textureunit ) {
|
|||||||
::glBindBuffer( GL_ARRAY_BUFFER, m_buffer );
|
::glBindBuffer( GL_ARRAY_BUFFER, m_buffer );
|
||||||
::glVertexPointer( 3, GL_FLOAT, sizeof( particle_vertex ), static_cast<char *>( nullptr ) );
|
::glVertexPointer( 3, GL_FLOAT, sizeof( particle_vertex ), static_cast<char *>( nullptr ) );
|
||||||
::glEnableClientState( GL_VERTEX_ARRAY );
|
::glEnableClientState( GL_VERTEX_ARRAY );
|
||||||
::glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof( particle_vertex ), static_cast<char *>( nullptr ) + sizeof( float ) * 3 );
|
::glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof( particle_vertex ), reinterpret_cast<void const *>( sizeof( float ) * 3 ) );
|
||||||
::glEnableClientState( GL_COLOR_ARRAY );
|
::glEnableClientState( GL_COLOR_ARRAY );
|
||||||
::glClientActiveTexture( Textureunit );
|
::glClientActiveTexture( Textureunit );
|
||||||
::glTexCoordPointer( 2, GL_FLOAT, sizeof( particle_vertex ), static_cast<char *>( nullptr ) + sizeof( float ) * 3 + sizeof( std::uint8_t ) * 4 );
|
::glTexCoordPointer( 2, GL_FLOAT, sizeof( particle_vertex ), reinterpret_cast<void const *>( sizeof( float ) * 3 + sizeof( std::uint8_t ) * 4 ) );
|
||||||
::glEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
::glEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||||
// ...draw...
|
// ...draw...
|
||||||
::glDrawArrays( GL_QUADS, 0, m_particlevertices.size() );
|
::glDrawArrays( GL_QUADS, 0, m_particlevertices.size() );
|
||||||
|
|||||||
@@ -346,10 +346,10 @@ opengl_renderer::Render() {
|
|||||||
Timer::subsystem.gfx_swap.stop();
|
Timer::subsystem.gfx_swap.stop();
|
||||||
|
|
||||||
m_drawcount = m_cellqueue.size();
|
m_drawcount = m_cellqueue.size();
|
||||||
m_debugtimestext
|
m_debugtimestext +=
|
||||||
+= "color: " + to_string( Timer::subsystem.gfx_color.average(), 2 ) + " msec (" + std::to_string( m_cellqueue.size() ) + " sectors)\n"
|
"color: " + to_string( Timer::subsystem.gfx_color.average(), 2 ) + " msec (" + std::to_string( m_cellqueue.size() ) + " sectors)\n"
|
||||||
+= "gpu side: " + to_string( Timer::subsystem.gfx_swap.average(), 2 ) + " msec\n"
|
+ "gpu side: " + to_string( Timer::subsystem.gfx_swap.average(), 2 ) + " msec\n"
|
||||||
+= "frame total: " + to_string( Timer::subsystem.gfx_color.average() + Timer::subsystem.gfx_swap.average(), 2 ) + " msec";
|
+ "frame total: " + to_string( Timer::subsystem.gfx_color.average() + Timer::subsystem.gfx_swap.average(), 2 ) + " msec";
|
||||||
|
|
||||||
m_debugstatstext =
|
m_debugstatstext =
|
||||||
"drawcalls: " + to_string( m_debugstats.drawcalls ) + "\n"
|
"drawcalls: " + to_string( m_debugstats.drawcalls ) + "\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user