16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-23 10:59:18 +02:00

build 170506. minor diagnostics, performance and rendering enhancements

This commit is contained in:
tmj-fstate
2017-05-06 14:31:53 +02:00
parent 381eff2e8c
commit fc2fc3e27c
9 changed files with 80 additions and 189 deletions

View File

@@ -386,13 +386,7 @@ void TSpeedPos::Set(TTrack *track, double dist, int flag)
void TController::TableClear() void TController::TableClear()
{ // wyczyszczenie tablicy { // wyczyszczenie tablicy
#ifdef EU07_USE_OLD_SPEEDTABLE
iFirst = iLast = 0;
for (int i = 0; i < iSpeedTableSize; ++i) // czyszczenie tabeli prędkości
sSpeedTable[i].Clear();
#else
sSpeedTable.clear(); sSpeedTable.clear();
#endif
iLast = -1; iLast = -1;
iTableDirection = 0; // nieznany iTableDirection = 0; // nieznany
tLast = nullptr; tLast = nullptr;
@@ -413,36 +407,15 @@ TEvent * TController::CheckTrackEvent(double fDirection, TTrack *Track)
bool TController::TableAddNew() bool TController::TableAddNew()
{ // zwiększenie użytej tabelki o jeden rekord { // zwiększenie użytej tabelki o jeden rekord
#ifdef EU07_USE_OLD_SPEEDTABLE
iLast = ( iLast + 1 ) % iSpeedTableSize;
// TODO: jeszcze sprawdzić, czy się na iFirst nie nałoży
// TODO: wstawić tu wywołanie odtykacza - teraz jest to w TableTraceRoute()
// TODO: jeśli ostatnia pozycja zajęta, ustawiać dodatkowe flagi - teraz jest to w
// TableTraceRoute()
// TODO: przydało by się też posortować tabelkę wg odległości (ale nie w tym miejscu)
#else
sSpeedTable.emplace_back(); // add a new slot sSpeedTable.emplace_back(); // add a new slot
iLast = sSpeedTable.size() - 1; iLast = sSpeedTable.size() - 1;
#endif
return true; // false gdy się nałoży return true; // false gdy się nałoży
}; };
bool TController::TableNotFound(TEvent const *Event) const bool TController::TableNotFound(TEvent const *Event) const
{ // sprawdzenie, czy nie został już dodany do tabelki (np. podwójne W4 robi problemy) { // sprawdzenie, czy nie został już dodany do tabelki (np. podwójne W4 robi problemy)
#ifdef EU07_USE_OLD_SPEEDTABLE auto lookup =
int j = (iLast + 1) % iSpeedTableSize; // j, aby sprawdzić też ostatnią pozycję std::find_if(
for (int i = iFirst; i != j; i = (i + 1) % iSpeedTableSize)
if ((sSpeedTable[i].iFlags & (spEnabled | spEvent)) == (spEnabled |
spEvent)) // o ile używana pozycja
if (sSpeedTable[i].evEvent == e)
{
if (Global::iWriteLogEnabled & 8)
WriteLog("TableNotFound: Event already in SpeedTable: " + sSpeedTable[i].evEvent->asName);
return false; // już jest, drugi raz dodawać nie ma po co
}
return true; // nie ma, czyli można dodać
#else
auto lookup = std::find_if(
sSpeedTable.begin(), sSpeedTable.begin(),
sSpeedTable.end(), sSpeedTable.end(),
[Event]( TSpeedPos const &speedpoint ){ [Event]( TSpeedPos const &speedpoint ){
@@ -455,7 +428,6 @@ bool TController::TableNotFound(TEvent const *Event) const
} }
return lookup == sSpeedTable.end(); return lookup == sSpeedTable.end();
#endif
}; };
void TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle) void TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle)
@@ -480,9 +452,6 @@ void TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle)
fTrackLength = pTrack->Length() - fTrackLength; // przeskanowana zostanie odległość do Point2 fTrackLength = pTrack->Length() - fTrackLength; // przeskanowana zostanie odległość do Point2
} }
fLastVel = pTrack->VelocityGet(); // aktualna prędkość fLastVel = pTrack->VelocityGet(); // aktualna prędkość
#ifdef EU07_USE_OLD_SPEEDTABLE
iFirst = iLast = 0;
#endif
sSpeedTable.clear(); sSpeedTable.clear();
iLast = -1; iLast = -1;
tLast = nullptr; //żaden nie sprawdzony tLast = nullptr; //żaden nie sprawdzony
@@ -491,65 +460,21 @@ void TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle)
} }
else { else {
// kontynuacja skanowania od ostatnio sprawdzonego toru (w ostatniej pozycji zawsze jest tor) // kontynuacja skanowania od ostatnio sprawdzonego toru (w ostatniej pozycji zawsze jest tor)
// WriteLog("TableTraceRoute: check last track");
#ifdef EU07_USE_OLD_SPEEDTABLE
if( sSpeedTable[ iLast ].iFlags & spEndOfTable ) // zatkanie
{ // jeśli zapełniła się tabelka
if ((iLast + 1) % iSpeedTableSize == iFirst) // jeśli nadal jest zapełniona
{
TablePurger(); // nic się nie da zrobić
return;
}
if ((iLast + 2) % iSpeedTableSize == iFirst) // musi być jeszcze miejsce wolne na
// ewentualny event, bo tor jeszcze nie
// sprawdzony
{
TablePurger();
return; // już lepiej, ale jeszcze nie tym razem
}
sSpeedTable[iLast].iFlags &= 0xBE; // kontynuować próby doskanowania
}
#endif
// znaleziono semafor lub tarczę lub tor z prędkością zero, trzeba sprawdzić czy to nadał semafor
#ifdef EU07_USE_OLD_SPEEDTABLE
if( ( sSemNextStop != nullptr )
&& ( sSemNextStop->fVelNext < 1.0 ) ) {
#else
if( ( SemNextStopIndex != -1 ) if( ( SemNextStopIndex != -1 )
&& ( sSpeedTable[SemNextStopIndex].fVelNext < 1.0 ) ) { && ( sSpeedTable[SemNextStopIndex].fVelNext < 1.0 ) ) {
#endif // znaleziono semafor lub tarczę lub tor z prędkością zero, trzeba sprawdzić czy to nadał semafor
// jeśli jest następny semafor to sprawdzamy czy to on nadał zero // jeśli jest następny semafor to sprawdzamy czy to on nadał zero
#ifdef EU07_USE_OLD_SPEEDTABLE
if( ( OrderCurrentGet() & Obey_train )
&& ( sSemNextStop->iFlags & spSemaphor ) ) {
#else
if( ( OrderCurrentGet() & Obey_train ) if( ( OrderCurrentGet() & Obey_train )
&& ( sSpeedTable[SemNextStopIndex].iFlags & spSemaphor ) ) { && ( sSpeedTable[SemNextStopIndex].iFlags & spSemaphor ) ) {
#endif
return; return;
} }
else { else {
#ifdef EU07_USE_OLD_SPEEDTABLE
if( ( OrderCurrentGet() < 0x40 )
&& ( sSemNextStop->iFlags & ( spSemaphor | spShuntSemaphor | spOutsideStation ) ) ) {
#else
if( ( OrderCurrentGet() < 0x40 ) if( ( OrderCurrentGet() < 0x40 )
&& ( sSpeedTable[SemNextStopIndex].iFlags & ( spSemaphor | spShuntSemaphor | spOutsideStation ) ) ) { && ( sSpeedTable[SemNextStopIndex].iFlags & ( spSemaphor | spShuntSemaphor | spOutsideStation ) ) ) {
#endif
return; return;
} }
} }
} }
#ifdef EU07_USE_OLD_SPEEDTABLE
pTrack = sSpeedTable[iLast].trTrack; // ostatnio sprawdzony tor
if (!pTrack)
return; // koniec toru, to nie ma co sprawdzać (nie ma prawa tak być)
fLastDir = (sSpeedTable[iLast].iFlags & spReverse) ? -1.0 : 1.0; // flaga ustawiona, gdy Point2 toru jest bli<6C>ej
fCurrentDistance = sSpeedTable[iLast].fDist; // aktualna odleg<65>o<EFBFBD><6F> do jego Point1
fTrackLength = (sSpeedTable[iLast].iFlags & (spElapsed | spEnd)) ? 0.0 : pTrack->Length(); // nie dolicza<7A> d<>ugo<67>ci gdy:
// 32-minięty początek,
// 64-jazda do końca toru
#else
auto const &lastspeedpoint = sSpeedTable[ iLast ]; auto const &lastspeedpoint = sSpeedTable[ iLast ];
pTrack = lastspeedpoint.trTrack; pTrack = lastspeedpoint.trTrack;
assert( pTrack != nullptr ); assert( pTrack != nullptr );
@@ -565,7 +490,6 @@ void TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle)
( lastspeedpoint.iFlags & ( spElapsed | spEnd ) != 0 ) ? ( lastspeedpoint.iFlags & ( spElapsed | spEnd ) != 0 ) ?
0.0 : 0.0 :
pTrack->Length() ); pTrack->Length() );
#endif
} }
if( fCurrentDistance >= fDistance ) { if( fCurrentDistance >= fDistance ) {
@@ -594,59 +518,10 @@ void TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle)
if( Global::iWriteLogEnabled & 8 ) { if( Global::iWriteLogEnabled & 8 ) {
WriteLog( "Speed table for " + OwnerName() + " found new event, " + pEvent->asName ); WriteLog( "Speed table for " + OwnerName() + " found new event, " + pEvent->asName );
} }
#ifdef EU07_USE_OLD_SPEEDTABLE
if( sSpeedTable[ iLast ].Set( pEvent, fCurrentDistance, OrderCurrentGet() ) ) // dodanie odczytu sygnału
{
fDistance = fCurrentDistance; // jeśli sygnał stop, to nie ma
// potrzeby dalej skanować
sSemNextStop = &sSpeedTable[iLast];
if (!sSemNext)
sSemNext = &sSpeedTable[iLast];
if (Global::iWriteLogEnabled & 8)
WriteLog("Signal stop. Next Semaphor ", false);
if (sSemNextStop)
{
if (Global::iWriteLogEnabled & 8)
WriteLog(sSemNextStop->GetName());
}
else
{
if (Global::iWriteLogEnabled & 8)
WriteLog("none");
}
}
else {
if( sSpeedTable[ iLast ].IsProperSemaphor( OrderCurrentGet() ) &&
sSemNext == NULL )
sSemNext =
&sSpeedTable[ iLast ]; // sprawdzamy czy pierwszy na drodze
if( Global::iWriteLogEnabled & 8 )
WriteLog( "Signal forward. Next Semaphor ", false );
if( sSemNext ) {
if( Global::iWriteLogEnabled & 8 )
WriteLog( sSemNext->GetName() );
}
else {
if( Global::iWriteLogEnabled & 8 )
WriteLog( "none" );
}
}
#else
auto &newspeedpoint = sSpeedTable[ iLast ]; auto &newspeedpoint = sSpeedTable[ iLast ];
if( newspeedpoint.Set( pEvent, fCurrentDistance, OrderCurrentGet() ) ) { if( newspeedpoint.Set( pEvent, fCurrentDistance, OrderCurrentGet() ) ) {
fDistance = fCurrentDistance; // jeśli sygnał stop, to nie ma potrzeby dalej skanować fDistance = fCurrentDistance; // jeśli sygnał stop, to nie ma potrzeby dalej skanować
#ifdef EU07_USE_OLD_SPEEDTABLE
sSemNextStop = &newspeedpoint;
if( sSemNext == nullptr ) {
sSemNext = &newspeedpoint;
}
if( Global::iWriteLogEnabled & 8 ) {
WriteLog( "(stop signal from "
+ ( sSemNextStop ? sSemNextStop->GetName() : "unknown semaphor" )
+ ")" );
}
#else
SemNextStopIndex = iLast; SemNextStopIndex = iLast;
if( SemNextIndex == -1 ) { if( SemNextIndex == -1 ) {
SemNextIndex = iLast; SemNextIndex = iLast;
@@ -656,20 +531,8 @@ void TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle)
+ ( SemNextStopIndex != -1 ? sSpeedTable[SemNextStopIndex].GetName() : "unknown semaphor" ) + ( SemNextStopIndex != -1 ? sSpeedTable[SemNextStopIndex].GetName() : "unknown semaphor" )
+ ")" ); + ")" );
} }
#endif
} }
else { else {
#ifdef EU07_USE_OLD_SPEEDTABLE
if( ( true == newspeedpoint.IsProperSemaphor( OrderCurrentGet() ) )
&& ( sSemNext == nullptr ) ) {
sSemNext = &newspeedpoint; // sprawdzamy czy pierwszy na drodze
}
if( Global::iWriteLogEnabled & 8 ) {
WriteLog( "(forward signal for "
+ ( sSemNext ? sSemNext->GetName() : "unknown semaphor" )
+ ")" );
}
#else
if( ( true == newspeedpoint.IsProperSemaphor( OrderCurrentGet() ) ) if( ( true == newspeedpoint.IsProperSemaphor( OrderCurrentGet() ) )
&& ( SemNextIndex == -1 ) ) { && ( SemNextIndex == -1 ) ) {
SemNextIndex = iLast; // sprawdzamy czy pierwszy na drodze SemNextIndex = iLast; // sprawdzamy czy pierwszy na drodze
@@ -679,9 +542,7 @@ void TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle)
+ ( SemNextIndex != -1 ? sSpeedTable[SemNextIndex].GetName() : "unknown semaphor" ) + ( SemNextIndex != -1 ? sSpeedTable[SemNextIndex].GetName() : "unknown semaphor" )
+ ")" ); + ")" );
} }
#endif
} }
#endif
} }
} // event dodajemy najpierw, żeby móc sprawdzić, czy tor został dodany po odczytaniu prędkości następnego } // event dodajemy najpierw, żeby móc sprawdzić, czy tor został dodany po odczytaniu prędkości następnego
@@ -723,12 +584,14 @@ void TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle)
|| ( ( tLast != nullptr ) || ( ( tLast != nullptr )
&& ( tLast->fRadius != 0.0 ) )) // koniec łuku też jest istotny && ( tLast->fRadius != 0.0 ) )) // koniec łuku też jest istotny
{ // albo dla liczenia odległości przy pomocy cięciw - te usuwać po przejechaniu { // albo dla liczenia odległości przy pomocy cięciw - te usuwać po przejechaniu
if (TableAddNew()) if (TableAddNew()) {
// dodanie odcinka do tabelki
sSpeedTable[iLast].Set( sSpeedTable[iLast].Set(
pTrack, fCurrentDistance, pTrack, fCurrentDistance,
( fLastDir < 0 ? ( fLastDir < 0 ?
spEnabled | spCurve | spReverse : spEnabled | spCurve | spReverse :
spEnabled | spCurve ) ); // dodanie odcinka do tabelki spEnabled | spCurve ) );
}
} }
} }
@@ -766,28 +629,6 @@ void TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle)
} }
} }
} }
#ifdef EU07_USE_OLD_SPEEDTABLE
if( ( ( iLast + 3 ) % iSpeedTableSize == iFirst ) ?
true :
((iLast + 2) % iSpeedTableSize == iFirst)) // czy tabelka się nie zatka?
{ // jest ryzyko nieznalezienia ograniczenia - ograniczyć prędkość do pozwalającej
// na zatrzymanie na końcu przeskanowanej drogi
TablePurger(); // usunąć pilnie zbędne pozycje
if (((iLast + 3) % iSpeedTableSize == iFirst) ?
true :
((iLast + 2) % iSpeedTableSize == iFirst)) // czy tabelka się nie zatka?
{ // jeśli odtykacz nie pomógł (TODO: zwiększyć rozmiar tabelki)
if (TableAddNew())
sSpeedTable[iLast].Set(
pTrack, fCurrentDistance,
fLastDir < 0 ?
0x10045 :
0x10041); // zapisanie toru jako końcowego (ogranicza prędkosć)
// zapisać w logu, że należy poprawić scenerię?
return; // nie skanujemy dalej, bo nie ma miejsca
}
}
#endif
// zwiększenie skanowanej odległości tylko jeśli istnieje dalszy tor // zwiększenie skanowanej odległości tylko jeśli istnieje dalszy tor
fTrackLength = pTrack->Length(); fTrackLength = pTrack->Length();
} }
@@ -796,12 +637,14 @@ void TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle)
if( ( iLast == -1 ) if( ( iLast == -1 )
|| ( false == TestFlag( sSpeedTable[iLast].iFlags, spEnabled | spEnd ) ) ) { || ( false == TestFlag( sSpeedTable[iLast].iFlags, spEnabled | spEnd ) ) ) {
// only if we haven't already marked end of the track // only if we haven't already marked end of the track
if( TableAddNew() ) if( TableAddNew() ) {
// zapisanie ostatniego sprawdzonego toru
sSpeedTable[iLast].Set( sSpeedTable[iLast].Set(
tLast, fCurrentDistance, tLast, fCurrentDistance,
( fLastDir < 0 ? ( fLastDir < 0 ?
spEnabled | spEnd | spReverse : spEnabled | spEnd | spReverse :
spEnabled | spEnd )); // zapisanie ostatniego sprawdzonego toru spEnabled | spEnd ));
}
} }
// to ostatnia pozycja, bo NULL nic nie da, a może się podpiąć obrotnica, czy jakieś transportery // to ostatnia pozycja, bo NULL nic nie da, a może się podpiąć obrotnica, czy jakieś transportery
return; return;
@@ -1459,6 +1302,9 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
void TController::TablePurger() void TController::TablePurger()
{ // odtykacz: usuwa mniej istotne pozycje ze środka tabelki, aby uniknąć zatkania { // odtykacz: usuwa mniej istotne pozycje ze środka tabelki, aby uniknąć zatkania
//(np. brak ograniczenia pomiędzy zwrotnicami, usunięte sygnały, minięte odcinki łuku) //(np. brak ograniczenia pomiędzy zwrotnicami, usunięte sygnały, minięte odcinki łuku)
if( sSpeedTable.size() < 2 ) {
return;
}
// simplest approach should be good enough for start -- just copy whatever is still relevant, then swap // simplest approach should be good enough for start -- just copy whatever is still relevant, then swap
// do a trial run first, to see if we need to bother at all // do a trial run first, to see if we need to bother at all
std::size_t trimcount{ 0 }; std::size_t trimcount{ 0 };
@@ -1502,7 +1348,7 @@ void TController::TablePurger()
WriteLog( "Speed table garbage collection for " + OwnerName() + " cut away " + std::to_string( trimcount ) + ( trimcount == 1 ? " record" : " records" ) ); WriteLog( "Speed table garbage collection for " + OwnerName() + " cut away " + std::to_string( trimcount ) + ( trimcount == 1 ? " record" : " records" ) );
} }
// update the data // update the data
sSpeedTable = trimmedtable; std::swap( sSpeedTable, trimmedtable );
iLast = sSpeedTable.size() - 1; iLast = sSpeedTable.size() - 1;
}; };

View File

@@ -45,6 +45,11 @@ http://mozilla.org/MPL/2.0/.
#define M_2PI 6.283185307179586476925286766559; #define M_2PI 6.283185307179586476925286766559;
const float maxrot = (float)(M_PI / 3.0); // 60° const float maxrot = (float)(M_PI / 3.0); // 60°
std::string const TDynamicObject::MED_labels[] = {
"masa: ", "amax: ", "Fzad: ", "FmPN: ", "FmED: ", "FrED: ", "FzPN: ", "nPrF: "
};
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void TAnimPant::AKP_4E() void TAnimPant::AKP_4E()
{ // ustawienie wymiarów dla pantografu AKP-4E { // ustawienie wymiarów dla pantografu AKP-4E
@@ -5275,10 +5280,19 @@ void TDynamicObject::LoadMMediaFile(std::string BaseDir, std::string TypeName,
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void TDynamicObject::RadioStop() void TDynamicObject::RadioStop()
{ // zatrzymanie pojazdu { // zatrzymanie pojazdu
if (Mechanik) // o ile ktoś go prowadzi if( Mechanik ) {
if (MoverParameters->SecuritySystem.RadioStop && // o ile ktoś go prowadzi
MoverParameters->Radio) // jeśli pojazd ma RadioStop i jest on aktywny if( ( MoverParameters->SecuritySystem.RadioStop )
&& ( MoverParameters->Radio ) ) {
// jeśli pojazd ma RadioStop i jest on aktywny
Mechanik->PutCommand( "Emergency_brake", 1.0, 1.0, &vPosition, stopRadio ); Mechanik->PutCommand( "Emergency_brake", 1.0, 1.0, &vPosition, stopRadio );
// add onscreen notification for human driver
// TODO: do it selectively for the 'local' driver once the multiplayer is in
if( false == Mechanik->AIControllFlag ) {
Global::tranTexts.AddLine( "!! RADIO-STOP !!", 0.0, 10.0, false );
}
}
}
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@@ -546,6 +546,7 @@ public: // modele składowe pojazdu
std::string TextureTest(std::string const &name); std::string TextureTest(std::string const &name);
void OverheadTrack(float o); void OverheadTrack(float o);
double MED[9][8]; // lista zmiennych do debugowania hamulca ED double MED[9][8]; // lista zmiennych do debugowania hamulca ED
static std::string const MED_labels[ 8 ];
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@@ -773,6 +773,7 @@ public:
double Ftmax = 0.0; double Ftmax = 0.0;
/*- dla lokomotyw z silnikami indukcyjnymi -*/ /*- dla lokomotyw z silnikami indukcyjnymi -*/
double eimc[26]; double eimc[26];
static std::vector<std::string> const eimc_labels;
/*-dla wagonow*/ /*-dla wagonow*/
double MaxLoad = 0.0; /*masa w T lub ilosc w sztukach - ladownosc*/ double MaxLoad = 0.0; /*masa w T lub ilosc w sztukach - ladownosc*/
std::string LoadAccepted; std::string LoadQuantity; /*co moze byc zaladowane, jednostki miary*/ std::string LoadAccepted; std::string LoadQuantity; /*co moze byc zaladowane, jednostki miary*/
@@ -939,6 +940,7 @@ public:
/*- zmienne dla lokomotyw z silnikami indukcyjnymi -*/ /*- zmienne dla lokomotyw z silnikami indukcyjnymi -*/
double eimv[21]; double eimv[21];
static std::vector<std::string> const eimv_labels;
/*-zmienne dla drezyny*/ /*-zmienne dla drezyny*/
double PulseForce = 0.0; /*przylozona sila*/ double PulseForce = 0.0; /*przylozona sila*/

View File

@@ -22,6 +22,18 @@ http://mozilla.org/MPL/2.0/.
const double dEpsilon = 0.01; // 1cm (zależy od typu sprzęgu...) const double dEpsilon = 0.01; // 1cm (zależy od typu sprzęgu...)
const double CouplerTune = 0.1; // skalowanie tlumiennosci const double CouplerTune = 0.1; // skalowanie tlumiennosci
std::vector<std::string> const TMoverParameters::eimc_labels = {
"dfic: ", "dfmax:", "p: ", "scfu: ", "cim: ", "icif: ", "Uzmax:", "Uzh: ", "DU: ", "I0: ",
"fcfu: ", "F0: ", "a1: ", "Pmax: ", "Fh: ", "Ph: ", "Vh0: ", "Vh1: ", "Imax: ", "abed: ",
"eped: "
};
std::vector<std::string> const TMoverParameters::eimv_labels = {
"Fkrt:", "Fmax:", "ks: ", "df: ", "fp: ", "Us: ", "pole:", "Ic: ", "If: ", "M: ",
"Fr: ", "Ipoj:", "Pm: ", "Pe: ", "eta: ", "fkr: ", "Uzsm:", "Pmax:", "Fzad:", "Imax:",
"Fful:"
};
inline long Trunc(float f) inline long Trunc(float f)
{ {
return (long)f; return (long)f;

View File

@@ -205,6 +205,11 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
{ user_command::radiotoggle, &TTrain::OnCommand_radiotoggle } { user_command::radiotoggle, &TTrain::OnCommand_radiotoggle }
}; };
std::vector<std::string> const TTrain::fPress_labels = {
"ch1: ", "ch2: ", "ch3: ", "ch4: ", "ch5: ", "ch6: ", "ch7: ", "ch8: ", "ch9: ", "ch0: "
};
TTrain::TTrain() TTrain::TTrain()
{ {
ActiveUniversal4 = false; ActiveUniversal4 = false;
@@ -2767,7 +2772,10 @@ void TTrain::OnCommand_radiotoggle( TTrain *Train, command_data const &Command )
if( Command.action == GLFW_PRESS ) { if( Command.action == GLFW_PRESS ) {
WriteLog( "Radio switch is missing, or wasn't defined" ); WriteLog( "Radio switch is missing, or wasn't defined" );
} }
/*
// NOTE: we ignore the lack of 3d model to allow system reset after receiving radio-stop signal
return; return;
*/
} }
if( Command.action == GLFW_PRESS ) { if( Command.action == GLFW_PRESS ) {

View File

@@ -484,6 +484,7 @@ public: // reszta może by?publiczna
public: public:
float fPress[20][3]; // cisnienia dla wszystkich czlonow float fPress[20][3]; // cisnienia dla wszystkich czlonow
static std::vector<std::string> const fPress_labels;
float fEIMParams[9][10]; // parametry dla silnikow asynchronicznych float fEIMParams[9][10]; // parametry dla silnikow asynchronicznych
int RadioChannel() { return iRadioChannel; }; int RadioChannel() { return iRadioChannel; };
inline TDynamicObject *Dynamic() { return DynamicObject; }; inline TDynamicObject *Dynamic() { return DynamicObject; };

View File

@@ -2135,17 +2135,18 @@ TWorld::Update_UI() {
for( int i = 0; i <= 20; ++i ) { for( int i = 0; i <= 20; ++i ) {
std::string parameters = std::string parameters =
to_string(tmp->MoverParameters->eimc[i], 2, 9) tmp->MoverParameters->eimc_labels[ i ] + to_string( tmp->MoverParameters->eimc[ i ], 2, 9 )
+ " " + to_string( tmp->MoverParameters->eimv[ i ], 2, 9 ); + " | "
+ tmp->MoverParameters->eimv_labels[ i ] + to_string( tmp->MoverParameters->eimv[ i ], 2, 9 );
if( i <= 10 ) { if( i < 10 ) {
parameters += " " + to_string( Train->fPress[ i ][ 0 ], 2, 9 ); parameters += " | " + Train->fPress_labels[i] + to_string( Train->fPress[ i ][ 0 ], 2, 9 );
} }
else if( i == 12 ) { else if( i == 12 ) {
parameters += " med:"; parameters += " med:";
} }
else if( i >= 13 ) { else if( i >= 13 ) {
parameters += " " + to_string( tmp->MED[ 0 ][ i - 13 ], 2, 9 ); parameters += " | " + tmp->MED_labels[ i - 13 ] + to_string( tmp->MED[ 0 ][ i - 13 ], 2, 9 );
} }
UITable->text_lines.emplace_back( parameters, Global::UITextColor ); UITable->text_lines.emplace_back( parameters, Global::UITextColor );

View File

@@ -167,7 +167,13 @@ opengl_renderer::Render( world_environment *Environment ) {
::glDisable( GL_DEPTH_TEST ); ::glDisable( GL_DEPTH_TEST );
::glDepthMask( GL_FALSE ); ::glDepthMask( GL_FALSE );
::glPushMatrix(); ::glPushMatrix();
/*
::glTranslatef( Global::pCameraPosition.x, Global::pCameraPosition.y, Global::pCameraPosition.z ); ::glTranslatef( Global::pCameraPosition.x, Global::pCameraPosition.y, Global::pCameraPosition.z );
*/
glm::mat4 worldcamera;
World.Camera.SetMatrix( worldcamera );
glLoadIdentity();
glMultMatrixf( glm::value_ptr( glm::mat4( glm::mat3( worldcamera ) ) ) );
// setup fog // setup fog
if( Global::fFogEnd > 0 ) { if( Global::fFogEnd > 0 ) {