mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 18:39:18 +02:00
maintenance: fixes for some of cppcheck warnings
This commit is contained in:
145
Driver.cpp
145
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
|
||||
// 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() ) ) {
|
||||
asNextStop = TrainParams->NextStop();
|
||||
iStationStart = TrainParams->StationIndex;
|
||||
if( true == TrainParams.RewindTimeTable( sSpeedTable[ i ].evEvent->input_text() ) ) {
|
||||
asNextStop = TrainParams.NextStop();
|
||||
iStationStart = TrainParams.StationIndex;
|
||||
}
|
||||
}
|
||||
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
|
||||
{ // tylko gdy nazwa zatrzymania się zgadza
|
||||
if (!TrainParams->IsStop())
|
||||
if (false == TrainParams.IsStop())
|
||||
{ // jeśli nie ma tu postoju
|
||||
sSpeedTable[i].fVelNext = -1; // maksymalna prędkość w tym miejscu
|
||||
// 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)
|
||||
#if LOGSTOPS
|
||||
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)
|
||||
+ " passed " + asNextStop); // informacja
|
||||
#endif
|
||||
// przy jakim dystansie (stanie licznika) ma przesunąć na następny postój
|
||||
fLastStopExpDist = mvOccupied->DistCounter + 0.250 + 0.001 * fLength;
|
||||
TrainParams->UpdateMTable( simulation::Time, asNextStop );
|
||||
TrainParams.UpdateMTable( simulation::Time, asNextStop );
|
||||
UpdateDelayFlag();
|
||||
TrainParams->StationIndexInc(); // przejście do następnej
|
||||
asNextStop = TrainParams->NextStop(); // pobranie kolejnego miejsca zatrzymania
|
||||
TrainParams.StationIndexInc(); // przejście do następnej
|
||||
asNextStop = TrainParams.NextStop(); // pobranie kolejnego miejsca zatrzymania
|
||||
sSpeedTable[i].iFlags = 0; // nie liczy się już
|
||||
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 );
|
||||
}
|
||||
|
||||
if (TrainParams->UpdateMTable( simulation::Time, asNextStop) ) {
|
||||
if (TrainParams.UpdateMTable( simulation::Time, asNextStop) ) {
|
||||
// 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
|
||||
// also ignore any horn cue that may be potentially set below 1 km/h and before the actual full stop
|
||||
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
|
||||
if( m_lastexchangestop != asNextStop ) {
|
||||
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 );
|
||||
m_lastexchangestop = asNextStop;
|
||||
}
|
||||
|
||||
if (TrainParams->DirectionChange()) {
|
||||
if (TrainParams.DirectionChange()) {
|
||||
// jeśli "@" w rozkładzie, to wykonanie dalszych komend
|
||||
// wykonanie kolejnej komendy, nie dotyczy ostatniej stacji
|
||||
if (iDrivigFlags & movePushPull) {
|
||||
@@ -999,7 +999,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
if (OrderNextGet() != Change_direction) {
|
||||
OrderPush(Change_direction); // zmiana kierunku
|
||||
OrderPush(
|
||||
TrainParams->StationIndex < TrainParams->StationCount ?
|
||||
TrainParams.StationIndex < TrainParams.StationCount ?
|
||||
Obey_train :
|
||||
Shunt); // to dalej wg rozkładu
|
||||
}
|
||||
@@ -1027,18 +1027,18 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
CheckVehicles(); // zmienić światła
|
||||
}
|
||||
|
||||
if (TrainParams->StationIndex < TrainParams->StationCount) {
|
||||
if (TrainParams.StationIndex < TrainParams.StationCount) {
|
||||
// jeśli są dalsze stacje, czekamy do godziny odjazdu
|
||||
if (TrainParams->IsTimeToGo(simulation::Time.data().wHour, simulation::Time.data().wMinute + 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
|
||||
IsAtPassengerStop = false;
|
||||
// przy jakim dystansie (stanie licznika) ma przesunąć na następny postój
|
||||
fLastStopExpDist = mvOccupied->DistCounter + 0.050 + 0.001 * fLength;
|
||||
TrainParams->StationIndexInc(); // przejście do następnej
|
||||
asNextStop = TrainParams->NextStop(); // pobranie kolejnego miejsca zatrzymania
|
||||
TrainParams.StationIndexInc(); // przejście do następnej
|
||||
asNextStop = TrainParams.NextStop(); // pobranie kolejnego miejsca zatrzymania
|
||||
#if LOGSTOPS
|
||||
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)
|
||||
+ " next " + asNextStop); // informacja
|
||||
#endif
|
||||
@@ -1074,12 +1074,12 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
||||
// jeśli dojechaliśmy do końca rozkładu
|
||||
#if LOGSTOPS
|
||||
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)
|
||||
+ " end of route."); // informacja
|
||||
#endif
|
||||
asNextStop = TrainParams->NextStop(); // informacja o końcu trasy
|
||||
TrainParams->NewName("none"); // czyszczenie nieaktualnego rozkładu
|
||||
asNextStop = TrainParams.NextStop(); // informacja o końcu trasy
|
||||
TrainParams.NewName("none"); // czyszczenie nieaktualnego rozkładu
|
||||
// ma nie podjeżdżać pod W4 i ma je pomijać
|
||||
iDrivigFlags &= ~( moveStopCloser );
|
||||
if( false == TestFlag( iDrivigFlags, movePushPull ) ) {
|
||||
@@ -1644,9 +1644,9 @@ TController::TController(bool AI, TDynamicObject *NewControll, bool InitPsyche,
|
||||
}
|
||||
// TrainParams=NewTrainParams;
|
||||
// if (TrainParams)
|
||||
// asNextStop=TrainParams->NextStop();
|
||||
// asNextStop=TrainParams.NextStop();
|
||||
// else
|
||||
TrainParams = new TTrainParameters("none"); // rozkład jazdy
|
||||
TrainParams = TTrainParameters("none"); // rozkład jazdy
|
||||
// OrderCommand="";
|
||||
// OrderValue=0;
|
||||
OrdersClear();
|
||||
@@ -1694,7 +1694,6 @@ void TController::CloseLog()
|
||||
|
||||
TController::~TController()
|
||||
{ // wykopanie mechanika z roboty
|
||||
delete TrainParams;
|
||||
CloseLog();
|
||||
};
|
||||
|
||||
@@ -2160,7 +2159,7 @@ bool TController::CheckVehicles(TOrders user)
|
||||
}
|
||||
|
||||
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
|
||||
p->RaLightsSet(0, 0); // gasimy światła
|
||||
if (p->MoverParameters->EnginePowerSource.SourceType == TPowerSource::CurrentCollector)
|
||||
@@ -2601,13 +2600,13 @@ bool TController::PrepareEngine()
|
||||
eStopReason = stopNone;
|
||||
}
|
||||
eAction = TAction::actUnknown;
|
||||
iEngineActive = 1;
|
||||
iEngineActive = true;
|
||||
iDrivigFlags |= moveActive; // może skanować sygnały i reagować na komendy
|
||||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
iEngineActive = 0;
|
||||
iEngineActive = false;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -2703,7 +2702,7 @@ bool TController::ReleaseEngine() {
|
||||
|
||||
if (OK) {
|
||||
// jeśli się zatrzymał
|
||||
iEngineActive = 0;
|
||||
iEngineActive = false;
|
||||
eStopReason = stopSleep; // stoimy z powodu wyłączenia
|
||||
eAction = TAction::actSleep; //śpi (wygaszony)
|
||||
|
||||
@@ -3934,22 +3933,19 @@ bool TController::PutCommand( std::string NewCommand, double NewValue1, double N
|
||||
#if LOGSTOPS
|
||||
WriteLog("New timetable for " + pVehicle->asName + ": " + NewCommand); // informacja
|
||||
#endif
|
||||
if (!TrainParams)
|
||||
TrainParams = new TTrainParameters(NewCommand); // rozkład jazdy
|
||||
else
|
||||
TrainParams->NewName(NewCommand); // czyści tabelkę przystanków
|
||||
TrainParams = TTrainParameters(NewCommand); // rozkład jazdy
|
||||
tsGuardSignal = sound_source { sound_placement::internal, 2 * EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // wywalenie kierownika
|
||||
m_lastexchangestop.clear();
|
||||
if (NewCommand != "none")
|
||||
{
|
||||
if (!TrainParams->LoadTTfile(
|
||||
if (false == TrainParams.LoadTTfile(
|
||||
std::string(Global.asCurrentSceneryPath.c_str()), floor(NewValue2 + 0.5),
|
||||
NewValue1)) // pierwszy parametr to przesunięcie rozkładu w czasie
|
||||
{
|
||||
if (ConversionError == -8)
|
||||
ErrorLog("Missed timetable: " + NewCommand);
|
||||
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
|
||||
}
|
||||
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
|
||||
iDrivigFlags &= ~( moveDoorOpened );
|
||||
|
||||
TrainParams->UpdateMTable( simulation::Time, TrainParams->NextStationName );
|
||||
TrainParams->StationIndexInc(); // przejście do następnej
|
||||
iStationStart = TrainParams->StationIndex;
|
||||
asNextStop = TrainParams->NextStop();
|
||||
TrainParams.UpdateMTable( simulation::Time, TrainParams.NextStationName );
|
||||
TrainParams.StationIndexInc(); // przejście do następnej
|
||||
iStationStart = TrainParams.StationIndex;
|
||||
asNextStop = TrainParams.NextStop();
|
||||
iDrivigFlags |= movePrimary; // skoro dostał rozkład, to jest teraz głównym
|
||||
// NewCommand = Global.asCurrentSceneryPath + NewCommand;
|
||||
auto lookup =
|
||||
@@ -3974,7 +3970,7 @@ bool TController::PutCommand( std::string NewCommand, double NewValue1, double N
|
||||
}
|
||||
else {
|
||||
NewCommand += "radio";
|
||||
auto lookup =
|
||||
lookup =
|
||||
FileExists(
|
||||
{ Global.asCurrentSceneryPath + NewCommand, szSoundPath + NewCommand },
|
||||
{ ".ogg", ".flac", ".wav" } );
|
||||
@@ -3984,13 +3980,13 @@ bool TController::PutCommand( std::string NewCommand, double NewValue1, double N
|
||||
iGuardRadio = iRadioChannel;
|
||||
}
|
||||
}
|
||||
NewCommand = TrainParams->Relation2; // relacja docelowa z rozkładu
|
||||
NewCommand = TrainParams.Relation2; // relacja docelowa z rozkładu
|
||||
}
|
||||
// jeszcze poustawiać tekstury na wyświetlaczach
|
||||
TDynamicObject *p = pVehicles[0];
|
||||
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)
|
||||
}
|
||||
}
|
||||
@@ -4048,7 +4044,7 @@ bool TController::PutCommand( std::string NewCommand, double NewValue1, double N
|
||||
vCommandLocation = *NewLocation;
|
||||
if ((NewValue1 != 0.0) && (OrderCurrentGet() != Obey_train))
|
||||
{ // o ile jazda
|
||||
if( iEngineActive == 0 ) {
|
||||
if( false == iEngineActive ) {
|
||||
// trzeba odpalić silnik najpierw, światła ustawi
|
||||
OrderNext( Prepare_engine );
|
||||
}
|
||||
@@ -4079,7 +4075,7 @@ bool TController::PutCommand( std::string NewCommand, double NewValue1, double N
|
||||
if (NewLocation)
|
||||
vCommandLocation = *NewLocation;
|
||||
// if (OrderList[OrderPos]=Obey_train) and (NewValue1<>0))
|
||||
if (!iEngineActive)
|
||||
if (false == iEngineActive)
|
||||
OrderNext(Prepare_engine); // trzeba odpalić silnik najpierw
|
||||
OrderNext(Shunt); // zamieniamy w aktualnej pozycji, albo dodajey za odpaleniem silnika
|
||||
if (NewValue1 != 0.0)
|
||||
@@ -4126,7 +4122,7 @@ bool TController::PutCommand( std::string NewCommand, double NewValue1, double N
|
||||
if (NewCommand == "Change_direction")
|
||||
{
|
||||
TOrders o = OrderCurrentGet(); // co robił przed zmianą kierunku
|
||||
if (!iEngineActive)
|
||||
if (false == iEngineActive)
|
||||
OrderNext(Prepare_engine); // trzeba odpalić silnik najpierw
|
||||
if (NewValue1 == 0.0)
|
||||
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
|
||||
// 1, 0 - odczepienie lokomotywy z jednym wagonem
|
||||
iDrivigFlags &= ~moveStopHere; // podjeżanie do semaforów zezwolone
|
||||
if (!iEngineActive)
|
||||
if (false == iEngineActive)
|
||||
OrderNext(Prepare_engine); // trzeba odpalić silnik najpierw
|
||||
if (NewValue2 != 0) // jeśli podany jest sprzęg
|
||||
{
|
||||
@@ -4415,7 +4411,7 @@ TController::UpdateSituation(double dt) {
|
||||
if( ( fLastStopExpDist > 0.0 )
|
||||
&& ( mvOccupied->DistCounter > fLastStopExpDist ) ) {
|
||||
// zaktualizować wyświetlanie rozkładu
|
||||
iStationStart = TrainParams->StationIndex;
|
||||
iStationStart = TrainParams.StationIndex;
|
||||
fLastStopExpDist = -1.0; // usunąć licznik
|
||||
}
|
||||
|
||||
@@ -4703,7 +4699,7 @@ TController::UpdateSituation(double dt) {
|
||||
|
||||
if( ( true == TestFlag( iDrivigFlags, moveStartHornNow ) )
|
||||
&& ( true == Ready )
|
||||
&& ( iEngineActive != 0 )
|
||||
&& ( true == iEngineActive )
|
||||
&& ( mvControlling->MainCtrlPowerPos() > 0 ) ) {
|
||||
// uruchomienie trąbienia przed ruszeniem
|
||||
fWarningDuration = 0.3; // czas trąbienia
|
||||
@@ -5153,7 +5149,7 @@ TController::UpdateSituation(double dt) {
|
||||
} // Change_direction (tylko dla AI)
|
||||
|
||||
if( ( true == AIControllFlag )
|
||||
&& ( iEngineActive == 0 )
|
||||
&& ( false == iEngineActive )
|
||||
&& ( OrderCurrentGet() & ( Change_direction | Connect | Disconnect | Shunt | Loose_shunt | Obey_train | Bank ) ) ) {
|
||||
// jeśli coś ma robić to niech odpala do skutku
|
||||
PrepareEngine();
|
||||
@@ -5170,10 +5166,9 @@ TController::UpdateSituation(double dt) {
|
||||
// no chyba żeby to uwzgldnić już w (ActualProximityDist)
|
||||
VelDesired = fVelMax; // wstępnie prędkość maksymalna dla pojazdu(-ów), będzie
|
||||
// następnie ograniczana
|
||||
if( ( TrainParams )
|
||||
&& ( TrainParams->TTVmax > 0.0 ) ) {
|
||||
if( TrainParams.TTVmax > 0.0 ) {
|
||||
// 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
|
||||
AccDesired = AccPreferred; // AccPreferred wynika z osobowości mechanika
|
||||
@@ -5537,13 +5532,13 @@ TController::UpdateSituation(double dt) {
|
||||
|
||||
if( ( OrderCurrentGet() & Obey_train ) != 0 ) {
|
||||
|
||||
if( ( TrainParams->CheckTrainLatency() < 5.0 )
|
||||
&& ( TrainParams->TTVmax > 0.0 ) ) {
|
||||
if( ( TrainParams.CheckTrainLatency() < 5.0 )
|
||||
&& ( TrainParams.TTVmax > 0.0 ) ) {
|
||||
// jesli nie spozniony to nie przekraczać rozkladowej
|
||||
VelDesired =
|
||||
min_speed(
|
||||
VelDesired,
|
||||
TrainParams->TTVmax );
|
||||
TrainParams.TTVmax );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6408,7 +6403,7 @@ void TController::OrdersInit(double fVel)
|
||||
// ustawienie kolejności komend, niezależnie kto prowadzi
|
||||
OrdersClear(); // usunięcie poprzedniej tabeli
|
||||
OrderPush(Prepare_engine); // najpierw odpalenie silnika
|
||||
if (TrainParams->TrainName == "none")
|
||||
if (TrainParams.TrainName == "none")
|
||||
{ // brak rozkładu to jazda manewrowa
|
||||
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
|
||||
@@ -6417,23 +6412,21 @@ void TController::OrdersInit(double fVel)
|
||||
{ // jeśli z rozkładem, to jedzie na szlak
|
||||
if ((fVel > 0.0) && (fVel < 0.02))
|
||||
OrderPush(Shunt); // dla prędkości 0.01 włączamy jazdę manewrową
|
||||
else if (TrainParams ?
|
||||
(TrainParams->DirectionChange() ? // jeśli obrót na pierwszym przystanku
|
||||
((iDrivigFlags & movePushPull) ? // SZT również! SN61 zależnie od wagonów...
|
||||
(TrainParams->TimeTable[1].StationName == TrainParams->Relation1) :
|
||||
false) :
|
||||
false) :
|
||||
true)
|
||||
else if (TrainParams.DirectionChange() ? // jeśli obrót na pierwszym przystanku
|
||||
((iDrivigFlags & movePushPull) ? // SZT również! SN61 zależnie od wagonów...
|
||||
(TrainParams.TimeTable[1].StationName == TrainParams.Relation1) :
|
||||
false) :
|
||||
false)
|
||||
OrderPush(Shunt); // a teraz start będzie w manewrowym, a tryb pociągowy włączy W4
|
||||
else
|
||||
// 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
|
||||
if (DebugModeFlag) // normalnie nie ma po co tego wypisywać
|
||||
WriteLog("/* Timetable: " + TrainParams->ShowRelation());
|
||||
WriteLog("/* Timetable: " + TrainParams.ShowRelation());
|
||||
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) {
|
||||
// normalnie nie ma po co tego wypisywa?
|
||||
WriteLog(
|
||||
@@ -6453,7 +6446,7 @@ void TController::OrdersInit(double fVel)
|
||||
OrderPush(Disconnect); // odczepienie lokomotywy
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -6818,10 +6811,8 @@ std::string TController::NextStop() const
|
||||
if (asNextStop == "[End of route]")
|
||||
return ""; // nie zawiera nazwy stacji, gdy dojechał do końca
|
||||
// dodać godzinę odjazdu
|
||||
if (!TrainParams)
|
||||
return ""; // tu nie powinno nigdy wejść
|
||||
std::string nextstop = Bezogonkow( asNextStop, true );
|
||||
TMTableLine *t = TrainParams->TimeTable + TrainParams->StationIndex;
|
||||
auto nextstop{ Bezogonkow( asNextStop, true ) };
|
||||
auto const *t{ TrainParams.TimeTable + TrainParams.StationIndex };
|
||||
if( t->Ah >= 0 ) {
|
||||
// przyjazd
|
||||
nextstop += " przyj." + std::to_string( t->Ah ) + ":"
|
||||
@@ -6838,7 +6829,7 @@ std::string TController::NextStop() const
|
||||
|
||||
void TController::UpdateDelayFlag() {
|
||||
|
||||
if( TrainParams->CheckTrainLatency() < 0.0 ) {
|
||||
if( TrainParams.CheckTrainLatency() < 0.0 ) {
|
||||
// odnotowano spóźnienie
|
||||
iDrivigFlags |= moveLate;
|
||||
}
|
||||
@@ -6940,34 +6931,34 @@ void TController::ZeroDirection() {
|
||||
while( ( mvOccupied->ActiveDir < 0 ) && ( mvOccupied->DirectionForward() ) ) { ; }
|
||||
}
|
||||
|
||||
Mtable::TTrainParameters const *
|
||||
Mtable::TTrainParameters const &
|
||||
TController::TrainTimetable() const {
|
||||
return TrainParams;
|
||||
}
|
||||
|
||||
std::string TController::Relation() const
|
||||
{ // zwraca relację pociągu
|
||||
return TrainParams->ShowRelation();
|
||||
return TrainParams.ShowRelation();
|
||||
};
|
||||
|
||||
std::string TController::TrainName() const
|
||||
{ // zwraca numer pociągu
|
||||
return TrainParams->TrainName;
|
||||
return TrainParams.TrainName;
|
||||
};
|
||||
|
||||
int TController::StationCount() const
|
||||
{ // zwraca ilość stacji (miejsc zatrzymania)
|
||||
return TrainParams->StationCount;
|
||||
return TrainParams.StationCount;
|
||||
};
|
||||
|
||||
int TController::StationIndex() const
|
||||
{ // zwraca indeks aktualnej stacji (miejsca zatrzymania)
|
||||
return TrainParams->StationIndex;
|
||||
return TrainParams.StationIndex;
|
||||
};
|
||||
|
||||
bool TController::IsStop() const
|
||||
{ // informuje, czy jest zatrzymanie na najbliższej stacji
|
||||
return TrainParams->IsStop();
|
||||
return TrainParams.IsStop();
|
||||
};
|
||||
|
||||
// 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 "sound.h"
|
||||
#include "DynObj.h"
|
||||
#include "mtable.h"
|
||||
|
||||
enum TOrders
|
||||
{ // rozkazy dla AI
|
||||
@@ -421,7 +422,7 @@ private:
|
||||
// methods
|
||||
public:
|
||||
std::string TrainName() const;
|
||||
Mtable::TTrainParameters const * TrainTimetable() const;
|
||||
Mtable::TTrainParameters const & TrainTimetable() const;
|
||||
private:
|
||||
std::string Relation() const;
|
||||
int StationIndex() const;
|
||||
@@ -431,7 +432,7 @@ private:
|
||||
// tests whether the train is delayed and sets accordingly a driving flag
|
||||
void UpdateDelayFlag();
|
||||
// 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
|
||||
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
|
||||
@@ -456,7 +457,7 @@ private:
|
||||
double fMass = 0.0; // całkowita masa do liczenia stycznej składowej grawitacji
|
||||
double fAccGravity = 0.0; // przyspieszenie składowej stycznej grawitacji
|
||||
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 IsHeavyCargoTrain{ false };
|
||||
bool IsLineBreakerClosed{ false }; // state of line breaker in all powered vehicles under control
|
||||
|
||||
20
DynObj.cpp
20
DynObj.cpp
@@ -3328,8 +3328,7 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
if (dWheelAngle[2] > 360.0)
|
||||
dWheelAngle[2] -= 360.0;
|
||||
}
|
||||
if (pants) // pantograf może być w wagonie kuchennym albo pojeździe rewizyjnym
|
||||
// (np. SR61)
|
||||
if (pants) // pantograf może być w wagonie kuchennym albo pojeździe rewizyjnym (np. SR61)
|
||||
{ // przeliczanie kątów dla pantografów
|
||||
double k; // tymczasowy kąt
|
||||
double PantDiff;
|
||||
@@ -3341,17 +3340,12 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
+ MoverParameters->TotalCurrent; // prąd pobierany przez pojazd - bez
|
||||
// sensu z tym (TotalCurrent)
|
||||
// TotalCurrent to bedzie prad nietrakcyjny (niezwiazany z napedem)
|
||||
// fCurrent+=fabs(MoverParameters->Voltage)*1e-6; //prąd płynący przez
|
||||
// woltomierz,
|
||||
// rozładowuje kondensator orgromowy 4µF
|
||||
// fCurrent+=fabs(MoverParameters->Voltage)*1e-6; //prąd płynący przez woltomierz, rozładowuje kondensator orgromowy 4µF
|
||||
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 (pants[0].fParamPants->hvPowerWire &&
|
||||
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
|
||||
// sensu, ale lepiej tak niż podwoić prąd)
|
||||
if (iAnimType[ANIM_PANTS] > 1) // a jeśli są dwa pantografy //Ra 1014-11: proteza, trzeba zrobić sensowniej
|
||||
if (pants[0].fParamPants->hvPowerWire &&
|
||||
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 sensu, ale lepiej tak niż podwoić prąd)
|
||||
for (int i = 0; i < iAnimType[ANIM_PANTS]; ++i)
|
||||
{ // pętla po wszystkich pantografach
|
||||
p = pants[i].fParamPants;
|
||||
@@ -6436,7 +6430,7 @@ TDynamicObject::update_shake( double const Timedelta ) {
|
||||
// ABu: rzucamy kabina tylko przy duzym FPS!
|
||||
// Mala histereza, zeby bez przerwy nie przelaczalo przy FPS~17
|
||||
// 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;
|
||||
if( ( MoverParameters->EngineType == TEngineType::DieselElectric )
|
||||
|
||||
@@ -8416,10 +8416,11 @@ bool TMoverParameters::readCompressorList(std::string const &Input) {
|
||||
return false;
|
||||
}
|
||||
int idx = LISTLINE++;
|
||||
if (idx > 8) {
|
||||
if (idx > 8 - 1) {
|
||||
WriteLog("Read CompressorList: number of entries exceeded capacity of the data table");
|
||||
return false;
|
||||
}
|
||||
// NOTE: content of slot [x][0] is hardcoded elsewhere
|
||||
parser
|
||||
>> CompressorList[ 0 ][ 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
|
||||
// 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));
|
||||
static int const i_bcpno = 6;
|
||||
static int const i_bcpno = 5;
|
||||
// static double const pi = 3.141592653589793; //definicja w mctools
|
||||
|
||||
enum TUniversalBrake // możliwe działania uniwersalnego przycisku hamulca
|
||||
|
||||
12
Train.cpp
12
Train.cpp
@@ -603,7 +603,7 @@ dictionary_source *TTrain::GetTrainState() {
|
||||
dict->insert( "velnext", driver->VelNext );
|
||||
dict->insert( "actualproximitydist", driver->ActualProximityDist );
|
||||
// train data
|
||||
driver->TrainTimetable()->serialize( dict );
|
||||
driver->TrainTimetable().serialize( dict );
|
||||
dict->insert( "train_stationstart", driver->iStationStart );
|
||||
dict->insert( "train_atpassengerstop", driver->IsAtPassengerStop );
|
||||
dict->insert( "train_length", driver->fLength );
|
||||
@@ -3117,8 +3117,8 @@ void TTrain::OnCommand_compressorpresetactivatenext(TTrain *Train, command_data
|
||||
// active light preset is stored as value in range 1-LigthPosNo
|
||||
Train->mvOccupied->CompressorListPos = (
|
||||
Train->mvOccupied->CompressorListPos < Train->mvOccupied->CompressorListPosNo ?
|
||||
Train->mvOccupied->CompressorListPos + 1 :
|
||||
1); // wrap mode
|
||||
Train->mvOccupied->CompressorListPos + 1 :
|
||||
1); // wrap mode
|
||||
|
||||
// visual feedback
|
||||
if (Train->ggCompressorListButton.SubModel != nullptr) {
|
||||
@@ -3139,12 +3139,12 @@ void TTrain::OnCommand_compressorpresetactivateprevious(TTrain *Train, command_d
|
||||
}
|
||||
|
||||
if ((Train->mvOccupied->CompressorListPos > 1)
|
||||
|| (true == Train->mvOccupied->CompressorListWrap)) {
|
||||
|| (true == Train->mvOccupied->CompressorListWrap)) {
|
||||
// active light preset is stored as value in range 1-LigthPosNo
|
||||
Train->mvOccupied->CompressorListPos = (
|
||||
Train->mvOccupied->CompressorListPos > 1 ?
|
||||
Train->mvOccupied->CompressorListPos - 1 :
|
||||
Train->mvOccupied->CompressorListPosNo); // wrap mode
|
||||
Train->mvOccupied->CompressorListPos - 1 :
|
||||
Train->mvOccupied->CompressorListPosNo); // wrap mode
|
||||
|
||||
// visual feedback
|
||||
if (Train->ggCompressorListButton.SubModel != nullptr) {
|
||||
|
||||
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;
|
||||
|
||||
const int maxcab = 2;
|
||||
|
||||
const double fCzuwakBlink = 0.15;
|
||||
const float fConverterPrzekaznik = 1.5f; // hunter-261211: do przekaznika nadmiarowego przetwornicy
|
||||
// 0.33f
|
||||
@@ -685,7 +683,7 @@ public: // reszta może by?publiczna
|
||||
bool bCabLightDim; // hunter-091012: czy przyciemnienie kabiny jest zapalone?
|
||||
*/
|
||||
// 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
|
||||
// McZapkie: do poruszania sie po kabinie
|
||||
Math3D::vector3 pMechSittingPosition; // ABu 180404
|
||||
|
||||
@@ -41,13 +41,8 @@ dictionary_source::dictionary_source( std::string const &Input ) {
|
||||
vehicle == nullptr ? nullptr :
|
||||
vehicle->ctOwner == nullptr ? vehicle->Mechanik :
|
||||
vehicle->ctOwner ) };
|
||||
auto const *timetable { (
|
||||
controller != nullptr ?
|
||||
controller->TrainTimetable() :
|
||||
nullptr ) };
|
||||
|
||||
if( timetable != nullptr ) {
|
||||
timetable->serialize( this );
|
||||
if( controller != nullptr ) {
|
||||
controller->TrainTimetable().serialize( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -653,7 +653,7 @@ driver_mode::OnKeyDown(int cKey) {
|
||||
int i = cKey - GLFW_KEY_0; // numer klawisza
|
||||
if (Global.shiftState) {
|
||||
// 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 ) ) {
|
||||
simulation::Events.AddToQuery( KeyEvents[ i ], NULL );
|
||||
}
|
||||
|
||||
@@ -268,8 +268,7 @@ timetable_panel::update() {
|
||||
vehicle->ctOwner );
|
||||
if( owner == nullptr ) { return; }
|
||||
|
||||
auto const *table = owner->TrainTimetable();
|
||||
if( table == nullptr ) { return; }
|
||||
auto const &table = owner->TrainTimetable();
|
||||
|
||||
// destination
|
||||
{
|
||||
@@ -310,14 +309,14 @@ timetable_panel::update() {
|
||||
std::snprintf(
|
||||
m_buffer.data(), m_buffer.size(),
|
||||
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>( consistlength ) );
|
||||
|
||||
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
|
||||
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 );
|
||||
|
||||
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
|
||||
tableline = table->TimeTable + i; // linijka rozkładu
|
||||
tableline = table.TimeTable + i; // linijka rozkładu
|
||||
|
||||
bool vmaxchange { true };
|
||||
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 ) :
|
||||
u8" │ " ) };
|
||||
auto const candeparture { (
|
||||
( owner->iStationStart < table->StationIndex )
|
||||
&& ( i < table->StationIndex )
|
||||
( owner->iStationStart < table.StationIndex )
|
||||
&& ( i < table.StationIndex )
|
||||
&& ( ( tableline->Ah < 0 ) // pass-through, always valid
|
||||
|| ( 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 isatpassengerstop { ( true == owner->IsAtPassengerStop ) && ( vehicle->MoverParameters->Vel < 1.0 ) };
|
||||
auto const traveltime { (
|
||||
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 ) :
|
||||
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 ) ) };
|
||||
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 ) ) };
|
||||
auto const linecolor { (
|
||||
( i != owner->iStationStart ) ? Global.UITextColor :
|
||||
loadchangeinprogress ? loadingcolor :
|
||||
@@ -390,7 +389,7 @@ timetable_panel::update() {
|
||||
( u8"│ │ " + location + tableline->StationWare + trackcount + departure + u8" │ │" ),
|
||||
linecolor );
|
||||
// divider/footer
|
||||
if( i < table->StationCount ) {
|
||||
if( i < table.StationCount ) {
|
||||
auto const *nexttableline { tableline + 1 };
|
||||
std::string const vmaxnext{ ( tableline->vmax == nexttableline->vmax ? 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( scenario_time const &Time, std::string const &NewName );
|
||||
bool RewindTimeTable( std::string actualStationName );
|
||||
TTrainParameters( std::string const &NewTrainName );
|
||||
TTrainParameters( std::string const &NewTrainName = "none" );
|
||||
void NewName(std::string const &NewTrainName);
|
||||
void UpdateVelocity(int StationCount, double vActual);
|
||||
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 ) {
|
||||
|
||||
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 );
|
||||
}
|
||||
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
|
||||
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 );
|
||||
}
|
||||
else {
|
||||
::glDisableClientState( GL_NORMAL_ARRAY );
|
||||
}
|
||||
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 );
|
||||
}
|
||||
else {
|
||||
@@ -178,7 +178,7 @@ opengl_vbogeometrybank::bind_streams( gfx::stream_units const &Units, unsigned i
|
||||
if( Streams & gfx::stream::texture ) {
|
||||
for( auto unit : Units.texture ) {
|
||||
::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 );
|
||||
}
|
||||
m_activetexturearrays = Units.texture;
|
||||
|
||||
@@ -141,10 +141,10 @@ opengl_particles::render( int const Textureunit ) {
|
||||
::glBindBuffer( GL_ARRAY_BUFFER, m_buffer );
|
||||
::glVertexPointer( 3, GL_FLOAT, sizeof( particle_vertex ), static_cast<char *>( nullptr ) );
|
||||
::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 );
|
||||
::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 );
|
||||
// ...draw...
|
||||
::glDrawArrays( GL_QUADS, 0, m_particlevertices.size() );
|
||||
|
||||
@@ -346,10 +346,10 @@ opengl_renderer::Render() {
|
||||
Timer::subsystem.gfx_swap.stop();
|
||||
|
||||
m_drawcount = m_cellqueue.size();
|
||||
m_debugtimestext
|
||||
+= "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"
|
||||
+= "frame total: " + to_string( Timer::subsystem.gfx_color.average() + Timer::subsystem.gfx_swap.average(), 2 ) + " msec";
|
||||
m_debugtimestext +=
|
||||
"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"
|
||||
+ "frame total: " + to_string( Timer::subsystem.gfx_color.average() + Timer::subsystem.gfx_swap.average(), 2 ) + " msec";
|
||||
|
||||
m_debugstatstext =
|
||||
"drawcalls: " + to_string( m_debugstats.drawcalls ) + "\n"
|
||||
|
||||
Reference in New Issue
Block a user