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

dangling pointer crash semi-fix, minor bug fixes, minor code correctness enhancements

This commit is contained in:
tmj-fstate
2018-07-16 02:40:53 +02:00
parent ed1e0d8a10
commit 3751c8a0a8
28 changed files with 895 additions and 946 deletions

View File

@@ -361,13 +361,14 @@ void TAnimContainer::UpdateModelIK()
{ // odwrotna kinematyka wyliczana dopiero po ustawieniu macierzy w submodelach
if (pSubModel) // pozbyć się tego - sprawdzać wcześniej
{
if (pSubModel->b_Anim & at_IK)
if ((pSubModel->b_Anim == TAnimType::at_IK)
||(pSubModel->b_Anim == TAnimType::at_IK22))
{ // odwrotna kinematyka
float3 d, k;
TSubModel *ch = pSubModel->ChildGet();
switch (pSubModel->b_Anim)
{
case at_IK11: // stopa: ustawić w kierunku czubka (pierwszy potomny)
case TAnimType::at_IK11: // stopa: ustawić w kierunku czubka (pierwszy potomny)
d = ch->Translation1Get(); // wektor względem aktualnego układu (nie uwzględnia
// obrotu)
k = float3(RadToDeg(atan2(d.z, hypot(d.x, d.y))), 0.0,
@@ -377,7 +378,7 @@ void TAnimContainer::UpdateModelIK()
// WriteLog("--> "+AnsiString(k.x)+" "+AnsiString(k.y)+" "+AnsiString(k.z));
// Ra: to już jest dobrze, może być inna ćwiartka i znak
break;
case at_IK22: // udo: ustawić w kierunku pierwszej potomnej pierwszej potomnej (kostki)
case TAnimType::at_IK22: // udo: ustawić w kierunku pierwszej potomnej pierwszej potomnej (kostki)
// pozycję kostki należy określić względem kości centralnej (+biodro może być
// pochylone)
// potem wyliczyć ewentualne odchylenie w tej i następnej

View File

@@ -27,7 +27,7 @@ void TCamera::Init( Math3D::vector3 NPos, Math3D::vector3 NAngle) {
Roll = NAngle.z;
Pos = NPos;
Type = (Global.bFreeFly ? tp_Free : tp_Follow);
Type = (Global.bFreeFly ? TCameraType::tp_Free : TCameraType::tp_Follow);
};
void TCamera::Reset() {
@@ -76,12 +76,12 @@ TCamera::OnCommand( command_data const &Command ) {
case user_command::movehorizontalfast: {
auto const movespeed = (
Type == tp_Free ? runspeed :
Type == tp_Follow ? walkspeed :
Type == TCameraType::tp_Free ? runspeed :
Type == TCameraType::tp_Follow ? walkspeed :
0.0 );
auto const speedmultiplier = (
( ( Type == tp_Free ) && ( Command.command == user_command::movehorizontalfast ) ) ?
( ( Type == TCameraType::tp_Free ) && ( Command.command == user_command::movehorizontalfast ) ) ?
30.0 :
1.0 );
@@ -111,12 +111,12 @@ TCamera::OnCommand( command_data const &Command ) {
case user_command::moveverticalfast: {
auto const movespeed = (
Type == tp_Free ? runspeed * 0.5 :
Type == tp_Follow ? walkspeed :
Type == TCameraType::tp_Free ? runspeed * 0.5 :
Type == TCameraType::tp_Follow ? walkspeed :
0.0 );
auto const speedmultiplier = (
( ( Type == tp_Free ) && ( Command.command == user_command::moveverticalfast ) ) ?
( ( Type == TCameraType::tp_Free ) && ( Command.command == user_command::moveverticalfast ) ) ?
10.0 :
1.0 );
@@ -145,8 +145,8 @@ TCamera::OnCommand( command_data const &Command ) {
void TCamera::Update()
{
if( FreeFlyModeFlag == true ) { Type = tp_Free; }
else { Type = tp_Follow; }
if( FreeFlyModeFlag == true ) { Type = TCameraType::tp_Free; }
else { Type = TCameraType::tp_Follow; }
// check for sent user commands
// NOTE: this is a temporary arrangement, for the transition period from old command setup to the new one
@@ -162,7 +162,7 @@ void TCamera::Update()
auto const deltatime { Timer::GetDeltaRenderTime() }; // czas bez pauzy
// update position
if( ( Type == tp_Free )
if( ( Type == TCameraType::tp_Free )
|| ( false == Global.ctrlState )
|| ( true == DebugCameraFlag ) ) {
// ctrl is used for mirror view, so we ignore the controls when in vehicle if ctrl is pressed
@@ -172,7 +172,7 @@ void TCamera::Update()
Velocity.y = clamp( Velocity.y + m_moverate.y * 10.0 * deltatime, -std::abs( m_moverate.y ), std::abs( m_moverate.y ) );
}
if( ( Type == tp_Free )
if( ( Type == TCameraType::tp_Free )
|| ( true == DebugCameraFlag ) ) {
// free movement position update is handled here, movement while in vehicle is handled by train update
Math3D::vector3 Vec = Velocity;
@@ -193,7 +193,7 @@ void TCamera::Update()
Pitch -= rotationfactor * m_rotationoffsets.x;
m_rotationoffsets.x *= ( 1.0 - rotationfactor );
if( Type == tp_Follow ) {
if( Type == TCameraType::tp_Follow ) {
// jeżeli jazda z pojazdem ograniczenie kąta spoglądania w dół i w górę
Pitch = clamp( Pitch, -M_PI_4, M_PI_4 );
}
@@ -210,7 +210,7 @@ bool TCamera::SetMatrix( glm::dmat4 &Matrix ) {
Matrix = glm::rotate( Matrix, -Pitch, glm::dvec3( 1.0, 0.0, 0.0 ) );
Matrix = glm::rotate( Matrix, -Yaw, glm::dvec3( 0.0, 1.0, 0.0 ) ); // w zewnętrznym widoku: kierunek patrzenia
if( ( Type == tp_Follow ) && ( false == DebugCameraFlag ) ) {
if( ( Type == TCameraType::tp_Follow ) && ( false == DebugCameraFlag ) ) {
Matrix *= glm::lookAt(
glm::dvec3{ Pos },

View File

@@ -13,7 +13,7 @@ http://mozilla.org/MPL/2.0/.
#include "command.h"
//---------------------------------------------------------------------------
enum TCameraType
enum class TCameraType
{ // tryby pracy kamery
tp_Follow, // jazda z pojazdem
tp_Free, // stoi na scenerii

View File

@@ -46,7 +46,7 @@ class TMtableTime; // czas dla danego posterunku
class TController; // obiekt sterujący pociągiem (AI)
enum TCommandType
enum class TCommandType
{ // binarne odpowiedniki komend w komórce pamięci
cm_Unknown, // ciąg nierozpoznany (nie jest komendą)
cm_Ready, // W4 zezwala na odjazd, ale semafor może zatrzymać

View File

@@ -201,12 +201,12 @@ void TSpeedPos::CommandCheck()
double value2 = evEvent->ValueGet(2);
switch (command)
{
case cm_ShuntVelocity:
case TCommandType::cm_ShuntVelocity:
// prędkość manewrową zapisać, najwyżej AI zignoruje przy analizie tabelki
fVelNext = value1; // powinno być value2, bo druga określa "za"?
iFlags |= spShuntSemaphor;
break;
case cm_SetVelocity:
case TCommandType::cm_SetVelocity:
// w semaforze typu "m" jest ShuntVelocity dla Ms2 i SetVelocity dla S1
// SetVelocity * 0 -> można jechać, ale stanąć przed
// SetVelocity 0 20 -> stanąć przed, potem można jechać 20 (SBL)
@@ -222,31 +222,31 @@ void TSpeedPos::CommandCheck()
iFlags |= spStopOnSBL; // flaga, że ma zatrzymać; na pewno nie zezwoli na manewry
}
break;
case cm_SectionVelocity:
case TCommandType::cm_SectionVelocity:
// odcinek z ograniczeniem prędkości
fVelNext = value1;
fSectionVelocityDist = value2;
iFlags |= spSectionVel;
break;
case cm_RoadVelocity:
case TCommandType::cm_RoadVelocity:
// prędkość drogowa (od tej pory będzie jako domyślna najwyższa)
fVelNext = value1;
iFlags |= spRoadVel;
break;
case cm_PassengerStopPoint:
case TCommandType::cm_PassengerStopPoint:
// nie ma dostępu do rozkładu
// przystanek, najwyżej AI zignoruje przy analizie tabelki
// if ((iFlags & spPassengerStopPoint) == 0)
fVelNext = 0.0; // TrainParams->IsStop()?0.0:-1.0; //na razie tak
iFlags |= spPassengerStopPoint; // niestety nie da się w tym miejscu współpracować z rozkładem
break;
case cm_SetProximityVelocity:
case TCommandType::cm_SetProximityVelocity:
// musi zostać gdyż inaczej nie działają manewry
fVelNext = -1;
iFlags |= spProximityVelocity;
// fSectionVelocityDist = value2;
break;
case cm_OutsideStation:
case TCommandType::cm_OutsideStation:
// w trybie manewrowym: skanować od niej wstecz i stanąć po wyjechaniu za sygnalizator i
// zmienić kierunek
// w trybie pociągowym: można przyspieszyć do wskazanej prędkości (po zjechaniu z rozjazdów)
@@ -803,7 +803,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
double d; // droga
double d_to_next_sem = 10000.0; //ustaiwamy na pewno dalej niż widzi AI
bool isatpassengerstop { false }; // true if the consist is within acceptable range of w4 post
TCommandType go = cm_Unknown;
TCommandType go = TCommandType::cm_Unknown;
eSignNext = NULL;
// te flagi są ustawiane tutaj, w razie potrzeby
iDrivigFlags &= ~(moveTrackEnd | moveSwitchFound | moveSemaphorFound | moveSpeedLimitFound);
@@ -1011,8 +1011,8 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
iDrivigFlags |= moveStopCloser; // do następnego W4 podjechać blisko (z dociąganiem)
sSpeedTable[i].iFlags = 0; // nie liczy się już zupełnie (nie wyśle SetVelocity)
sSpeedTable[i].fVelNext = -1; // można jechać za W4
if (go == cm_Unknown) // jeśli nie było komendy wcześniej
go = cm_Ready; // gotów do odjazdu z W4 (semafor może
if (go == TCommandType::cm_Unknown) // jeśli nie było komendy wcześniej
go = TCommandType::cm_Ready; // gotów do odjazdu z W4 (semafor może
// zatrzymać)
if( false == tsGuardSignal.empty() ) {
// jeśli mamy głos kierownika, to odegrać
@@ -1232,12 +1232,12 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
sSpeedTable[ i ].iFlags = 0;
}
}
else if( go == cm_Unknown ) {
else if( go == TCommandType::cm_Unknown ) {
// jeśli jeszcze nie ma komendy
// komenda jest tylko gdy ma jechać, bo stoi na podstawietabelki
if( v != 0.0 ) {
// jeśli nie było komendy wcześniej - pierwsza się liczy - ustawianie VelSignal
go = cm_ShuntVelocity; // w trybie pociągowym tylko jeśli włącza
go = TCommandType::cm_ShuntVelocity; // w trybie pociągowym tylko jeśli włącza
// tryb manewrowy (v!=0.0)
// Ra 2014-06: (VelSignal) nie może być tu ustawiane, bo Tm może być
// daleko
@@ -1258,12 +1258,12 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
}
else if( !( sSpeedTable[ i ].iFlags & spSectionVel ) ) {
//jeśli jakiś event pasywny ale nie ograniczenie
if( go == cm_Unknown ) {
if( go == TCommandType::cm_Unknown ) {
// jeśli nie było komendy wcześniej - pierwsza się liczy - ustawianie VelSignal
if( ( v < 0.0 )
|| ( v >= 1.0 ) ) {
// bo wartość 0.1 służy do hamowania tylko
go = cm_SetVelocity; // może odjechać
go = TCommandType::cm_SetVelocity; // może odjechać
// Ra 2014-06: (VelSignal) nie może być tu ustawiane, bo semafor może być daleko
// VelSignal=v; //nie do końca tak, to jest druga prędkość; -1 nie wpisywać...
if( VelSignal == 0.0 ) {
@@ -1295,12 +1295,12 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
eSignNext = sSpeedTable[ i ].evEvent; // dla informacji
if( true == TestFlag( iDrivigFlags, moveStopHere ) ) {
// jeśli ma stać, dostaje komendę od razu
go = cm_Command; // komenda z komórki, do wykonania po zatrzymaniu
go = TCommandType::cm_Command; // komenda z komórki, do wykonania po zatrzymaniu
}
else if( sSpeedTable[ i ].fDist <= fMaxProximityDist ) {
// jeśli ma dociągnąć, to niech dociąga
// (moveStopCloser dotyczy dociągania do W4, nie semafora)
go = cm_Command; // komenda z komórki, do wykonania po zatrzymaniu
go = TCommandType::cm_Command; // komenda z komórki, do wykonania po zatrzymaniu
}
}
}
@@ -1671,7 +1671,7 @@ void TController::Activation()
TDynamicObject *old = pVehicle, *d = pVehicle; // w tym siedzi AI
TController *drugi; // jakby były dwa, to zamienić miejscami, a nie robić wycieku pamięci
// poprzez nadpisanie
int brake = mvOccupied->LocalBrakePos;
auto const localbrakelevel { mvOccupied->LocalBrakePosA };
while (mvControlling->MainCtrlPos) // samo zapętlenie DecSpeed() nie wystarcza :/
DecSpeed(true); // wymuszenie zerowania nastawnika jazdy
while (mvOccupied->ActiveDir < 0)
@@ -1683,7 +1683,7 @@ void TController::Activation()
{
mvControlling->MainSwitch(
false); // dezaktywacja czuwaka, jeśli przejście do innego członu
mvOccupied->DecLocalBrakeLevel(10); // zwolnienie hamulca w opuszczanym pojeździe
mvOccupied->DecLocalBrakeLevel(LocalBrakePosNo); // zwolnienie hamulca w opuszczanym pojeździe
// mvOccupied->BrakeLevelSet((mvOccupied->BrakeHandle==FVel6)?4:-2); //odcięcie na
// zaworze maszynisty, FVel6 po drugiej stronie nie luzuje
mvOccupied->BrakeLevelSet(
@@ -1721,7 +1721,7 @@ void TController::Activation()
ControllingSet(); // utworzenie połączenia do sterowanego pojazdu (może się zmienić) -
// silnikowy dla EZT
}
if( mvControlling->EngineType == DieselEngine ) {
if( mvControlling->EngineType == TEngineType::DieselEngine ) {
// dla 2Ls150 - przed ustawieniem kierunku - można zmienić tryb pracy
if( mvControlling->ShuntModeAllow ) {
mvControlling->CurrentSwitch(
@@ -1736,8 +1736,8 @@ void TController::Activation()
// mvOccupied->ActiveDir=0; //żeby sam ustawił kierunek
mvOccupied->CabActivisation(); // uruchomienie kabin w członach
DirectionForward(true); // nawrotnik do przodu
if (brake) // hamowanie tylko jeśli był wcześniej zahamowany (bo możliwe, że jedzie!)
mvOccupied->IncLocalBrakeLevel(brake); // zahamuj jak wcześniej
if (localbrakelevel > 0.0) // hamowanie tylko jeśli był wcześniej zahamowany (bo możliwe, że jedzie!)
mvOccupied->LocalBrakePosA = localbrakelevel; // zahamuj jak wcześniej
CheckVehicles(); // sprawdzenie składu, AI zapali światła
TableClear(); // resetowanie tabelki skanowania torów
}
@@ -1984,7 +1984,7 @@ bool TController::CheckVehicles(TOrders user)
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 == CurrentCollector)
if (p->MoverParameters->EnginePowerSource.SourceType == TPowerSource::CurrentCollector)
{ // jeśli pojazd posiada pantograf, to przydzielamy mu maskę, którą będzie informował o
// jeździe bezprądowej
p->iOverheadMask = pantmask;
@@ -2274,7 +2274,7 @@ bool TController::PrepareEngine()
ReactionTime = PrepareTime;
iDrivigFlags |= moveActive; // może skanować sygnały i reagować na komendy
if ( mvControlling->EnginePowerSource.SourceType == CurrentCollector ) {
if ( mvControlling->EnginePowerSource.SourceType == TPowerSource::CurrentCollector ) {
voltfront = true;
voltrear = true;
}
@@ -2288,15 +2288,15 @@ bool TController::PrepareEngine()
if (AIControllFlag) {
// część wykonawcza dla sterowania przez komputer
mvOccupied->BatterySwitch( true );
if( ( mvControlling->EngineType == DieselElectric )
|| ( mvControlling->EngineType == DieselEngine ) ) {
if( ( mvControlling->EngineType == TEngineType::DieselElectric )
|| ( mvControlling->EngineType == TEngineType::DieselEngine ) ) {
mvControlling->OilPumpSwitch( true );
workingtemperature = UpdateHeating();
if( true == workingtemperature ) {
mvControlling->FuelPumpSwitch( true );
}
}
if (mvControlling->EnginePowerSource.SourceType == CurrentCollector)
if (mvControlling->EnginePowerSource.SourceType == TPowerSource::CurrentCollector)
{ // jeśli silnikowy jest pantografującym
mvOccupied->PantFront( true );
mvOccupied->PantRear( true );
@@ -2427,7 +2427,7 @@ bool TController::ReleaseEngine()
ReactionTime = PrepareTime;
if (AIControllFlag)
{ // jeśli steruje komputer
if (mvOccupied->DoorCloseCtrl == control::driver)
if (mvOccupied->DoorCloseCtrl == control_t::driver)
{ // zamykanie drzwi
if (mvOccupied->DoorLeftOpened)
mvOccupied->DoorLeft(false);
@@ -2439,7 +2439,7 @@ bool TController::ReleaseEngine()
{
mvControlling->CompressorSwitch(false);
mvControlling->ConverterSwitch(false);
if (mvControlling->EnginePowerSource.SourceType == CurrentCollector)
if (mvControlling->EnginePowerSource.SourceType == TPowerSource::CurrentCollector)
{
mvControlling->PantFront(false);
mvControlling->PantRear(false);
@@ -2474,15 +2474,15 @@ bool TController::ReleaseEngine()
{ // jeśli się zatrzymał
iEngineActive = 0;
eStopReason = stopSleep; // stoimy z powodu wyłączenia
eAction = actSleep; //śpi (wygaszony)
eAction = TAction::actSleep; //śpi (wygaszony)
if (AIControllFlag)
{
if( ( mvControlling->EngineType == DieselElectric )
|| ( mvControlling->EngineType == DieselEngine ) ) {
if( ( mvControlling->EngineType == TEngineType::DieselElectric )
|| ( mvControlling->EngineType == TEngineType::DieselEngine ) ) {
// heating/cooling subsystem
mvControlling->WaterHeaterSwitch( false );
// optionally turn off the water pump as well
if( mvControlling->WaterPump.start_type != start::battery ) {
if( mvControlling->WaterPump.start_type != start_t::battery ) {
mvControlling->WaterPumpSwitch( false );
}
// fuel and oil subsystems
@@ -2504,8 +2504,8 @@ bool TController::IncBrake()
{ // zwiększenie hamowania
bool OK = false;
switch( mvOccupied->BrakeSystem ) {
case Individual: {
if( mvOccupied->LocalBrake == ManualBrake ) {
case TBrakeSystem::Individual: {
if( mvOccupied->LocalBrake == TLocalBrake::ManualBrake ) {
OK = mvOccupied->IncManualBrakeLevel( 1 + static_cast<int>( std::floor( 0.5 + std::fabs( AccDesired ) ) ) );
}
else {
@@ -2513,7 +2513,7 @@ bool TController::IncBrake()
}
break;
}
case Pneumatic: {
case TBrakeSystem::Pneumatic: {
// NOTE: can't perform just test whether connected vehicle == nullptr, due to virtual couplers formed with nearby vehicles
bool standalone { true };
if( ( mvOccupied->TrainType == dt_ET41 )
@@ -2577,7 +2577,7 @@ bool TController::IncBrake()
}
pos_corr = pos_corr / fMass * 2.5;
if (mvOccupied->BrakeHandle == FV4a)
if (mvOccupied->BrakeHandle == TBrakeHandle::FV4a)
{
pos_corr += mvOccupied->Handle->GetCP()*0.2;
@@ -2621,9 +2621,9 @@ bool TController::IncBrake()
}
break;
}
case ElectroPneumatic: {
if( mvOccupied->EngineType == ElectricInductionMotor ) {
if (mvOccupied->BrakeHandle == MHZ_EN57) {
case TBrakeSystem::ElectroPneumatic: {
if( mvOccupied->EngineType == TEngineType::ElectricInductionMotor ) {
if (mvOccupied->BrakeHandle == TBrakeHandle::MHZ_EN57) {
if (mvOccupied->BrakeCtrlPos < mvOccupied->Handle->GetPos(bh_FB))
OK = mvOccupied->BrakeLevelAdd(1.0);
}
@@ -2652,13 +2652,13 @@ bool TController::DecBrake()
double deltaAcc = 0;
switch (mvOccupied->BrakeSystem)
{
case Individual:
if (mvOccupied->LocalBrake == ManualBrake)
case TBrakeSystem::Individual:
if (mvOccupied->LocalBrake == TLocalBrake::ManualBrake)
OK = mvOccupied->DecManualBrakeLevel(1 + floor(0.5 + fabs(AccDesired)));
else
OK = mvOccupied->DecLocalBrakeLevel(1 + floor(0.5 + fabs(AccDesired)));
break;
case Pneumatic:
case TBrakeSystem::Pneumatic:
deltaAcc = -AccDesired*BrakeAccFactor() - (fBrake_a0[0] + 4 * (mvOccupied->BrakeCtrlPosR-1.0)*fBrake_a1[0]);
if (deltaAcc < 0)
{
@@ -2672,13 +2672,13 @@ bool TController::DecBrake()
}
}
if (!OK)
OK = mvOccupied->DecLocalBrakeLevel(2);
OK = mvOccupied->DecLocalBrakeLevel(LocalBrakePosNo);
if (mvOccupied->PipePress < 3.0)
Need_BrakeRelease = true;
break;
case ElectroPneumatic:
if (mvOccupied->EngineType == ElectricInductionMotor) {
if (mvOccupied->BrakeHandle == MHZ_EN57) {
case TBrakeSystem::ElectroPneumatic:
if (mvOccupied->EngineType == TEngineType::ElectricInductionMotor) {
if (mvOccupied->BrakeHandle == TBrakeHandle::MHZ_EN57) {
if (mvOccupied->BrakeCtrlPos > mvOccupied->Handle->GetPos(bh_RP))
OK = mvOccupied->BrakeLevelAdd(-1.0);
}
@@ -2696,7 +2696,7 @@ bool TController::DecBrake()
else
OK = false;
if (!OK)
OK = mvOccupied->DecLocalBrakeLevel(2);
OK = mvOccupied->DecLocalBrakeLevel(LocalBrakePosNo);
break;
}
return OK;
@@ -2726,12 +2726,12 @@ bool TController::IncSpeed()
return false; // jak poślizg, to nie przyspieszamy
switch (mvOccupied->EngineType)
{
case None: // McZapkie-041003: wagon sterowniczy
case TEngineType::None: // McZapkie-041003: wagon sterowniczy
if (mvControlling->MainCtrlPosNo > 0) // jeśli ma czym kręcić
iDrivigFlags |= moveIncSpeed; // ustawienie flagi jazdy
return false;
case ElectricSeriesMotor:
if (mvControlling->EnginePowerSource.SourceType == CurrentCollector) // jeśli pantografujący
case TEngineType::ElectricSeriesMotor:
if (mvControlling->EnginePowerSource.SourceType == TPowerSource::CurrentCollector) // jeśli pantografujący
{
if (fOverhead2 >= 0.0) // a jazda bezprądowa ustawiana eventami (albo opuszczenie)
return false; // to nici z ruszania
@@ -2813,8 +2813,8 @@ bool TController::IncSpeed()
}
mvControlling->AutoRelayCheck(); // sprawdzenie logiki sterowania
break;
case Dumb:
case DieselElectric:
case TEngineType::Dumb:
case TEngineType::DieselElectric:
if (!mvControlling->FuseFlag)
if (Ready || (iDrivigFlags & movePress)) //{(BrakePress<=0.01*MaxBrakePress)}
{
@@ -2823,7 +2823,7 @@ bool TController::IncSpeed()
OK = mvControlling->IncScndCtrl(1);
}
break;
case ElectricInductionMotor:
case TEngineType::ElectricInductionMotor:
if (!mvControlling->FuseFlag)
if (Ready || (iDrivigFlags & movePress) || (mvOccupied->ShuntMode)) //{(BrakePress<=0.01*MaxBrakePress)}
{
@@ -2839,7 +2839,7 @@ bool TController::IncSpeed()
}
break;
case WheelsDriven:
case TEngineType::WheelsDriven:
if (!mvControlling->CabNo)
mvControlling->CabActivisation();
if (sin(mvControlling->eAngle) > 0)
@@ -2847,7 +2847,7 @@ bool TController::IncSpeed()
else
mvControlling->DecMainCtrl(3 + 3 * floor(0.5 + fabs(AccDesired)));
break;
case DieselEngine:
case TEngineType::DieselEngine:
if (mvControlling->ShuntModeAllow)
{ // dla 2Ls150 można zmienić tryb pracy, jeśli jest w liniowym i nie daje rady (wymaga zerowania kierunku)
// mvControlling->ShuntMode=(OrderList[OrderPos]&Shunt)||(fMass>224000.0);
@@ -2876,29 +2876,29 @@ bool TController::DecSpeed(bool force)
bool OK = false; // domyślnie false, aby wyszło z pętli while
switch (mvOccupied->EngineType)
{
case None: // McZapkie-041003: wagon sterowniczy
case TEngineType::None: // McZapkie-041003: wagon sterowniczy
iDrivigFlags &= ~moveIncSpeed; // usunięcie flagi jazdy
if (force) // przy aktywacji kabiny jest potrzeba natychmiastowego wyzerowania
if (mvControlling->MainCtrlPosNo > 0) // McZapkie-041003: wagon sterowniczy, np. EZT
mvControlling->DecMainCtrl(1 + (mvControlling->MainCtrlPos > 2 ? 1 : 0));
mvControlling->AutoRelayCheck(); // sprawdzenie logiki sterowania
return false;
case ElectricSeriesMotor:
case TEngineType::ElectricSeriesMotor:
OK = mvControlling->DecScndCtrl(2); // najpierw bocznik na zero
if (!OK)
OK = mvControlling->DecMainCtrl(1 + (mvControlling->MainCtrlPos > 2 ? 1 : 0));
mvControlling->AutoRelayCheck(); // sprawdzenie logiki sterowania
break;
case Dumb:
case DieselElectric:
case TEngineType::Dumb:
case TEngineType::DieselElectric:
OK = mvControlling->DecScndCtrl(2);
if (!OK)
OK = mvControlling->DecMainCtrl(2 + (mvControlling->MainCtrlPos / 2));
break;
case ElectricInductionMotor:
case TEngineType::ElectricInductionMotor:
OK = mvControlling->DecMainCtrl(1);
break;
case WheelsDriven:
case TEngineType::WheelsDriven:
if (!mvControlling->CabNo)
mvControlling->CabActivisation();
if (sin(mvControlling->eAngle) < 0)
@@ -2906,7 +2906,7 @@ bool TController::DecSpeed(bool force)
else
mvControlling->DecMainCtrl(3 + 3 * floor(0.5 + fabs(AccDesired)));
break;
case DieselEngine:
case TEngineType::DieselEngine:
if ((mvControlling->Vel > mvControlling->dizel_minVelfullengage))
{
if (mvControlling->RList[mvControlling->MainCtrlPos].Mn > 0)
@@ -2928,7 +2928,7 @@ void TController::SpeedSet()
// ma dokręcać do bezoporowych i zdejmować pozycje w przypadku przekroczenia prądu
switch (mvOccupied->EngineType)
{
case None: // McZapkie-041003: wagon sterowniczy
case TEngineType::None: // McZapkie-041003: wagon sterowniczy
if (mvControlling->MainCtrlPosNo > 0)
{ // jeśli ma czym kręcić
// TODO: sprawdzanie innego czlonu //if (!FuseFlagCheck())
@@ -2993,7 +2993,7 @@ void TController::SpeedSet()
}
}
break;
case ElectricSeriesMotor:
case TEngineType::ElectricSeriesMotor:
if( ( false == mvControlling->StLinFlag )
&& ( false == mvControlling->DelayCtrlFlag ) ) {
// styczniki liniowe rozłączone yBARC
@@ -3063,15 +3063,15 @@ void TController::SpeedSet()
// bezoporowej
}
break;
case Dumb:
case DieselElectric:
case ElectricInductionMotor:
case TEngineType::Dumb:
case TEngineType::DieselElectric:
case TEngineType::ElectricInductionMotor:
break;
// WheelsDriven :
// begin
// OK:=False;
// end;
case DieselEngine:
case TEngineType::DieselEngine:
// Ra 2014-06: "automatyczna" skrzynia biegów...
if (!mvControlling->MotorParam[mvControlling->ScndCtrlPos].AutoSwitch) // gdy biegi ręczne
if ((mvControlling->ShuntMode ? mvControlling->AnPos : 1.0) * mvControlling->Vel >
@@ -3128,7 +3128,7 @@ void TController::Doors( bool const Open, int const Side ) {
// wagony muszą mieć baterię załączoną do otwarcia drzwi...
vehicle->MoverParameters->BatterySwitch( true );
// otwieranie drzwi w pojazdach - flaga zezwolenia była by lepsza
if( vehicle->MoverParameters->DoorOpenCtrl != control::passenger ) {
if( vehicle->MoverParameters->DoorOpenCtrl != control_t::passenger ) {
// if the door are controlled by the driver, we let the user operate them...
if( true == AIControllFlag ) {
// ...unless this user is an ai
@@ -3137,9 +3137,9 @@ void TController::Doors( bool const Open, int const Side ) {
auto const lewe = ( vehicle->DirectionGet() > 0 ) ? 1 : 2;
auto const prawe = 3 - lewe;
if( Side & lewe )
vehicle->MoverParameters->DoorLeft( true, range::local );
vehicle->MoverParameters->DoorLeft( true, range_t::local );
if( Side & prawe )
vehicle->MoverParameters->DoorRight( true, range::local );
vehicle->MoverParameters->DoorRight( true, range_t::local );
}
}
// pojazd podłączony z tyłu (patrząc od czoła)
@@ -3169,9 +3169,9 @@ void TController::Doors( bool const Open, int const Side ) {
auto *vehicle = pVehicles[ 0 ]; // pojazd na czole składu
while( vehicle != nullptr ) {
// zamykanie drzwi w pojazdach - flaga zezwolenia była by lepsza
if( vehicle->MoverParameters->DoorCloseCtrl != control::autonomous ) {
vehicle->MoverParameters->DoorLeft( false, range::local ); // w lokomotywie można by nie zamykać...
vehicle->MoverParameters->DoorRight( false, range::local );
if( vehicle->MoverParameters->DoorCloseCtrl != control_t::autonomous ) {
vehicle->MoverParameters->DoorLeft( false, range_t::local ); // w lokomotywie można by nie zamykać...
vehicle->MoverParameters->DoorRight( false, range_t::local );
}
vehicle = vehicle->Next(); // pojazd podłączony z tyłu (patrząc od czoła)
}
@@ -3625,8 +3625,8 @@ void TController::PhysicsLog()
<< mvControlling->Im << " "
<< int(mvControlling->MainCtrlPos) << " "
<< int(mvControlling->ScndCtrlPos) << " "
<< int(mvOccupied->BrakeCtrlPos) << " "
<< int(mvOccupied->LocalBrakePos) << " "
<< mvOccupied->fBrakeCtrlPos << " "
<< mvOccupied->LocalBrakePosA << " "
<< int(mvControlling->ActiveDir) << " "
<< ( mvOccupied->CommandIn.Command.empty() ? "none" : mvOccupied->CommandIn.Command.c_str() ) << " "
<< mvOccupied->CommandIn.Value1 << " "
@@ -3752,14 +3752,14 @@ TController::UpdateSituation(double dt) {
auto const *vehicle { p->MoverParameters };
if( ( vehicle->EngineType == DieselEngine )
|| ( vehicle->EngineType == DieselElectric ) ) {
if( ( vehicle->EngineType == TEngineType::DieselEngine )
|| ( vehicle->EngineType == TEngineType::DieselElectric ) ) {
Ready = (
( vehicle->Vel > 0.5 ) // already moving
|| ( false == vehicle->Mains ) // deadweight vehicle
|| ( vehicle->enrot > 0.8 * (
vehicle->EngineType == DieselEngine ?
vehicle->EngineType == TEngineType::DieselEngine ?
vehicle->dizel_nmin :
vehicle->DElist[ 0 ].RPM / 60.0 ) ) );
}
@@ -3770,7 +3770,7 @@ TController::UpdateSituation(double dt) {
// for human-controlled vehicles with no door control and dynamic brake auto-activating with door open
if( ( false == AIControllFlag )
&& ( iDrivigFlags & moveDoorOpened )
&& ( mvOccupied->DoorCloseCtrl != control::driver )
&& ( mvOccupied->DoorCloseCtrl != control_t::driver )
&& ( mvControlling->MainCtrlPos > 0 ) ) {
Doors( false );
}
@@ -3790,7 +3790,7 @@ TController::UpdateSituation(double dt) {
}
}
if (mvControlling->EnginePowerSource.SourceType == CurrentCollector) {
if (mvControlling->EnginePowerSource.SourceType == TPowerSource::CurrentCollector) {
if( mvOccupied->ScndPipePress > 4.3 ) {
// gdy główna sprężarka bezpiecznie nabije ciśnienie to można przestawić kurek na zasilanie pantografów z głównej pneumatyki
@@ -3827,7 +3827,7 @@ TController::UpdateSituation(double dt) {
*/
}
if (mvControlling->EnginePowerSource.SourceType == CurrentCollector) {
if (mvControlling->EnginePowerSource.SourceType == TPowerSource::CurrentCollector) {
if( mvOccupied->Vel > 0.05 ) {
// is moving
@@ -3873,7 +3873,7 @@ TController::UpdateSituation(double dt) {
// if the power station is heavily burdened try to reduce the load
switch( mvControlling->EngineType ) {
case ElectricSeriesMotor: {
case TEngineType::ElectricSeriesMotor: {
if( mvControlling->RList[ mvControlling->MainCtrlPos ].Bn > 1 ) {
// limit yourself to series mode
if( mvControlling->ScndCtrlPos ) {
@@ -4168,7 +4168,7 @@ TController::UpdateSituation(double dt) {
// 3. faza odczepiania.
SetVelocity(2, 0); // jazda w ustawionym kierunku z prędkością 2
if ((mvControlling->MainCtrlPos > 0) ||
(mvOccupied->BrakeSystem == ElectroPneumatic)) // jeśli jazda
(mvOccupied->BrakeSystem == TBrakeSystem::ElectroPneumatic)) // jeśli jazda
{
WriteLog(mvOccupied->Name + " odczepianie w kierunku " + std::to_string(mvOccupied->DirAbsolute));
TDynamicObject *p =
@@ -4223,7 +4223,7 @@ TController::UpdateSituation(double dt) {
// powino zostać wyłączone)
// WriteLog("Zahamowanie składu");
mvOccupied->BrakeLevelSet(
mvOccupied->BrakeSystem == ElectroPneumatic ?
mvOccupied->BrakeSystem == TBrakeSystem::ElectroPneumatic ?
1 :
3 );
double p = mvOccupied->BrakePressureActual.PipePressureVal;
@@ -4232,18 +4232,18 @@ TController::UpdateSituation(double dt) {
// TODO: zabezpieczenie przed dziwnymi CHK do czasu wyjaśnienia sensu 0 oraz -1 w tym miejscu
p = 3.9;
}
if (mvOccupied->BrakeSystem == ElectroPneumatic ?
if (mvOccupied->BrakeSystem == TBrakeSystem::ElectroPneumatic ?
mvOccupied->BrakePress > 2 :
mvOccupied->PipePress < p + 0.1)
{ // jeśli w miarę został zahamowany (ciśnienie mniejsze niż podane na
// pozycji 3, zwyle 0.37)
if (mvOccupied->BrakeSystem == ElectroPneumatic)
if (mvOccupied->BrakeSystem == TBrakeSystem::ElectroPneumatic)
mvOccupied->BrakeLevelSet(0); // wyłączenie EP, gdy wystarczy (może
// nie być potrzebne, bo na początku
// jest)
WriteLog("Luzowanie lokomotywy i zmiana kierunku");
mvOccupied->BrakeReleaser(1); // wyluzuj lokomotywę; a ST45?
mvOccupied->DecLocalBrakeLevel(10); // zwolnienie hamulca
mvOccupied->DecLocalBrakeLevel(LocalBrakePosNo); // zwolnienie hamulca
iDrivigFlags |= movePress; // następnie będzie dociskanie
DirectionForward(mvOccupied->ActiveDir < 0); // zmiana kierunku jazdy na przeciwny (dociskanie)
CheckVehicles(); // od razu zmienić światła (zgasić) - bez tego się nie odczepi
@@ -4512,7 +4512,7 @@ TController::UpdateSituation(double dt) {
switch (comm)
{ // ustawienie VelSignal - trochę proteza = do przemyślenia
case cm_Ready: // W4 zezwolił na jazdę
case TCommandType::cm_Ready: // W4 zezwolił na jazdę
// ewentualne doskanowanie trasy za W4, który zezwolił na jazdę
TableCheck( routescanrange);
TableUpdate(VelDesired, ActualProximityDist, VelNext, AccDesired); // aktualizacja po skanowaniu
@@ -4520,21 +4520,21 @@ TController::UpdateSituation(double dt) {
break; // ale jak coś z przodu zamyka, to ma stać
if (iDrivigFlags & moveStopCloser)
VelSignal = -1.0; // ma czekać na sygnał z sygnalizatora!
case cm_SetVelocity: // od wersji 357 semafor nie budzi wyłączonej lokomotywy
case TCommandType::cm_SetVelocity: // od wersji 357 semafor nie budzi wyłączonej lokomotywy
if (!(OrderList[OrderPos] &
~(Obey_train | Shunt))) // jedzie w dowolnym trybie albo Wait_for_orders
if (fabs(VelSignal) >=
1.0) // 0.1 nie wysyła się do samochodow, bo potem nie ruszą
PutCommand("SetVelocity", VelSignal, VelNext, nullptr); // komenda robi dodatkowe operacje
break;
case cm_ShuntVelocity: // od wersji 357 Tm nie budzi wyłączonej lokomotywy
case TCommandType::cm_ShuntVelocity: // od wersji 357 Tm nie budzi wyłączonej lokomotywy
if (!(OrderList[OrderPos] &
~(Obey_train | Shunt))) // jedzie w dowolnym trybie albo Wait_for_orders
PutCommand("ShuntVelocity", VelSignal, VelNext, nullptr);
else if (iCoupler) // jeśli jedzie w celu połączenia
SetVelocity(VelSignal, VelNext);
break;
case cm_Command: // komenda z komórki
case TCommandType::cm_Command: // komenda z komórki
if( !( OrderList[ OrderPos ] & ~( Obey_train | Shunt ) ) ) {
// jedzie w dowolnym trybie albo Wait_for_orders
if( mvOccupied->Vel < 0.1 ) {
@@ -4557,12 +4557,12 @@ TController::UpdateSituation(double dt) {
if( ( OrderList[ OrderPos ] & Connect ) ?
( pVehicles[ 0 ]->fTrackBlock > 2000 || pVehicles[ 0 ]->fTrackBlock > FirstSemaphorDist ) :
true ) {
if( ( comm = BackwardScan() ) != cm_Unknown ) {
if( ( comm = BackwardScan() ) != TCommandType::cm_Unknown ) {
// jeśli w drugą można jechać
// należy sprawdzać odległość od znalezionego sygnalizatora,
// aby w przypadku prędkości 0.1 wyciągnąć najpierw skład za sygnalizator
// i dopiero wtedy zmienić kierunek jazdy, oczekując podania prędkości >0.5
if( comm == cm_Command ) {
if( comm == TCommandType::cm_Command ) {
// jeśli komenda Shunt to ją odbierz bez przemieszczania się (np. odczep wagony po dopchnięciu do końca toru)
iDrivigFlags |= moveStopHere;
}
@@ -5044,9 +5044,9 @@ TController::UpdateSituation(double dt) {
PrepareEngine(); // próba ponownego załączenia
}
// włączanie bezpiecznika
if ((mvControlling->EngineType == ElectricSeriesMotor) ||
if ((mvControlling->EngineType == TEngineType::ElectricSeriesMotor) ||
(mvControlling->TrainType & dt_EZT) ||
(mvControlling->EngineType == DieselElectric))
(mvControlling->EngineType == TEngineType::DieselElectric))
if (mvControlling->FuseFlag || Need_TryAgain)
{
Need_TryAgain = false; // true, jeśli druga pozycja w elektryku nie załapała
@@ -5079,8 +5079,8 @@ TController::UpdateSituation(double dt) {
ReactionTime = 0.25;
}
}
if (mvOccupied->BrakeSystem == Pneumatic) // napełnianie uderzeniowe
if (mvOccupied->BrakeHandle == FV4a)
if (mvOccupied->BrakeSystem == TBrakeSystem::Pneumatic) // napełnianie uderzeniowe
if (mvOccupied->BrakeHandle == TBrakeHandle::FV4a)
{
if( mvOccupied->BrakeCtrlPos == -2 ) {
mvOccupied->BrakeLevelSet( 0 );
@@ -5282,7 +5282,7 @@ TController::UpdateSituation(double dt) {
if( ( VelDesired == 0.0 )
&& ( vel > VelDesired )
&& ( ActualProximityDist <= fMinProximityDist )
&& ( mvOccupied->LocalBrakePos == 0 ) ) {
&& ( mvOccupied->LocalBrakePosA < 0.01 ) ) {
IncBrake();
}
}
@@ -5335,8 +5335,8 @@ TController::UpdateHeating() {
switch( mvControlling->EngineType ) {
case DieselElectric:
case DieselEngine: {
case TEngineType::DieselElectric:
case TEngineType::DieselEngine: {
auto const &heat { mvControlling->dizel_heat };
@@ -5368,7 +5368,7 @@ TController::UpdateHeating() {
mvControlling->WaterHeaterSwitch( false );
mvControlling->WaterHeaterBreakerSwitch( false );
// optionally turn off the water pump as well
if( mvControlling->WaterPump.start_type != start::battery ) {
if( mvControlling->WaterPump.start_type != start_t::battery ) {
mvControlling->WaterPumpSwitch( false );
mvControlling->WaterPumpBreakerSwitch( false );
}
@@ -5738,13 +5738,13 @@ TCommandType TController::BackwardScan()
// zwraca true, jeśli należy odwrócić kierunek jazdy pojazdu
if( ( OrderList[ OrderPos ] & ~( Shunt | Connect ) ) ) {
// skanowanie sygnałów tylko gdy jedzie w trybie manewrowym albo czeka na rozkazy
return cm_Unknown;
return TCommandType::cm_Unknown;
}
// kierunek jazdy względem sprzęgów pojazdu na czele
int const startdir = -pVehicles[0]->DirectionGet();
if( startdir == 0 ) {
// jeśli kabina i kierunek nie jest określony nie robimy nic
return cm_Unknown;
return TCommandType::cm_Unknown;
}
// szukamy od pierwszej osi w wybranym kierunku
double scandir = startdir * pVehicles[0]->RaDirectionGet();
@@ -5759,7 +5759,7 @@ TCommandType TController::BackwardScan()
auto const dir = startdir * pVehicles[0]->VectorFront(); // wektor w kierunku jazdy/szukania
if( !scantrack ) {
// jeśli wstecz wykryto koniec toru to raczej nic się nie da w takiej sytuacji zrobić
return cm_Unknown;
return TCommandType::cm_Unknown;
}
else {
// a jeśli są dalej tory
@@ -5789,7 +5789,7 @@ TCommandType TController::BackwardScan()
#if LOGBACKSCAN
WriteLog(edir + " - ignored as not passed yet");
#endif
return cm_Unknown; // nic
return TCommandType::cm_Unknown; // nic
}
vmechmax = e->ValueGet(1); // prędkość przy tym semaforze
// przeliczamy odległość od semafora - potrzebne by były współrzędne początku składu
@@ -5799,7 +5799,7 @@ TCommandType TController::BackwardScan()
scandist = 0;
}
bool move = false; // czy AI w trybie manewerowym ma dociągnąć pod S1
if( e->Command() == cm_SetVelocity ) {
if( e->Command() == TCommandType::cm_SetVelocity ) {
if( ( vmechmax == 0.0 ) ?
( OrderCurrentGet() & ( Shunt | Connect ) ) :
( OrderCurrentGet() & Connect ) ) { // przy podczepianiu ignorować wyjazd?
@@ -5818,8 +5818,8 @@ TCommandType TController::BackwardScan()
// SetProximityVelocity(scandist,vmechmax,&sl);
return (
vmechmax > 0 ?
cm_SetVelocity :
cm_Unknown );
TCommandType::cm_SetVelocity :
TCommandType::cm_Unknown );
}
else {
// ustawiamy prędkość tylko wtedy, gdy ma ruszyć, stanąć albo ma stać
@@ -5835,15 +5835,15 @@ TCommandType TController::BackwardScan()
#endif
return (
vmechmax > 0 ?
cm_SetVelocity :
cm_Unknown );
TCommandType::cm_SetVelocity :
TCommandType::cm_Unknown );
}
}
}
if (OrderCurrentGet() ? OrderCurrentGet() & (Shunt | Connect) :
true) // w Wait_for_orders też widzi tarcze
{ // reakcja AI w trybie manewrowym dodatkowo na sygnały manewrowe
if (move ? true : e->Command() == cm_ShuntVelocity)
if (move ? true : e->Command() == TCommandType::cm_ShuntVelocity)
{ // jeśli powyżej było SetVelocity 0 0, to dociągamy pod S1
if ((scandist > fMinProximityDist) ?
(mvOccupied->Vel > 0.0) || (vmechmax == 0.0) :
@@ -5861,8 +5861,8 @@ TCommandType TController::BackwardScan()
#endif
// SetProximityVelocity(scandist,vmechmax,&sl);
return (iDrivigFlags & moveTrackEnd) ?
cm_ChangeDirection :
cm_Unknown; // jeśli jedzie na W5 albo koniec toru,
TCommandType::cm_ChangeDirection :
TCommandType::cm_Unknown; // jeśli jedzie na W5 albo koniec toru,
// to można zmienić kierunek
}
}
@@ -5880,8 +5880,8 @@ TCommandType TController::BackwardScan()
#endif
return (
vmechmax > 0 ?
cm_ShuntVelocity :
cm_Unknown );
TCommandType::cm_ShuntVelocity :
TCommandType::cm_Unknown );
}
}
if ((vmechmax != 0.0) && (scandist < 100.0)) {
@@ -5892,19 +5892,19 @@ TCommandType TController::BackwardScan()
#endif
return (
vmechmax > 0 ?
cm_ShuntVelocity :
cm_Unknown );
TCommandType::cm_ShuntVelocity :
TCommandType::cm_Unknown );
}
} // if (move?...
} // if (OrderCurrentGet()==Shunt)
if (!e->bEnabled) // jeśli skanowany
if (e->StopCommand()) // a podłączona komórka ma komendę
return cm_Command; // to też się obrócić
return TCommandType::cm_Command; // to też się obrócić
} // if (e->Type==tp_GetValues)
} // if (e)
} // if (scantrack)
} // if (scandir!=0.0)
return cm_Unknown; // nic
return TCommandType::cm_Unknown; // nic
};
std::string TController::NextStop()

View File

@@ -73,7 +73,7 @@ enum TStopReason
stopError // z powodu błędu w obliczeniu drogi hamowania
};
enum TAction
enum class TAction : int
{ // przechowanie aktualnego stanu AI od poprzedniego przebłysku świadomości
actUnknown, // stan nieznany (domyślny na początku)
actPantUp, // podnieś pantograf (info dla użytkownika)
@@ -223,7 +223,7 @@ private:
double LastReactionTime = 0.0;
double fActionTime = 0.0; // czas używany przy regulacji prędkości i zamykaniu drzwi
double m_radiocontroltime{ 0.0 }; // timer used to control speed of radio operations
TAction eAction { actUnknown }; // aktualny stan
TAction eAction { TAction::actUnknown }; // aktualny stan
public:
inline
TAction GetAction() {

View File

@@ -967,7 +967,7 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
}
if( ( Mechanik != nullptr )
&& ( Mechanik->GetAction() != actSleep ) ) {
&& ( Mechanik->GetAction() != TAction::actSleep ) ) {
// rysowanie figurki mechanika
btMechanik1.Turn( MoverParameters->ActiveCab > 0 );
btMechanik2.Turn( MoverParameters->ActiveCab < 0 );
@@ -1828,7 +1828,7 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
return 0.0; // zerowa długość to brak pojazdu
}
// ustawienie pozycji hamulca
MoverParameters->LocalBrakePos = 0;
MoverParameters->LocalBrakePosA = 0.0;
if (driveractive)
{
if (Cab == 0)
@@ -2299,7 +2299,7 @@ TDynamicObject::create_controller( std::string const Type, bool const Trainset )
if( asName == Global.asHumanCtrlVehicle ) {
// jeśli pojazd wybrany do prowadzenia
if( MoverParameters->EngineType != Dumb ) {
if( MoverParameters->EngineType != TEngineType::Dumb ) {
// wsadzamy tam sterującego
Controller = Humandriver;
}
@@ -2576,16 +2576,16 @@ bool TDynamicObject::UpdateForce(double dt, double dt1, bool FullVer)
// initiates load change by specified amounts, with a platform on specified side
void TDynamicObject::LoadExchange( int const Disembark, int const Embark, int const Platform ) {
if( ( MoverParameters->DoorOpenCtrl == control::passenger )
|| ( MoverParameters->DoorOpenCtrl == control::mixed ) ) {
if( ( MoverParameters->DoorOpenCtrl == control_t::passenger )
|| ( MoverParameters->DoorOpenCtrl == control_t::mixed ) ) {
// jeśli jedzie do tyłu, to drzwi otwiera odwrotnie
auto const lewe = ( DirectionGet() > 0 ) ? 1 : 2;
auto const prawe = 3 - lewe;
if( Platform & lewe ) {
MoverParameters->DoorLeft( true, range::local );
MoverParameters->DoorLeft( true, range_t::local );
}
if( Platform & prawe ) {
MoverParameters->DoorRight( true, range::local );
MoverParameters->DoorRight( true, range_t::local );
}
}
m_exchange.unload_count += Disembark;
@@ -2645,18 +2645,18 @@ void TDynamicObject::update_exchange( double const Deltatime ) {
MoverParameters->LoadStatus = 0;
// if the exchange is completed (or canceled) close the door, if applicable
if( ( MoverParameters->DoorCloseCtrl == control::passenger )
|| ( MoverParameters->DoorCloseCtrl == control::mixed ) ) {
if( ( MoverParameters->DoorCloseCtrl == control_t::passenger )
|| ( MoverParameters->DoorCloseCtrl == control_t::mixed ) ) {
if( ( MoverParameters->Vel > 2.0 )
|| ( Random() < (
// remotely controlled door are more likely to be left open
MoverParameters->DoorCloseCtrl == control::passenger ?
MoverParameters->DoorCloseCtrl == control_t::passenger ?
0.75 :
0.50 ) ) ) {
MoverParameters->DoorLeft( false, range::local );
MoverParameters->DoorRight( false, range::local );
MoverParameters->DoorLeft( false, range_t::local );
MoverParameters->DoorRight( false, range_t::local );
}
}
}
@@ -2794,7 +2794,7 @@ bool TDynamicObject::Update(double dt, double dt1)
return false; // a normalnie powinny mieć bEnabled==false
// McZapkie-260202
if ((MoverParameters->EnginePowerSource.SourceType == CurrentCollector) &&
if ((MoverParameters->EnginePowerSource.SourceType == TPowerSource::CurrentCollector) &&
(MoverParameters->Power > 1.0)) // aby rozrządczy nie opuszczał silnikowemu
/*
if ((MechInside) || (MoverParameters->TrainType == dt_EZT))
@@ -2817,7 +2817,7 @@ bool TDynamicObject::Update(double dt, double dt1)
// pressure switch safety measure -- open the line breaker, unless there's alternate source of traction voltage
if( MoverParameters->GetTrainsetVoltage() < 0.5 * MoverParameters->EnginePowerSource.MaxVoltage ) {
// TODO: check whether line breaker should be open EMU-wide
MoverParameters->MainSwitch( false, ( MoverParameters->TrainType == dt_EZT ? range::unit : range::local ) );
MoverParameters->MainSwitch( false, ( MoverParameters->TrainType == dt_EZT ? range_t::unit : range_t::local ) );
}
}
else {
@@ -2825,7 +2825,7 @@ bool TDynamicObject::Update(double dt, double dt1)
// and prevents their activation until pressure switch is set again
MoverParameters->PantPressLockActive = true;
// TODO: separate 'heating allowed' from actual heating flag, so we can disable it here without messing up heating toggle
MoverParameters->ConverterSwitch( false, range::unit );
MoverParameters->ConverterSwitch( false, range_t::unit );
}
// mark the pressure switch as spent
MoverParameters->PantPressSwitchActive = false;
@@ -2923,7 +2923,7 @@ bool TDynamicObject::Update(double dt, double dt1)
// znane napięcia
// TTractionParam tmpTraction;
// tmpTraction.TractionVoltage=0;
if (MoverParameters->EnginePowerSource.SourceType == CurrentCollector)
if (MoverParameters->EnginePowerSource.SourceType == TPowerSource::CurrentCollector)
{ // dla EZT tylko silnikowy
// if (Global.bLiveTraction)
{ // Ra 2013-12: to niżej jest chyba trochę bez sensu
@@ -2988,7 +2988,7 @@ bool TDynamicObject::Update(double dt, double dt1)
{ // Ra 2F3F: do Driver.cpp to przenieść?
MoverParameters->EqvtPipePress = GetEPP(); // srednie cisnienie w PG
if( ( Mechanik->Primary() )
&& ( MoverParameters->EngineType == ElectricInductionMotor ) ) {
&& ( MoverParameters->EngineType == TEngineType::ElectricInductionMotor ) ) {
// jesli glowny i z asynchronami, to niech steruje hamulcem lacznie dla calego pociagu/ezt
auto const kier = (DirectionGet() * MoverParameters->ActiveCab > 0);
auto FED { 0.0 };
@@ -3082,9 +3082,10 @@ bool TDynamicObject::Update(double dt, double dt1)
}
if ((Fzad > 1) && (!MEDLogFile.is_open()) && (MoverParameters->Vel > 1))
{
MEDLogFile.open(std::string("MEDLOGS/" + MoverParameters->Name + "_" + to_string(++MEDLogCount) + ".csv"),
std::ios::in | std::ios::out | std::ios::trunc);
MEDLogFile << std::string("t\tVel\tMasa\tOsie\tFmaxPN\tFmaxED\tFfulED\tFrED\tFzad\tFzadED\tFzadPN").c_str();
MEDLogFile.open(
"MEDLOGS/" + MoverParameters->Name + "_" + to_string( ++MEDLogCount ) + ".csv",
std::ios::in | std::ios::out | std::ios::trunc );
MEDLogFile << "t\tVel\tMasa\tOsie\tFmaxPN\tFmaxED\tFfulED\tFrED\tFzad\tFzadED\tFzadPN";
for(int k=1;k<=np;k++)
{
MEDLogFile << "\tBP" << k;
@@ -3095,8 +3096,8 @@ bool TDynamicObject::Update(double dt, double dt1)
MEDLogTime = 0;
}
auto FzadED { 0.0 };
if( ( MoverParameters->EpFuse && (MoverParameters->BrakeHandle != MHZ_EN57))
|| ( ( MoverParameters->BrakeHandle == MHZ_EN57 )
if( ( MoverParameters->EpFuse && (MoverParameters->BrakeHandle != TBrakeHandle::MHZ_EN57))
|| ( ( MoverParameters->BrakeHandle == TBrakeHandle::MHZ_EN57 )
&& ( MoverParameters->BrakeOpModeFlag & bom_MED ) ) ) {
FzadED = std::min( Fzad, FmaxED );
}
@@ -3280,10 +3281,10 @@ bool TDynamicObject::Update(double dt, double dt1)
// NOTE: disabled on account of multi-unit setups, where the unmanned unit wouldn't be affected
&& ( Controller == Humandriver )
*/
&& ( MoverParameters->EngineType != DieselEngine )
&& ( MoverParameters->EngineType != WheelsDriven ) )
&& ( MoverParameters->EngineType != TEngineType::DieselEngine )
&& ( MoverParameters->EngineType != TEngineType::WheelsDriven ) )
{ // jeśli bateria wyłączona, a nie diesel ani drezyna reczna
if( MoverParameters->MainSwitch( false, ( MoverParameters->TrainType == dt_EZT ? range::unit : range::local ) ) ) {
if( MoverParameters->MainSwitch( false, ( MoverParameters->TrainType == dt_EZT ? range_t::unit : range_t::local ) ) ) {
// wyłączyć zasilanie
// NOTE: we turn off entire EMU, but only the affected unit for other multi-unit consists
MoverParameters->EventFlag = true;
@@ -3625,8 +3626,8 @@ bool TDynamicObject::Update(double dt, double dt1)
}
*/
}
else if (MoverParameters->EnginePowerSource.SourceType == InternalSource)
if (MoverParameters->EnginePowerSource.PowerType == SteamPower)
else if (MoverParameters->EnginePowerSource.SourceType == TPowerSource::InternalSource)
if (MoverParameters->EnginePowerSource.PowerType == TPowerType::SteamPower)
// if (smPatykird1[0])
{ // Ra: animacja rozrządu parowozu, na razie nieoptymalizowane
/* //Ra: tymczasowo wyłączone ze względu na porządkowanie animacji
@@ -3986,7 +3987,7 @@ void TDynamicObject::RenderSounds() {
// NBMX dzwiek przetwornicy
if( MoverParameters->ConverterFlag ) {
frequency = (
MoverParameters->EngineType == ElectricSeriesMotor ?
MoverParameters->EngineType == TEngineType::ElectricSeriesMotor ?
( MoverParameters->RunningTraction.TractionVoltage / MoverParameters->NominalVoltage ) * MoverParameters->RList[ MoverParameters->RlistSize ].Mn :
1.0 );
frequency = sConverter.m_frequencyoffset + sConverter.m_frequencyfactor * frequency;
@@ -4617,7 +4618,7 @@ void TDynamicObject::LoadMMediaFile( std::string BaseDir, std::string TypeName,
}
if( !MoverParameters->LoadAccepted.empty() ) {
if( ( MoverParameters->EnginePowerSource.SourceType == CurrentCollector )
if( ( MoverParameters->EnginePowerSource.SourceType == TPowerSource::CurrentCollector )
&& ( asLoadName == "pantstate" ) ) {
// wartość niby "pantstate" - nazwa dla formalności, ważna jest ilość
if( MoverParameters->Load == 1 ) {
@@ -5075,7 +5076,7 @@ void TDynamicObject::LoadMMediaFile( std::string BaseDir, std::string TypeName,
(k)
*/
MoverParameters->EnginePowerSource.PowerType =
SteamPower; // Ra: po chamsku, ale z CHK nie działa
TPowerType::SteamPower; // Ra: po chamsku, ale z CHK nie działa
}
else if( token == "animreturnprefix:" ) {
@@ -5271,8 +5272,8 @@ void TDynamicObject::LoadMMediaFile( std::string BaseDir, std::string TypeName,
m_powertrainsounds.engine.owner( this );
auto const amplitudedivisor = static_cast<float>( (
MoverParameters->EngineType == DieselEngine ? 1 :
MoverParameters->EngineType == DieselElectric ? 1 :
MoverParameters->EngineType == TEngineType::DieselEngine ? 1 :
MoverParameters->EngineType == TEngineType::DieselElectric ? 1 :
MoverParameters->nmax * 60 + MoverParameters->Power * 3 ) );
m_powertrainsounds.engine.m_amplitudefactor /= amplitudedivisor;
}
@@ -6435,7 +6436,7 @@ TDynamicObject::powertrain_sounds::render( TMoverParameters const &Vehicle, doub
if( ( std::abs( Vehicle.enrot ) > 0.01 )
// McZapkie-280503: zeby dla dumb dzialal silnik na jalowych obrotach
|| ( Vehicle.EngineType == Dumb ) ) {
|| ( Vehicle.EngineType == TEngineType::Dumb ) ) {
// frequency calculation
auto const normalizer { (
@@ -6449,14 +6450,14 @@ TDynamicObject::powertrain_sounds::render( TMoverParameters const &Vehicle, doub
engine.m_frequencyoffset
+ engine.m_frequencyfactor * std::abs( Vehicle.enrot ) * normalizer;
if( Vehicle.EngineType == Dumb ) {
if( Vehicle.EngineType == TEngineType::Dumb ) {
frequency -= 0.2 * Vehicle.EnginePower / ( 1 + Vehicle.Power * 1000 );
}
// base volume calculation
switch( Vehicle.EngineType ) {
// TODO: check calculated values
case DieselElectric: {
case TEngineType::DieselElectric: {
volume =
engine.m_amplitudeoffset
@@ -6465,7 +6466,7 @@ TDynamicObject::powertrain_sounds::render( TMoverParameters const &Vehicle, doub
+ 0.75 * ( Vehicle.enrot * 60 ) / ( Vehicle.DElist[ Vehicle.MainCtrlPosNo ].RPM ) );
break;
}
case DieselEngine: {
case TEngineType::DieselEngine: {
if( Vehicle.enrot > 0.0 ) {
volume = (
Vehicle.EnginePower > 0 ?
@@ -6485,15 +6486,15 @@ TDynamicObject::powertrain_sounds::render( TMoverParameters const &Vehicle, doub
if( engine_volume >= 0.05 ) {
auto enginerevvolume { 0.f };
if( ( Vehicle.EngineType == DieselElectric )
|| ( Vehicle.EngineType == DieselEngine ) ) {
if( ( Vehicle.EngineType == TEngineType::DieselElectric )
|| ( Vehicle.EngineType == TEngineType::DieselEngine ) ) {
// diesel engine revolutions increase; it can potentially decrease volume of base engine sound
if( engine_revs_last != -1.f ) {
// calculate potential recent increase of engine revolutions
auto const revolutionsperminute { Vehicle.enrot * 60 };
auto const revolutionsdifference { revolutionsperminute - engine_revs_last };
auto const idlerevolutionsthreshold { 1.01 * (
Vehicle.EngineType == DieselElectric ?
Vehicle.EngineType == TEngineType::DieselElectric ?
Vehicle.DElist[ 0 ].RPM :
Vehicle.dizel_nmin * 60 ) };
@@ -6620,13 +6621,13 @@ TDynamicObject::powertrain_sounds::render( TMoverParameters const &Vehicle, doub
// base volume calculation
switch( Vehicle.EngineType ) {
case ElectricInductionMotor: {
case TEngineType::ElectricInductionMotor: {
volume =
motor.m_amplitudeoffset
+ motor.m_amplitudefactor * ( Vehicle.EnginePower + motorrevolutions * 2 );
break;
}
case ElectricSeriesMotor: {
case TEngineType::ElectricSeriesMotor: {
volume =
motor.m_amplitudeoffset
+ motor.m_amplitudefactor * ( Vehicle.EnginePower / 1000 + motorrevolutions * 60.0 );
@@ -6640,7 +6641,7 @@ TDynamicObject::powertrain_sounds::render( TMoverParameters const &Vehicle, doub
}
}
if( Vehicle.EngineType == ElectricSeriesMotor ) {
if( Vehicle.EngineType == TEngineType::ElectricSeriesMotor ) {
// volume variation
if( ( volume < 1.0 )
&& ( Vehicle.EnginePower < 100 ) ) {
@@ -6691,7 +6692,7 @@ TDynamicObject::powertrain_sounds::render( TMoverParameters const &Vehicle, doub
}
}
// inverter sounds
if( Vehicle.EngineType == ElectricInductionMotor ) {
if( Vehicle.EngineType == TEngineType::ElectricInductionMotor ) {
if( Vehicle.InverterFrequency > 0.1 ) {
volume = inverter.m_amplitudeoffset + inverter.m_amplitudefactor * std::sqrt( std::abs( Vehicle.dizel_fill ) );
@@ -6718,8 +6719,8 @@ TDynamicObject::powertrain_sounds::render( TMoverParameters const &Vehicle, doub
rsWentylator.stop();
}
// radiator fan sounds
if( ( Vehicle.EngineType == DieselEngine )
|| ( Vehicle.EngineType == DieselElectric ) ) {
if( ( Vehicle.EngineType == TEngineType::DieselEngine )
|| ( Vehicle.EngineType == TEngineType::DieselElectric ) ) {
if( Vehicle.dizel_heat.rpmw > 0.1 ) {
// NOTE: fan speed tends to max out at ~100 rpm; by default we try to get pitch range of 0.5-1.5 and volume range of 0.5-1.0
@@ -6813,7 +6814,7 @@ vehicle_table::update( double Deltatime, int Iterationcount ) {
for( auto *vehicle : m_items ) {
if( false == vehicle->bEnabled ) { continue; }
// Ra: zmienić warunek na sprawdzanie pantografów w jednej zmiennej: czy pantografy i czy podniesione
if( vehicle->MoverParameters->EnginePowerSource.SourceType == CurrentCollector ) {
if( vehicle->MoverParameters->EnginePowerSource.SourceType == TPowerSource::CurrentCollector ) {
update_traction( vehicle );
}
vehicle->MoverParameters->ComputeConstans();
@@ -6989,16 +6990,22 @@ vehicle_table::erase_disabled() {
++vehicleiter;
}
else {
if( vehicle->MyTrack != nullptr ) {
vehicle->MyTrack->RemoveDynamicObject( vehicle );
if( ( vehicle->MyTrack != nullptr )
&& ( true == vehicle->MyTrack->RemoveDynamicObject( vehicle ) ) ) {
vehicle->MyTrack = nullptr;
}
// clear potential train binding
Global.pWorld->TrainDelete( vehicle );
// remove potential entries in the light array
simulation::Lights.remove( vehicle );
/*
// finally get rid of the vehicle and its record themselves
// BUG: deleting the vehicle leaves dangling pointers in event->Activator and potentially elsewhere
// TBD, TODO: either mark 'dead' vehicles with additional flag, or delete the references as well
SafeDelete( vehicle );
vehicleiter = m_items.erase( vehicleiter );
*/
++vehicleiter; // NOTE: instead of the erase in the disabled section
}
}
// ...and call it a day

View File

@@ -297,37 +297,37 @@ void TEvent::Load(cParser *parser, Math3D::vector3 const &org)
if (token.find('#') != std::string::npos)
token.erase(token.find('#')); // obcięcie unikatowości
win1250_to_ascii( token ); // get rid of non-ascii chars
Params[6].asCommand = cm_PassengerStopPoint;
Params[6].asCommand = TCommandType::cm_PassengerStopPoint;
// nie do kolejki (dla SetVelocity też, ale jak jest do toru dowiązany)
bEnabled = false;
}
else if (token == "SetVelocity")
{
bEnabled = false;
Params[6].asCommand = cm_SetVelocity;
Params[6].asCommand = TCommandType::cm_SetVelocity;
}
else if (token == "RoadVelocity")
{
bEnabled = false;
Params[6].asCommand = cm_RoadVelocity;
Params[6].asCommand = TCommandType::cm_RoadVelocity;
}
else if (token == "SectionVelocity")
{
bEnabled = false;
Params[6].asCommand = cm_SectionVelocity;
Params[6].asCommand = TCommandType::cm_SectionVelocity;
}
else if (token == "ShuntVelocity")
{
bEnabled = false;
Params[6].asCommand = cm_ShuntVelocity;
Params[6].asCommand = TCommandType::cm_ShuntVelocity;
}
else if (token == "OutsideStation")
{
bEnabled = false; // ma być skanowny, aby AI nie przekraczało W5
Params[6].asCommand = cm_OutsideStation;
Params[6].asCommand = TCommandType::cm_OutsideStation;
}
else
Params[6].asCommand = cm_Unknown;
Params[6].asCommand = TCommandType::cm_Unknown;
Params[0].asText = new char[token.size() + 1];
strcpy(Params[0].asText, token.c_str());
parser->getTokens();
@@ -817,7 +817,7 @@ TCommandType TEvent::Command()
case tp_PutValues:
return Params[6].asCommand; // komenda zakodowana binarnie
}
return cm_Unknown; // inne eventy się nie liczą
return TCommandType::cm_Unknown; // inne eventy się nie liczą
};
double TEvent::ValueGet(int n)

View File

@@ -45,7 +45,7 @@ void TGauge::Init(TSubModel *Submodel, TGaugeType Type, float Scale, float Offse
return;
}
if( m_type == gt_Digital ) {
if( m_type == TGaugeType::gt_Digital ) {
TSubModel *sm = SubModel->ChildGet();
do {
@@ -148,18 +148,18 @@ bool TGauge::Load( cParser &Parser, TDynamicObject const *Owner, TModel3d *md1,
}
std::map<std::string, TGaugeType> gaugetypes {
{ "rot", gt_Rotate },
{ "rotvar", gt_Rotate },
{ "mov", gt_Move },
{ "movvar", gt_Move },
{ "wip", gt_Wiper },
{ "dgt", gt_Digital }
{ "rot", TGaugeType::gt_Rotate },
{ "rotvar", TGaugeType::gt_Rotate },
{ "mov", TGaugeType::gt_Move },
{ "movvar", TGaugeType::gt_Move },
{ "wip", TGaugeType::gt_Wiper },
{ "dgt", TGaugeType::gt_Digital }
};
auto lookup = gaugetypes.find( gaugetypename );
auto const type = (
lookup != gaugetypes.end() ?
lookup->second :
gt_Unknown );
TGaugeType::gt_Unknown );
Init( submodel, type, scale, offset, friction, 0, endvalue, endscale, interpolatescale );
@@ -228,16 +228,16 @@ TGauge::UpdateValue( float fNewDesired, sound_source *Fallbacksound ) {
if( ( currentvalue < fNewDesired )
&& ( false == m_soundfxincrease.empty() ) ) {
// shift up
m_soundfxincrease.play();
m_soundfxincrease.play( sound_flags::exclusive );
}
else if( ( currentvalue > fNewDesired )
&& ( false == m_soundfxdecrease.empty() ) ) {
// shift down
m_soundfxdecrease.play();
m_soundfxdecrease.play( sound_flags::exclusive );
}
else if( Fallbacksound != nullptr ) {
// ...and if that fails too, try the provided fallback sound from legacy system
Fallbacksound->play();
Fallbacksound->play( sound_flags::exclusive );
}
};
@@ -276,15 +276,15 @@ void TGauge::Update() {
if( SubModel )
{ // warunek na wszelki wypadek, gdyby się submodel nie podłączył
switch (m_type) {
case gt_Rotate: {
case TGaugeType::gt_Rotate: {
SubModel->SetRotate( float3( 0, 1, 0 ), GetScaledValue() * 360.0 );
break;
}
case gt_Move: {
case TGaugeType::gt_Move: {
SubModel->SetTranslate( float3( 0, 0, GetScaledValue() ) );
break;
}
case gt_Wiper: {
case TGaugeType::gt_Wiper: {
auto const scaledvalue { GetScaledValue() };
SubModel->SetRotate( float3( 0, 1, 0 ), scaledvalue * 360.0 );
auto *sm = SubModel->ChildGet();
@@ -296,7 +296,7 @@ void TGauge::Update() {
}
break;
}
case gt_Digital: {
case TGaugeType::gt_Digital: {
// Ra 2014-07: licznik cyfrowy
auto *sm = SubModel->ChildGet();
/* std::string n = FormatFloat( "0000000000", floor( fValue ) ); // na razie tak trochę bez sensu

View File

@@ -12,7 +12,7 @@ http://mozilla.org/MPL/2.0/.
#include "Classes.h"
#include "sound.h"
enum TGaugeType {
enum class TGaugeType {
// typ ruchu
gt_Unknown, // na razie nie znany
gt_Rotate, // obrót
@@ -60,7 +60,7 @@ private:
GetScaledValue() const;
// members
TGaugeType m_type { gt_Unknown }; // typ ruchu
TGaugeType m_type { TGaugeType::gt_Unknown }; // typ ruchu
float m_friction { 0.f }; // hamowanie przy zliżaniu się do zadanej wartości
float m_targetvalue { 0.f }; // wartość docelowa
float m_value { 0.f }; // wartość obecna

View File

@@ -156,13 +156,13 @@ enum coupling {
uic = 0x100
};
// possible effect ranges for control commands; exclusive
enum range {
enum class range_t {
local,
unit,
consist
};
// start method for devices; exclusive
enum start {
enum class start_t {
manual,
automatic,
manualwithautofallback,
@@ -180,7 +180,7 @@ enum light {
};
// door operation methods; exclusive
enum control {
enum control_t {
passenger, // local, opened/closed for duration of loading
driver, // remote, operated by the driver
autonomous, // local, closed when vehicle moves and/or after timeout
@@ -351,13 +351,13 @@ struct TTractionParam
/*powyzsze parametry zwiazane sa z torem po ktorym aktualnie pojazd jedzie*/
/*typy hamulcow zespolonych*/
enum TBrakeSystem { Individual, Pneumatic, ElectroPneumatic };
enum class TBrakeSystem { Individual, Pneumatic, ElectroPneumatic };
/*podtypy hamulcow zespolonych*/
enum TBrakeSubSystem { ss_None, ss_W, ss_K, ss_KK, ss_Hik, ss_ESt, ss_KE, ss_LSt, ss_MT, ss_Dako };
enum TBrakeValve { NoValve, W, W_Lu_VI, W_Lu_L, W_Lu_XR, K, Kg, Kp, Kss, Kkg, Kkp, Kks, Hikg1, Hikss, Hikp1, KE, SW, EStED, NESt3, ESt3, LSt, ESt4, ESt3AL2, EP1, EP2, M483, CV1_L_TR, CV1, CV1_R, Other };
enum TBrakeHandle { NoHandle, West, FV4a, M394, M254, FVel1, FVel6, D2, Knorr, FD1, BS2, testH, St113, MHZ_P, MHZ_T, MHZ_EN57, MHZ_K5P };
enum class TBrakeSubSystem { ss_None, ss_W, ss_K, ss_KK, ss_Hik, ss_ESt, ss_KE, ss_LSt, ss_MT, ss_Dako };
enum class TBrakeValve { NoValve, W, W_Lu_VI, W_Lu_L, W_Lu_XR, K, Kg, Kp, Kss, Kkg, Kkp, Kks, Hikg1, Hikss, Hikp1, KE, SW, EStED, NESt3, ESt3, LSt, ESt4, ESt3AL2, EP1, EP2, M483, CV1_L_TR, CV1, CV1_R, Other };
enum class TBrakeHandle { NoHandle, West, FV4a, M394, M254, FVel1, FVel6, D2, Knorr, FD1, BS2, testH, St113, MHZ_P, MHZ_T, MHZ_EN57, MHZ_K5P };
/*typy hamulcow indywidualnych*/
enum TLocalBrake { NoBrake, ManualBrake, PneumaticBrake, HydraulicBrake };
enum class TLocalBrake { NoBrake, ManualBrake, PneumaticBrake, HydraulicBrake };
/*dla osob/towar: opoznienie hamowania/odhamowania*/
typedef double TBrakeDelayTable[4];
@@ -366,17 +366,17 @@ struct TBrakePressure
double PipePressureVal = 0.0;
double BrakePressureVal = 0.0;
double FlowSpeedVal = 0.0;
TBrakeSystem BrakeType = Pneumatic;
TBrakeSystem BrakeType = TBrakeSystem::Pneumatic;
};
typedef std::map<int,TBrakePressure> TBrakePressureTable;
/*typy napedow*/
enum TEngineTypes { None, Dumb, WheelsDriven, ElectricSeriesMotor, ElectricInductionMotor, DieselEngine, SteamEngine, DieselElectric };
enum class TEngineType { None, Dumb, WheelsDriven, ElectricSeriesMotor, ElectricInductionMotor, DieselEngine, SteamEngine, DieselElectric };
/*postac dostarczanej energii*/
enum TPowerType { NoPower, BioPower, MechPower, ElectricPower, SteamPower };
enum class TPowerType { NoPower, BioPower, MechPower, ElectricPower, SteamPower };
/*rodzaj paliwa*/
enum TFuelType { Undefined, Coal, Oil };
enum class TFuelType { Undefined, Coal, Oil };
/*rodzaj rusztu*/
struct TGrateType {
TFuelType FuelType;
@@ -425,7 +425,7 @@ struct TCurrentCollector {
//}
};
/*typy źródeł mocy*/
enum TPowerSource { NotDefined, InternalSource, Transducer, Generator, Accumulator, CurrentCollector, PowerCable, Heater };
enum class TPowerSource { NotDefined, InternalSource, Transducer, Generator, Accumulator, CurrentCollector, PowerCable, Heater };
struct _mover__1
@@ -481,7 +481,7 @@ struct TPowerParameters
};
struct
{
TEngineTypes GeneratorEngine;
TEngineType GeneratorEngine;
};
struct
{
@@ -498,9 +498,9 @@ struct TPowerParameters
MaxVoltage = 0.0;
MaxCurrent = 0.0;
IntR = 0.001;
SourceType = NotDefined;
PowerType = NoPower;
RPowerCable.PowerTrans = NoPower;
SourceType = TPowerSource::NotDefined;
PowerType = TPowerType::NoPower;
RPowerCable.PowerTrans = TPowerType::NoPower;
}
};
@@ -584,7 +584,7 @@ struct TTransmision
double Ratio = 1.0;
};
enum TCouplerType { NoCoupler, Articulated, Bare, Chain, Screw, Automatic };
enum class TCouplerType { NoCoupler, Articulated, Bare, Chain, Screw, Automatic };
struct power_coupling {
double current{ 0.0 };
@@ -601,7 +601,7 @@ struct TCoupling {
double FmaxB = 1000.0;
double DmaxC = 0.1;
double FmaxC = 1000.0;
TCouplerType CouplerType = NoCoupler; /*typ sprzegu*/
TCouplerType CouplerType = TCouplerType::NoCoupler; /*typ sprzegu*/
/*zmienne*/
int CouplingFlag = 0; /*0 - wirtualnie, 1 - sprzegi, 2 - pneumatycznie, 4 - sterowanie, 8 - kabel mocy*/
int AllowedFlag = 3; //Ra: znaczenie jak wyżej, maska dostępnych
@@ -625,7 +625,7 @@ struct fuel_pump {
bool is_enabled { false }; // device is allowed/requested to operate
bool is_active { false }; // device is working
start start_type { start::manual };
start_t start_type { start_t::manual };
};
// basic approximation of a fuel pump
@@ -634,7 +634,7 @@ struct oil_pump {
bool is_enabled { false }; // device is allowed/requested to operate
bool is_active { false }; // device is working
start start_type { start::manual };
start_t start_type { start_t::manual };
float resource_amount { 1.f };
float pressure_minimum { 0.f }; // lowest acceptable working pressure
float pressure_maximum { 0.65f }; // oil pressure at maximum engine revolutions
@@ -647,7 +647,7 @@ struct water_pump {
bool breaker { true }; // device is allowed to operate
bool is_enabled { false }; // device is requested to operate
bool is_active { false }; // device is working
start start_type { start::manual };
start_t start_type { start_t::manual };
};
struct water_heater {
@@ -728,7 +728,7 @@ public:
std::string TypeName; /*nazwa serii/typu*/
//TrainType: string; {typ: EZT/elektrowoz - Winger 040304}
int TrainType = 0; /*Ra: powinno być szybciej niż string*/
TEngineTypes EngineType = None; /*typ napedu*/
TEngineType EngineType = TEngineType::None; /*typ napedu*/
TPowerParameters EnginePowerSource; /*zrodlo mocy dla silnikow*/
TPowerParameters SystemPowerSource; /*zrodlo mocy dla systemow sterowania/przetwornic/sprezarek*/
TPowerParameters HeatingPowerSource; /*zrodlo mocy dla ogrzewania*/
@@ -766,11 +766,11 @@ public:
/*hamulce:*/
int NBpA = 0; /*ilosc el. ciernych na os: 0 1 2 lub 4*/
int SandCapacity = 0; /*zasobnik piasku [kg]*/
TBrakeSystem BrakeSystem = Individual;/*rodzaj hamulca zespolonego*/
TBrakeSubSystem BrakeSubsystem = ss_None ;
TBrakeValve BrakeValve = NoValve;
TBrakeHandle BrakeHandle = NoHandle;
TBrakeHandle BrakeLocHandle = NoHandle;
TBrakeSystem BrakeSystem = TBrakeSystem::Individual;/*rodzaj hamulca zespolonego*/
TBrakeSubSystem BrakeSubsystem = TBrakeSubSystem::ss_None ;
TBrakeValve BrakeValve = TBrakeValve::NoValve;
TBrakeHandle BrakeHandle = TBrakeHandle::NoHandle;
TBrakeHandle BrakeLocHandle = TBrakeHandle::NoHandle;
double MBPM = 1.0; /*masa najwiekszego cisnienia*/
std::shared_ptr<TBrake> Hamulec;
@@ -779,7 +779,7 @@ public:
std::shared_ptr<TReservoir> Pipe;
std::shared_ptr<TReservoir> Pipe2;
TLocalBrake LocalBrake = NoBrake; /*rodzaj hamulca indywidualnego*/
TLocalBrake LocalBrake = TLocalBrake::NoBrake; /*rodzaj hamulca indywidualnego*/
TBrakePressureTable BrakePressureTable; /*wyszczegolnienie cisnien w rurze*/
TBrakePressure BrakePressureActual; //wartości ważone dla aktualnej pozycji kranu
int ASBType = 0; /*0: brak hamulca przeciwposlizgowego, 1: reczny, 2: automat*/
@@ -1006,9 +1006,9 @@ public:
bool CompressorAllow = false; /*! zezwolenie na uruchomienie sprezarki NBMX*/
bool CompressorAllowLocal{ true }; // local device state override (most units don't have this fitted so it's set to true not to intefere)
bool CompressorGovernorLock{ false }; // indicates whether compressor pressure switch was activated due to reaching cut-out pressure
start CompressorStart{ start::manual }; // whether the compressor is started manually, or another way
start_t CompressorStart{ start_t::manual }; // whether the compressor is started manually, or another way
// TODO converter parameters, for when we start cleaning up mover parameters
start ConverterStart{ start::manual }; // whether converter is started manually, or by other means
start_t ConverterStart{ start_t::manual }; // whether converter is started manually, or by other means
float ConverterStartDelay{ 0.0f }; // delay (in seconds) before the converter is started, once its activation conditions are met
double ConverterStartDelayTimer{ 0.0 }; // helper, for tracking whether converter start delay passed
bool ConverterAllow = false; /*zezwolenie na prace przetwornicy NBMX*/
@@ -1024,7 +1024,6 @@ public:
int BrakeCtrlPos = -2; /*nastawa hamulca zespolonego*/
double BrakeCtrlPosR = 0.0; /*nastawa hamulca zespolonego - plynna dla FV4a*/
double BrakeCtrlPos2 = 0.0; /*nastawa hamulca zespolonego - kapturek dla FV4a*/
int LocalBrakePos = 0; /*nastawa hamulca indywidualnego*/
int ManualBrakePos = 0; /*nastawa hamulca recznego*/
double LocalBrakePosA = 0.0;
/*
@@ -1250,7 +1249,7 @@ public:
bool AddPulseForce(int Multipler);/*dla drezyny*/
bool Sandbox( bool const State, int const Notify = range::consist );/*wlacza/wylacza sypanie piasku*/
bool Sandbox( bool const State, range_t const Notify = range_t::consist );/*wlacza/wylacza sypanie piasku*/
/*! zbijanie czuwaka/SHP*/
void SSReset(void);
@@ -1263,11 +1262,9 @@ public:
/*! stopnie hamowania - hamulec zasadniczy*/
bool IncBrakeLevelOld(void);
bool DecBrakeLevelOld(void);
bool IncLocalBrakeLevel(int CtrlSpeed);
bool DecLocalBrakeLevel(int CtrlSpeed);
bool IncLocalBrakeLevel(float const CtrlSpeed);
bool DecLocalBrakeLevel(float const CtrlSpeed);
/*! ABu 010205: - skrajne polozenia ham. pomocniczego*/
bool IncLocalBrakeLevelFAST(void);
bool DecLocalBrakeLevelFAST(void);
bool IncManualBrakeLevel(int CtrlSpeed);
bool DecManualBrakeLevel(int CtrlSpeed);
bool DynamicBrakeSwitch(bool Switch);
@@ -1309,16 +1306,16 @@ public:
/*--funkcje dla lokomotyw*/
bool DirectionBackward(void);/*! kierunek ruchu*/
bool WaterPumpBreakerSwitch( bool State, int const Notify = range::consist ); // water pump breaker state toggle
bool WaterPumpSwitch( bool State, int const Notify = range::consist ); // water pump state toggle
bool WaterHeaterBreakerSwitch( bool State, int const Notify = range::consist ); // water heater breaker state toggle
bool WaterHeaterSwitch( bool State, int const Notify = range::consist ); // water heater state toggle
bool WaterCircuitsLinkSwitch( bool State, int const Notify = range::consist ); // water circuits link state toggle
bool FuelPumpSwitch( bool State, int const Notify = range::consist ); // fuel pump state toggle
bool OilPumpSwitch( bool State, int const Notify = range::consist ); // oil pump state toggle
bool MainSwitch( bool const State, int const Notify = range::consist );/*! wylacznik glowny*/
bool ConverterSwitch( bool State, int const Notify = range::consist );/*! wl/wyl przetwornicy*/
bool CompressorSwitch( bool State, int const Notify = range::consist );/*! wl/wyl sprezarki*/
bool WaterPumpBreakerSwitch( bool State, range_t const Notify = range_t::consist ); // water pump breaker state toggle
bool WaterPumpSwitch( bool State, range_t const Notify = range_t::consist ); // water pump state toggle
bool WaterHeaterBreakerSwitch( bool State, range_t const Notify = range_t::consist ); // water heater breaker state toggle
bool WaterHeaterSwitch( bool State, range_t const Notify = range_t::consist ); // water heater state toggle
bool WaterCircuitsLinkSwitch( bool State, range_t const Notify = range_t::consist ); // water circuits link state toggle
bool FuelPumpSwitch( bool State, range_t const Notify = range_t::consist ); // fuel pump state toggle
bool OilPumpSwitch( bool State, range_t const Notify = range_t::consist ); // oil pump state toggle
bool MainSwitch( bool const State, range_t const Notify = range_t::consist );/*! wylacznik glowny*/
bool ConverterSwitch( bool State, range_t const Notify = range_t::consist );/*! wl/wyl przetwornicy*/
bool CompressorSwitch( bool State, range_t const Notify = range_t::consist );/*! wl/wyl sprezarki*/
/*-funkcje typowe dla lokomotywy elektrycznej*/
void ConverterCheck( double const Timestep ); // przetwornica
@@ -1348,8 +1345,8 @@ public:
bool AutoRelayCheck(void);//symulacja automatycznego rozruchu
bool ResistorsFlagCheck(void); //sprawdzenie kontrolki oporow rozruchowych NBMX
bool PantFront( bool const State, int const Notify = range::consist ); //obsluga pantografou przedniego
bool PantRear( bool const State, int const Notify = range::consist ); //obsluga pantografu tylnego
bool PantFront( bool const State, range_t const Notify = range_t::consist ); //obsluga pantografou przedniego
bool PantRear( bool const State, range_t const Notify = range_t::consist ); //obsluga pantografu tylnego
/*-funkcje typowe dla lokomotywy spalinowej z przekladnia mechaniczna*/
bool dizel_EngageSwitch(double state);
@@ -1364,10 +1361,10 @@ public:
/* funckje dla wagonow*/
bool LoadingDone(double LSpeed, std::string LoadInit);
bool DoorLeft(bool State, int const Notify = range::consist ); //obsluga drzwi lewych
bool DoorRight(bool State, int const Notify = range::consist ); //obsluga drzwi prawych
bool DoorLeft(bool State, range_t const Notify = range_t::consist ); //obsluga drzwi lewych
bool DoorRight(bool State, range_t const Notify = range_t::consist ); //obsluga drzwi prawych
bool DoorBlockedFlag(void); //sprawdzenie blokady drzwi
bool signal_departure( bool const State, int const Notify = range::consist ); // toggles departure warning
bool signal_departure( bool const State, range_t const Notify = range_t::consist ); // toggles departure warning
void update_autonomous_doors( double const Deltatime ); // automatic door controller update
/* funkcje dla samochodow*/
@@ -1403,7 +1400,7 @@ private:
void LoadFIZ_PowerParamsDecode( TPowerParameters &Powerparameters, std::string const Prefix, std::string const &Input );
TPowerType LoadFIZ_PowerDecode( std::string const &Power );
TPowerSource LoadFIZ_SourceDecode( std::string const &Source );
TEngineTypes LoadFIZ_EngineDecode( std::string const &Engine );
TEngineType LoadFIZ_EngineDecode( std::string const &Engine );
bool readMPT0( std::string const &line );
bool readMPT( std::string const &line ); //Q 20160717
bool readMPTElectricSeries( std::string const &line );

File diff suppressed because it is too large Load Diff

View File

@@ -51,37 +51,37 @@ TCommandType TMemCell::CommandCheck()
{ // rozpoznanie komendy
if( szText == "SetVelocity" ) // najpopularniejsze
{
eCommand = cm_SetVelocity;
eCommand = TCommandType::cm_SetVelocity;
bCommand = false; // ta komenda nie jest wysyłana
}
else if( szText == "ShuntVelocity" ) // w tarczach manewrowych
{
eCommand = cm_ShuntVelocity;
eCommand = TCommandType::cm_ShuntVelocity;
bCommand = false; // ta komenda nie jest wysyłana
}
else if( szText == "Change_direction" ) // zdarza się
{
eCommand = cm_ChangeDirection;
eCommand = TCommandType::cm_ChangeDirection;
bCommand = true; // do wysłania
}
else if( szText == "OutsideStation" ) // zdarza się
{
eCommand = cm_OutsideStation;
eCommand = TCommandType::cm_OutsideStation;
bCommand = false; // tego nie powinno być w komórce
}
else if( szText.compare( 0, 19, "PassengerStopPoint:" ) == 0 ) // porównanie początków
{
eCommand = cm_PassengerStopPoint;
eCommand = TCommandType::cm_PassengerStopPoint;
bCommand = false; // tego nie powinno być w komórce
}
else if( szText == "SetProximityVelocity" ) // nie powinno tego być
{
eCommand = cm_SetProximityVelocity;
eCommand = TCommandType::cm_SetProximityVelocity;
bCommand = false; // ta komenda nie jest wysyłana
}
else
{
eCommand = cm_Unknown; // ciąg nierozpoznany (nie jest komendą)
eCommand = TCommandType::cm_Unknown; // ciąg nierozpoznany (nie jest komendą)
bCommand = true; // do wysłania
}
return eCommand;
@@ -141,11 +141,11 @@ bool TMemCell::Compare( std::string const &szTestText, double const fTestValue1,
bool TMemCell::IsVelocity() const
{ // sprawdzenie, czy event odczytu tej komórki ma być do skanowania, czy do kolejkowania
if (eCommand == cm_SetVelocity)
if (eCommand == TCommandType::cm_SetVelocity)
return true;
if (eCommand == cm_ShuntVelocity)
if (eCommand == TCommandType::cm_ShuntVelocity)
return true;
return (eCommand == cm_SetProximityVelocity);
return (eCommand == TCommandType::cm_SetProximityVelocity);
};
void TMemCell::StopCommandSent()

View File

@@ -64,7 +64,7 @@ private:
double fValue1 { 0.0 };
double fValue2 { 0.0 };
// other
TCommandType eCommand { cm_Unknown };
TCommandType eCommand { TCommandType::cm_Unknown };
bool bCommand { false }; // czy zawiera komendę dla zatrzymanego AI
TEvent *OnSent { nullptr }; // event dodawany do kolejki po wysłaniu komendy zatrzymującej skład
};

View File

@@ -107,22 +107,6 @@ int TSubModel::SeekFaceNormal(std::vector<unsigned int> const &Masks, int const
float emm1[] = { 1, 1, 1, 0 };
float emm2[] = { 0, 0, 0, 1 };
inline double readIntAsDouble(cParser &parser, int base = 255)
{
int value = parser.getToken<int>(false);
return (static_cast<double>(value) / base);
};
template <typename ColorT> inline void readColor(cParser &parser, ColorT *color)
{
double discard;
parser.getTokens(4, false);
parser >> discard >> color[0] >> color[1] >> color[2];
color[ 0 ] /= 255.0;
color[ 1 ] /= 255.0;
color[ 2 ] /= 255.0;
};
inline void readColor(cParser &parser, glm::vec4 &color)
{
int discard;
@@ -192,41 +176,41 @@ int TSubModel::Load( cParser &parser, TModel3d *Model, /*int Pos,*/ bool dynamic
{
iFlags |= 0x4000; // jak animacja, to trzeba przechowywać macierz zawsze
if (type == "seconds_jump")
b_Anim = b_aAnim = at_SecondsJump; // sekundy z przeskokiem
b_Anim = b_aAnim = TAnimType::at_SecondsJump; // sekundy z przeskokiem
else if (type == "minutes_jump")
b_Anim = b_aAnim = at_MinutesJump; // minuty z przeskokiem
b_Anim = b_aAnim = TAnimType::at_MinutesJump; // minuty z przeskokiem
else if (type == "hours_jump")
b_Anim = b_aAnim = at_HoursJump; // godziny z przeskokiem
b_Anim = b_aAnim = TAnimType::at_HoursJump; // godziny z przeskokiem
else if (type == "hours24_jump")
b_Anim = b_aAnim = at_Hours24Jump; // godziny z przeskokiem
b_Anim = b_aAnim = TAnimType::at_Hours24Jump; // godziny z przeskokiem
else if (type == "seconds")
b_Anim = b_aAnim = at_Seconds; // minuty płynnie
b_Anim = b_aAnim = TAnimType::at_Seconds; // minuty płynnie
else if (type == "minutes")
b_Anim = b_aAnim = at_Minutes; // minuty płynnie
b_Anim = b_aAnim = TAnimType::at_Minutes; // minuty płynnie
else if (type == "hours")
b_Anim = b_aAnim = at_Hours; // godziny płynnie
b_Anim = b_aAnim = TAnimType::at_Hours; // godziny płynnie
else if (type == "hours24")
b_Anim = b_aAnim = at_Hours24; // godziny płynnie
b_Anim = b_aAnim = TAnimType::at_Hours24; // godziny płynnie
else if (type == "billboard")
b_Anim = b_aAnim = at_Billboard; // obrót w pionie do kamery
b_Anim = b_aAnim = TAnimType::at_Billboard; // obrót w pionie do kamery
else if (type == "wind")
b_Anim = b_aAnim = at_Wind; // ruch pod wpływem wiatru
b_Anim = b_aAnim = TAnimType::at_Wind; // ruch pod wpływem wiatru
else if (type == "sky")
b_Anim = b_aAnim = at_Sky; // aniamacja nieba
b_Anim = b_aAnim = TAnimType::at_Sky; // aniamacja nieba
else if (type == "ik")
b_Anim = b_aAnim = at_IK; // IK: zadający
b_Anim = b_aAnim = TAnimType::at_IK; // IK: zadający
else if (type == "ik11")
b_Anim = b_aAnim = at_IK11; // IK: kierunkowany
b_Anim = b_aAnim = TAnimType::at_IK11; // IK: kierunkowany
else if (type == "ik21")
b_Anim = b_aAnim = at_IK21; // IK: kierunkowany
b_Anim = b_aAnim = TAnimType::at_IK21; // IK: kierunkowany
else if (type == "ik22")
b_Anim = b_aAnim = at_IK22; // IK: kierunkowany
b_Anim = b_aAnim = TAnimType::at_IK22; // IK: kierunkowany
else if (type == "digital")
b_Anim = b_aAnim = at_Digital; // licznik mechaniczny
b_Anim = b_aAnim = TAnimType::at_Digital; // licznik mechaniczny
else if (type == "digiclk")
b_Anim = b_aAnim = at_DigiClk; // zegar cyfrowy
b_Anim = b_aAnim = TAnimType::at_DigiClk; // zegar cyfrowy
else
b_Anim = b_aAnim = at_Undefined; // nieznana forma animacji
b_Anim = b_aAnim = TAnimType::at_Undefined; // nieznana forma animacji
}
}
if (eType < TP_ROTATOR)
@@ -281,19 +265,16 @@ int TSubModel::Load( cParser &parser, TModel3d *Model, /*int Pos,*/ bool dynamic
else if (eType < TP_ROTATOR)
{
std::string discard;
parser.getTokens(5, false);
parser.getTokens(6, false);
parser
>> discard >> bWire
>> discard >> fWireSize
>> discard;
>> discard >> Opacity;
// wymagane jest 0 dla szyb, 100 idzie w nieprzezroczyste
Opacity = readIntAsDouble(parser, 100.0f);
if (Opacity > 1.0f)
Opacity *= 0.01f; // w 2013 był błąd i aby go obejść, trzeba było wpisać 10000.0
/*
if ((Global.iConvertModels & 1) == 0) // dla zgodności wstecz
Opacity = 0.0; // wszystko idzie w przezroczyste albo zależnie od tekstury
*/
if( Opacity > 1.f ) {
Opacity = std::min( 1.f, Opacity * 0.01f );
}
if (!parser.expectToken("map:"))
Error("Model map parse failure!");
std::string material = parser.getToken<std::string>();
@@ -793,8 +774,8 @@ void TSubModel::SetRotate(float3 vNewRotateAxis, float fNewAngle)
f_Angle = fNewAngle;
if (fNewAngle != 0.0)
{
b_Anim = at_Rotate;
b_aAnim = at_Rotate;
b_Anim = TAnimType::at_Rotate;
b_aAnim = TAnimType::at_Rotate;
}
iAnimOwner = iInstance; // zapamiętanie czyja jest animacja
}
@@ -804,8 +785,8 @@ void TSubModel::SetRotateXYZ(float3 vNewAngles)
// podane kąty wokół osi
// lokalnego układu
v_Angles = vNewAngles;
b_Anim = at_RotateXYZ;
b_aAnim = at_RotateXYZ;
b_Anim = TAnimType::at_RotateXYZ;
b_aAnim = TAnimType::at_RotateXYZ;
iAnimOwner = iInstance; // zapamiętanie czyja jest animacja
}
@@ -816,16 +797,16 @@ void TSubModel::SetRotateXYZ( Math3D::vector3 vNewAngles)
v_Angles.x = vNewAngles.x;
v_Angles.y = vNewAngles.y;
v_Angles.z = vNewAngles.z;
b_Anim = at_RotateXYZ;
b_aAnim = at_RotateXYZ;
b_Anim = TAnimType::at_RotateXYZ;
b_aAnim = TAnimType::at_RotateXYZ;
iAnimOwner = iInstance; // zapamiętanie czyja jest animacja
}
void TSubModel::SetTranslate(float3 vNewTransVector)
{ // przesunięcie submodelu (np. w kabinie)
v_TransVector = vNewTransVector;
b_Anim = at_Translate;
b_aAnim = at_Translate;
b_Anim = TAnimType::at_Translate;
b_aAnim = TAnimType::at_Translate;
iAnimOwner = iInstance; // zapamiętanie czyja jest animacja
}
@@ -834,8 +815,8 @@ void TSubModel::SetTranslate( Math3D::vector3 vNewTransVector)
v_TransVector.x = vNewTransVector.x;
v_TransVector.y = vNewTransVector.y;
v_TransVector.z = vNewTransVector.z;
b_Anim = at_Translate;
b_aAnim = at_Translate;
b_Anim = TAnimType::at_Translate;
b_aAnim = TAnimType::at_Translate;
iAnimOwner = iInstance; // zapamiętanie czyja jest animacja
}
@@ -891,17 +872,17 @@ void TSubModel::RaAnimation(TAnimType a)
{ // wykonanie animacji niezależnie od renderowania
switch (a)
{ // korekcja położenia, jeśli submodel jest animowany
case at_Translate: // Ra: było "true"
case TAnimType::at_Translate: // Ra: było "true"
if (iAnimOwner != iInstance)
break; // cudza animacja
glTranslatef(v_TransVector.x, v_TransVector.y, v_TransVector.z);
break;
case at_Rotate: // Ra: było "true"
case TAnimType::at_Rotate: // Ra: było "true"
if (iAnimOwner != iInstance)
break; // cudza animacja
glRotatef(f_Angle, v_RotateAxis.x, v_RotateAxis.y, v_RotateAxis.z);
break;
case at_RotateXYZ:
case TAnimType::at_RotateXYZ:
if (iAnimOwner != iInstance)
break; // cudza animacja
glTranslatef(v_TransVector.x, v_TransVector.y, v_TransVector.z);
@@ -909,31 +890,31 @@ void TSubModel::RaAnimation(TAnimType a)
glRotatef(v_Angles.y, 0.0f, 1.0f, 0.0f);
glRotatef(v_Angles.z, 0.0f, 0.0f, 1.0f);
break;
case at_SecondsJump: // sekundy z przeskokiem
case TAnimType::at_SecondsJump: // sekundy z przeskokiem
glRotatef(simulation::Time.data().wSecond * 6.0, 0.0, 1.0, 0.0);
break;
case at_MinutesJump: // minuty z przeskokiem
case TAnimType::at_MinutesJump: // minuty z przeskokiem
glRotatef(simulation::Time.data().wMinute * 6.0, 0.0, 1.0, 0.0);
break;
case at_HoursJump: // godziny skokowo 12h/360°
case TAnimType::at_HoursJump: // godziny skokowo 12h/360°
glRotatef(simulation::Time.data().wHour * 30.0 * 0.5, 0.0, 1.0, 0.0);
break;
case at_Hours24Jump: // godziny skokowo 24h/360°
case TAnimType::at_Hours24Jump: // godziny skokowo 24h/360°
glRotatef(simulation::Time.data().wHour * 15.0 * 0.25, 0.0, 1.0, 0.0);
break;
case at_Seconds: // sekundy płynnie
case TAnimType::at_Seconds: // sekundy płynnie
glRotatef(simulation::Time.second() * 6.0, 0.0, 1.0, 0.0);
break;
case at_Minutes: // minuty płynnie
case TAnimType::at_Minutes: // minuty płynnie
glRotatef(simulation::Time.data().wMinute * 6.0 + simulation::Time.second() * 0.1, 0.0, 1.0, 0.0);
break;
case at_Hours: // godziny płynnie 12h/360°
case TAnimType::at_Hours: // godziny płynnie 12h/360°
glRotatef(2.0 * Global.fTimeAngleDeg, 0.0, 1.0, 0.0);
break;
case at_Hours24: // godziny płynnie 24h/360°
case TAnimType::at_Hours24: // godziny płynnie 24h/360°
glRotatef(Global.fTimeAngleDeg, 0.0, 1.0, 0.0);
break;
case at_Billboard: // obrót w pionie do kamery
case TAnimType::at_Billboard: // obrót w pionie do kamery
{
Math3D::matrix4x4 mat; mat.OpenGL_Matrix( OpenGLMatrices.data_array( GL_MODELVIEW ) );
float3 gdzie = float3(mat[3][0], mat[3][1], mat[3][2]); // początek układu współrzędnych submodelu względem kamery
@@ -944,19 +925,19 @@ void TSubModel::RaAnimation(TAnimType a)
0.0); // jedynie obracamy w pionie o kąt
}
break;
case at_Wind: // ruch pod wpływem wiatru (wiatr będziemy liczyć potem...)
case TAnimType::at_Wind: // ruch pod wpływem wiatru (wiatr będziemy liczyć potem...)
glRotated(1.5 * std::sin(M_PI * simulation::Time.second() / 6.0), 0.0, 1.0, 0.0);
break;
case at_Sky: // animacja nieba
case TAnimType::at_Sky: // animacja nieba
glRotated(Global.fLatitudeDeg, 1.0, 0.0, 0.0); // ustawienie osi OY na północ
// glRotatef(Global.fTimeAngleDeg,0.0,1.0,0.0); //obrót dobowy osi OX
glRotated(-fmod(Global.fTimeAngleDeg, 360.0), 0.0, 1.0, 0.0); // obrót dobowy osi OX
break;
case at_IK11: // ostatni element animacji szkieletowej (podudzie, stopa)
case TAnimType::at_IK11: // ostatni element animacji szkieletowej (podudzie, stopa)
glRotatef(v_Angles.z, 0.0f, 1.0f, 0.0f); // obrót względem osi pionowej (azymut)
glRotatef(v_Angles.x, 1.0f, 0.0f, 0.0f); // obrót względem poziomu (deklinacja)
break;
case at_DigiClk: // animacja zegara cyfrowego
case TAnimType::at_DigiClk: // animacja zegara cyfrowego
{ // ustawienie animacji w submodelach potomnych
TSubModel *sm = ChildGet();
do

View File

@@ -21,7 +21,7 @@ const int TP_FREESPOTLIGHT = 257;
const int TP_STARS = 258;
const int TP_TEXT = 259;
enum TAnimType // rodzaj animacji
enum class TAnimType // rodzaj animacji
{
at_None, // brak
at_Rotate, // obrót względem wektora o kąt
@@ -38,13 +38,13 @@ enum TAnimType // rodzaj animacji
at_Billboard, // obrót w pionie do kamery
at_Wind, // ruch pod wpływem wiatru
at_Sky, // animacja nieba
at_IK = 0x100, // odwrotna kinematyka - submodel sterujący (np. staw skokowy)
at_IK11 = 0x101, // odwrotna kinematyka - submodel nadrzędny do sterowango (np. stopa)
at_IK21 = 0x102, // odwrotna kinematyka - submodel nadrzędny do sterowango (np. podudzie)
at_IK22 = 0x103, // odwrotna kinematyka - submodel nadrzędny do nadrzędnego sterowango (np. udo)
at_Digital = 0x200, // dziesięciocyfrowy licznik mechaniczny (z cylindrami)
at_DigiClk = 0x201, // zegar cyfrowy jako licznik na dziesięciościanach
at_Undefined = 0x800000FF // animacja chwilowo nieokreślona
at_IK, // odwrotna kinematyka - submodel sterujący (np. staw skokowy)
at_IK11, // odwrotna kinematyka - submodel nadrzędny do sterowango (np. stopa)
at_IK21, // odwrotna kinematyka - submodel nadrzędny do sterowango (np. podudzie)
at_IK22, // odwrotna kinematyka - submodel nadrzędny do nadrzędnego sterowango (np. udo)
at_Digital, // dziesięciocyfrowy licznik mechaniczny (z cylindrami)
at_DigiClk, // zegar cyfrowy jako licznik na dziesięciościanach
at_Undefined // animacja chwilowo nieokreślona
};
namespace scene {
@@ -73,7 +73,7 @@ private:
int eType{ TP_ROTATOR }; // Ra: modele binarne dają więcej możliwości niż mesh złożony z trójkątów
int iName{ -1 }; // numer łańcucha z nazwą submodelu, albo -1 gdy anonimowy
public: // chwilowo
TAnimType b_Anim{ at_None };
TAnimType b_Anim{ TAnimType::at_None };
private:
int iFlags{ 0x0200 }; // bit 9=1: submodel został utworzony a nie ustawiony na wczytany plik
@@ -136,7 +136,7 @@ public: // chwilowo
gfx::vertex_array Vertices;
float m_boundingradius { 0 };
size_t iAnimOwner{ 0 }; // roboczy numer egzemplarza, który ustawił animację
TAnimType b_aAnim{ at_None }; // kody animacji oddzielnie, bo zerowane
TAnimType b_aAnim{ TAnimType::at_None }; // kody animacji oddzielnie, bo zerowane
float4x4 *mAnimMatrix{ nullptr }; // macierz do animacji kwaternionowych (należy do AnimContainer)
TSubModel **smLetter{ nullptr }; // wskaźnik na tablicę submdeli do generoania tekstu (docelowo zapisać do E3D)
TSubModel *Parent{ nullptr }; // nadrzędny, np. do wymnażania macierzy

130
Train.cpp
View File

@@ -600,7 +600,7 @@ bool TTrain::is_eztoer() const {
return
( ( mvControlled->TrainType == dt_EZT )
&& ( mvOccupied->BrakeSubsystem == ss_ESt )
&& ( mvOccupied->BrakeSubsystem == TBrakeSubSystem::ss_ESt )
&& ( mvControlled->Battery == true )
&& ( mvControlled->EpFuse == true )
&& ( mvControlled->ActiveDir != 0 ) ); // od yB
@@ -769,7 +769,7 @@ void TTrain::OnCommand_secondcontrollerincrease( TTrain *Train, command_data con
if( Command.action != GLFW_RELEASE ) {
// on press or hold
if( ( Train->mvControlled->EngineType == DieselElectric )
if( ( Train->mvControlled->EngineType == TEngineType::DieselElectric )
&& ( true == Train->mvControlled->ShuntMode ) ) {
Train->mvControlled->AnPos = clamp(
Train->mvControlled->AnPos + 0.025,
@@ -785,7 +785,7 @@ void TTrain::OnCommand_secondcontrollerincreasefast( TTrain *Train, command_data
if( Command.action != GLFW_RELEASE ) {
// on press or hold
if( ( Train->mvControlled->EngineType == DieselElectric )
if( ( Train->mvControlled->EngineType == TEngineType::DieselElectric )
&& ( true == Train->mvControlled->ShuntMode ) ) {
Train->mvControlled->AnPos = 1.0;
}
@@ -837,7 +837,7 @@ void TTrain::OnCommand_secondcontrollerdecrease( TTrain *Train, command_data con
if( Command.action != GLFW_RELEASE ) {
// on press or hold
if( ( Train->mvControlled->EngineType == DieselElectric )
if( ( Train->mvControlled->EngineType == TEngineType::DieselElectric )
&& ( true == Train->mvControlled->ShuntMode ) ) {
Train->mvControlled->AnPos = clamp(
Train->mvControlled->AnPos - 0.025,
@@ -853,7 +853,7 @@ void TTrain::OnCommand_secondcontrollerdecreasefast( TTrain *Train, command_data
if( Command.action != GLFW_RELEASE ) {
// on press or hold
if( ( Train->mvControlled->EngineType == DieselElectric )
if( ( Train->mvControlled->EngineType == TEngineType::DieselElectric )
&& ( true == Train->mvControlled->ShuntMode ) ) {
Train->mvControlled->AnPos = 0.0;
}
@@ -882,7 +882,7 @@ void TTrain::OnCommand_independentbrakeincrease( TTrain *Train, command_data con
if( Command.action != GLFW_RELEASE ) {
if( Train->mvOccupied->LocalBrake != ManualBrake ) {
if( Train->mvOccupied->LocalBrake != TLocalBrake::ManualBrake ) {
Train->mvOccupied->IncLocalBrakeLevel( 1 );
}
}
@@ -892,8 +892,8 @@ void TTrain::OnCommand_independentbrakeincreasefast( TTrain *Train, command_data
if( Command.action != GLFW_RELEASE ) {
if( Train->mvOccupied->LocalBrake != ManualBrake ) {
Train->mvOccupied->IncLocalBrakeLevel( 2 );
if( Train->mvOccupied->LocalBrake != TLocalBrake::ManualBrake ) {
Train->mvOccupied->IncLocalBrakeLevel( LocalBrakePosNo );
}
}
}
@@ -902,10 +902,10 @@ void TTrain::OnCommand_independentbrakedecrease( TTrain *Train, command_data con
if( Command.action != GLFW_RELEASE ) {
if( ( Train->mvOccupied->LocalBrake != ManualBrake )
if( ( Train->mvOccupied->LocalBrake != TLocalBrake::ManualBrake )
// Ra 1014-06: AI potrafi zahamować pomocniczym mimo jego braku - odhamować jakoś trzeba
// TODO: sort AI out so it doesn't do things it doesn't have equipment for
|| ( Train->mvOccupied->LocalBrakePos != 0 ) ) {
|| ( Train->mvOccupied->LocalBrakePosA > 0 ) ) {
Train->mvOccupied->DecLocalBrakeLevel( 1 );
}
}
@@ -915,11 +915,11 @@ void TTrain::OnCommand_independentbrakedecreasefast( TTrain *Train, command_data
if( Command.action != GLFW_RELEASE ) {
if( ( Train->mvOccupied->LocalBrake != ManualBrake )
if( ( Train->mvOccupied->LocalBrake != TLocalBrake::ManualBrake )
// Ra 1014-06: AI potrafi zahamować pomocniczym mimo jego braku - odhamować jakoś trzeba
// TODO: sort AI out so it doesn't do things it doesn't have equipment for
|| ( Train->mvOccupied->LocalBrakePos != 0 ) ) {
Train->mvOccupied->DecLocalBrakeLevel( 2 );
|| ( Train->mvOccupied->LocalBrakePosA > 0 ) ) {
Train->mvOccupied->DecLocalBrakeLevel( LocalBrakePosNo );
}
}
}
@@ -948,9 +948,9 @@ void TTrain::OnCommand_independentbrakebailoff( TTrain *Train, command_data cons
// TODO: check if this set of conditions can be simplified.
// it'd be more flexible to have an attribute indicating whether bail off position is supported
if( ( Train->mvControlled->TrainType != dt_EZT )
&& ( ( Train->mvControlled->EngineType == ElectricSeriesMotor )
|| ( Train->mvControlled->EngineType == DieselElectric )
|| ( Train->mvControlled->EngineType == ElectricInductionMotor ) )
&& ( ( Train->mvControlled->EngineType == TEngineType::ElectricSeriesMotor )
|| ( Train->mvControlled->EngineType == TEngineType::DieselElectric )
|| ( Train->mvControlled->EngineType == TEngineType::ElectricInductionMotor ) )
&& ( Train->mvOccupied->BrakeCtrlPosNo > 0 ) ) {
if( Command.action == GLFW_PRESS ) {
@@ -989,7 +989,7 @@ void TTrain::OnCommand_trainbrakeincrease( TTrain *Train, command_data const &Co
if( Command.action != GLFW_RELEASE ) {
if( Train->mvOccupied->BrakeHandle == FV4a ) {
if( Train->mvOccupied->BrakeHandle == TBrakeHandle::FV4a ) {
Train->mvOccupied->BrakeLevelAdd( 0.1 /*15.0 * Command.time_delta*/ );
}
else {
@@ -1002,7 +1002,7 @@ void TTrain::OnCommand_trainbrakedecrease( TTrain *Train, command_data const &Co
if( Command.action != GLFW_RELEASE ) {
// press or hold
if( Train->mvOccupied->BrakeHandle == FV4a ) {
if( Train->mvOccupied->BrakeHandle == TBrakeHandle::FV4a ) {
Train->mvOccupied->BrakeLevelAdd( -0.1 /*-15.0 * Command.time_delta*/ );
}
else {
@@ -1031,7 +1031,7 @@ void TTrain::OnCommand_trainbrakecharging( TTrain *Train, command_data const &Co
else {
// release
if( ( Train->mvOccupied->BrakeCtrlPos == -1 )
&& ( Train->mvOccupied->BrakeHandle == FVel6 )
&& ( Train->mvOccupied->BrakeHandle == TBrakeHandle::FVel6 )
&& ( Train->DynamicObject->Controller != AIdriver )
&& ( Global.iFeedbackMode < 3 ) ) {
// Odskakiwanie hamulce EP
@@ -1062,7 +1062,7 @@ void TTrain::OnCommand_trainbrakeservice( TTrain *Train, command_data const &Com
Train->set_train_brake( (
Train->mvOccupied->BrakeCtrlPosNo / 2
+ ( Train->mvOccupied->BrakeHandle == FV4a ?
+ ( Train->mvOccupied->BrakeHandle == TBrakeHandle::FV4a ?
1 :
0 ) ) );
}
@@ -1103,7 +1103,7 @@ void TTrain::OnCommand_trainbrakebasepressureincrease( TTrain *Train, command_da
if( Command.action != GLFW_RELEASE ) {
switch( Train->mvOccupied->BrakeHandle ) {
case FV4a: {
case TBrakeHandle::FV4a: {
Train->mvOccupied->BrakeCtrlPos2 = clamp( Train->mvOccupied->BrakeCtrlPos2 - 0.01, -1.5, 2.0 );
break;
}
@@ -1120,7 +1120,7 @@ void TTrain::OnCommand_trainbrakebasepressuredecrease( TTrain *Train, command_da
if( Command.action != GLFW_RELEASE ) {
switch( Train->mvOccupied->BrakeHandle ) {
case FV4a: {
case TBrakeHandle::FV4a: {
Train->mvOccupied->BrakeCtrlPos2 = clamp( Train->mvOccupied->BrakeCtrlPos2 + 0.01, -1.5, 2.0 );
break;
}
@@ -1158,7 +1158,7 @@ void TTrain::OnCommand_manualbrakeincrease( TTrain *Train, command_data const &C
auto *vehicle { Train->find_nearest_consist_vehicle() };
if( vehicle == nullptr ) { return; }
if( ( vehicle->MoverParameters->LocalBrake == ManualBrake )
if( ( vehicle->MoverParameters->LocalBrake == TLocalBrake::ManualBrake )
|| ( vehicle->MoverParameters->MBrake == true ) ) {
vehicle->MoverParameters->IncManualBrakeLevel( 1 );
@@ -1173,7 +1173,7 @@ void TTrain::OnCommand_manualbrakedecrease( TTrain *Train, command_data const &C
auto *vehicle { Train->find_nearest_consist_vehicle() };
if( vehicle == nullptr ) { return; }
if( ( vehicle->MoverParameters->LocalBrake == ManualBrake )
if( ( vehicle->MoverParameters->LocalBrake == TLocalBrake::ManualBrake )
|| ( vehicle->MoverParameters->MBrake == true ) ) {
vehicle->MoverParameters->DecManualBrakeLevel( 1 );
@@ -1210,7 +1210,7 @@ void TTrain::OnCommand_wheelspinbrakeactivate( TTrain *Train, command_data const
return;
}
if( Train->mvOccupied->BrakeSystem != ElectroPneumatic ) {
if( Train->mvOccupied->BrakeSystem != TBrakeSystem::ElectroPneumatic ) {
// standard behaviour
if( Command.action == GLFW_PRESS ) {
// visual feedback
@@ -1229,7 +1229,7 @@ void TTrain::OnCommand_wheelspinbrakeactivate( TTrain *Train, command_data const
// visual feedback
Train->ggAntiSlipButton.UpdateValue( 1.0, Train->dsbPneumaticSwitch );
if( ( Train->mvOccupied->BrakeHandle == St113 )
if( ( Train->mvOccupied->BrakeHandle == TBrakeHandle::St113 )
&& ( Train->mvControlled->EpFuse == true ) ) {
Train->mvOccupied->SwitchEPBrake( 1 );
}
@@ -2074,8 +2074,8 @@ void TTrain::OnCommand_linebreakerclose( TTrain *Train, command_data const &Comm
if( Train->m_linebreakerstate == 2 ) {
// we don't need to start the diesel twice, but the other types (with impulse switch setup) still need to be launched
if( ( Train->mvControlled->EngineType != DieselEngine )
&& ( Train->mvControlled->EngineType != DieselElectric ) ) {
if( ( Train->mvControlled->EngineType != TEngineType::DieselEngine )
&& ( Train->mvControlled->EngineType != TEngineType::DieselElectric ) ) {
// try to finalize state change of the line breaker, set the state based on the outcome
Train->m_linebreakerstate = (
Train->mvControlled->MainSwitch( true ) ?
@@ -2387,7 +2387,7 @@ void TTrain::OnCommand_convertertoggle( TTrain *Train, command_data const &Comma
void TTrain::OnCommand_converterenable( TTrain *Train, command_data const &Command ) {
if( Train->mvControlled->ConverterStart == start::automatic ) {
if( Train->mvControlled->ConverterStart == start_t::automatic ) {
// let the automatic thing do its automatic thing...
return;
}
@@ -2421,7 +2421,7 @@ void TTrain::OnCommand_converterenable( TTrain *Train, command_data const &Comma
void TTrain::OnCommand_converterdisable( TTrain *Train, command_data const &Command ) {
if( Train->mvControlled->ConverterStart == start::automatic ) {
if( Train->mvControlled->ConverterStart == start_t::automatic ) {
// let the automatic thing do its automatic thing...
return;
}
@@ -2461,7 +2461,7 @@ void TTrain::OnCommand_converterdisable( TTrain *Train, command_data const &Comm
void TTrain::OnCommand_convertertogglelocal( TTrain *Train, command_data const &Command ) {
if( Train->mvOccupied->ConverterStart == start::automatic ) {
if( Train->mvOccupied->ConverterStart == start_t::automatic ) {
// let the automatic thing do its automatic thing...
return;
}
@@ -3714,7 +3714,7 @@ void TTrain::OnCommand_doortoggleleft( TTrain *Train, command_data const &Comman
Train->mvOccupied->DoorLeftOpened :
Train->mvOccupied->DoorRightOpened ) ) {
// open
if( Train->mvOccupied->DoorOpenCtrl != control::driver ) {
if( Train->mvOccupied->DoorOpenCtrl != control_t::driver ) {
return;
}
if( Train->mvOccupied->ActiveCab == 1 ) {
@@ -3729,7 +3729,7 @@ void TTrain::OnCommand_doortoggleleft( TTrain *Train, command_data const &Comman
}
else {
// close
if( Train->mvOccupied->DoorCloseCtrl != control::driver ) {
if( Train->mvOccupied->DoorCloseCtrl != control_t::driver ) {
return;
}
// TODO: move door opening/closing to the update, so the switch animation doesn't hinge on door working
@@ -3755,7 +3755,7 @@ void TTrain::OnCommand_doortoggleright( TTrain *Train, command_data const &Comma
Train->mvOccupied->DoorRightOpened :
Train->mvOccupied->DoorLeftOpened ) ) {
// open
if( Train->mvOccupied->DoorOpenCtrl != control::driver ) {
if( Train->mvOccupied->DoorOpenCtrl != control_t::driver ) {
return;
}
if( Train->mvOccupied->ActiveCab == 1 ) {
@@ -3770,7 +3770,7 @@ void TTrain::OnCommand_doortoggleright( TTrain *Train, command_data const &Comma
}
else {
// close
if( Train->mvOccupied->DoorCloseCtrl != control::driver ) {
if( Train->mvOccupied->DoorCloseCtrl != control_t::driver ) {
return;
}
if( Train->mvOccupied->ActiveCab == 1 ) {
@@ -4107,8 +4107,8 @@ void TTrain::UpdateMechPosition(double dt)
&& ( pMechOffset.y < 4.0 ) ) // Ra 15-01: przy oglądaniu pantografu bujanie przeszkadza
{
Math3D::vector3 shakevector;
if( ( mvOccupied->EngineType == DieselElectric )
|| ( mvOccupied->EngineType == DieselEngine ) ) {
if( ( mvOccupied->EngineType == TEngineType::DieselElectric )
|| ( mvOccupied->EngineType == TEngineType::DieselEngine ) ) {
if( std::abs( mvOccupied->enrot ) > 0.0 ) {
// engine vibration
shakevector.x +=
@@ -4258,8 +4258,8 @@ bool TTrain::Update( double const Deltatime )
|| ( ggMainOnButton.GetDesiredValue() > 0.95 ) ) {
// keep track of period the line breaker button is held down, to determine when/if circuit closes
if( ( fHVoltage > 0.5 * mvControlled->EnginePowerSource.MaxVoltage )
|| ( ( mvControlled->EngineType != ElectricSeriesMotor )
&& ( mvControlled->EngineType != ElectricInductionMotor )
|| ( ( mvControlled->EngineType != TEngineType::ElectricSeriesMotor )
&& ( mvControlled->EngineType != TEngineType::ElectricInductionMotor )
&& ( true == mvControlled->Battery ) ) ) {
// prevent the switch from working if there's no power
// TODO: consider whether it makes sense for diesel engines and such
@@ -4284,8 +4284,8 @@ bool TTrain::Update( double const Deltatime )
if( m_linebreakerstate == 2 ) {
// for diesels and/or vehicles with toggle switch setup we complete the engine start here
if( ( ggMainOnButton.SubModel == nullptr )
|| ( ( mvControlled->EngineType == DieselEngine )
|| ( mvControlled->EngineType == DieselElectric ) ) ) {
|| ( ( mvControlled->EngineType == TEngineType::DieselEngine )
|| ( mvControlled->EngineType == TEngineType::DieselElectric ) ) ) {
// try to finalize state change of the line breaker, set the state based on the outcome
m_linebreakerstate = (
mvControlled->MainSwitch( true ) ?
@@ -4350,7 +4350,7 @@ bool TTrain::Update( double const Deltatime )
}
}
if( ( mvOccupied->BrakeHandle == FVel6 )
if( ( mvOccupied->BrakeHandle == TBrakeHandle::FVel6 )
&& ( mvOccupied->fBrakeCtrlPos < 0.0 )
&& ( Global.iFeedbackMode < 3 ) ) {
// Odskakiwanie hamulce EP
@@ -4389,8 +4389,8 @@ bool TTrain::Update( double const Deltatime )
}
// Ra 2014-09: napięcia i prądy muszą być ustalone najpierw, bo wysyłane są ewentualnie na PoKeys
if ((mvControlled->EngineType != DieselElectric)
&& (mvControlled->EngineType != ElectricInductionMotor)) // Ra 2014-09: czy taki rozdzia? ma sens?
if ((mvControlled->EngineType != TEngineType::DieselElectric)
&& (mvControlled->EngineType != TEngineType::ElectricInductionMotor)) // Ra 2014-09: czy taki rozdzia? ma sens?
fHVoltage = mvControlled->RunningTraction.TractionVoltage; // Winger czy to nie jest zle?
// *mvControlled->Mains);
else
@@ -4453,7 +4453,7 @@ bool TTrain::Update( double const Deltatime )
asCarName[i] = p->name();
bPants[iUnitNo - 1][0] = (bPants[iUnitNo - 1][0] || p->MoverParameters->PantFrontUp);
bPants[iUnitNo - 1][1] = (bPants[iUnitNo - 1][1] || p->MoverParameters->PantRearUp);
bComp[iUnitNo - 1][0] = (bComp[iUnitNo - 1][0] || p->MoverParameters->CompressorAllow || (p->MoverParameters->CompressorStart == start::automatic));
bComp[iUnitNo - 1][0] = (bComp[iUnitNo - 1][0] || p->MoverParameters->CompressorAllow || (p->MoverParameters->CompressorStart == start_t::automatic));
bSlip[i] = p->MoverParameters->SlippingWheels;
if (p->MoverParameters->CompressorSpeed > 0.00001)
{
@@ -4552,12 +4552,12 @@ bool TTrain::Update( double const Deltatime )
// hunter-080812: wyrzucanie szybkiego na elektrykach gdy nie ma napiecia przy dowolnym ustawieniu kierunkowego
// Ra: to już jest w T_MoverParameters::TractionForce(), ale zależy od kierunku
if( ( mvControlled->Mains )
&& ( mvControlled->EngineType == ElectricSeriesMotor ) ) {
&& ( mvControlled->EngineType == TEngineType::ElectricSeriesMotor ) ) {
if( std::max( mvControlled->GetTrainsetVoltage(), std::fabs( mvControlled->RunningTraction.TractionVoltage ) ) < 0.5 * mvControlled->EnginePowerSource.MaxVoltage ) {
// TODO: check whether it should affect entire consist for EMU
// TODO: check whether it should happen if there's power supplied alternatively through hvcouplers
// TODO: potentially move this to the mover module, as there isn't much reason to have this dependent on the operator presence
mvControlled->MainSwitch( false, ( mvControlled->TrainType == dt_EZT ? range::unit : range::local ) );
mvControlled->MainSwitch( false, ( mvControlled->TrainType == dt_EZT ? range_t::unit : range_t::local ) );
}
}
@@ -4579,7 +4579,7 @@ bool TTrain::Update( double const Deltatime )
{
fConverterTimer += Deltatime;
if ((mvControlled->CompressorFlag == true) && (mvControlled->CompressorPower == 1) &&
((mvControlled->EngineType == ElectricSeriesMotor) ||
((mvControlled->EngineType == TEngineType::ElectricSeriesMotor) ||
(mvControlled->TrainType == dt_EZT)) &&
(DynamicObject->Controller == Humandriver)) // hunter-110212: poprawka dla EZT
{ // hunter-091012: poprawka (zmiana warunku z CompressorPower /rozne od
@@ -4588,7 +4588,7 @@ bool TTrain::Update( double const Deltatime )
{
mvControlled->ConvOvldFlag = true;
if (mvControlled->TrainType != dt_EZT)
mvControlled->MainSwitch( false, ( mvControlled->TrainType == dt_EZT ? range::unit : range::local ) );
mvControlled->MainSwitch( false, ( mvControlled->TrainType == dt_EZT ? range_t::unit : range_t::local ) );
}
else if( fConverterTimer >= fConverterPrzekaznik ) {
// changed switch from always true to take into account state of the compressor switch
@@ -4707,13 +4707,13 @@ bool TTrain::Update( double const Deltatime )
ggLVoltage.Update();
}
if (mvControlled->EngineType == DieselElectric)
if (mvControlled->EngineType == TEngineType::DieselElectric)
{ // ustawienie zmiennych dla silnika spalinowego
fEngine[1] = mvControlled->ShowEngineRotation(1);
fEngine[2] = mvControlled->ShowEngineRotation(2);
}
else if (mvControlled->EngineType == DieselEngine)
else if (mvControlled->EngineType == TEngineType::DieselEngine)
{ // albo dla innego spalinowego
fEngine[1] = mvControlled->ShowEngineRotation(1);
fEngine[2] = mvControlled->ShowEngineRotation(2);
@@ -5161,7 +5161,7 @@ bool TTrain::Update( double const Deltatime )
false) // nie blokujemy AI
{ // Ra: nie najlepsze miejsce, ale na początek gdzieś to dać trzeba
// Firleju: dlatego kasujemy i zastepujemy funkcją w Console
if (mvOccupied->BrakeHandle == FV4a)
if (mvOccupied->BrakeHandle == TBrakeHandle::FV4a)
{
double b = Console::AnalogCalibrateGet(0);
b = b * 8.0 - 2.0;
@@ -5169,7 +5169,7 @@ bool TTrain::Update( double const Deltatime )
ggBrakeCtrl.UpdateValue(b); // przesów bez zaokrąglenia
mvOccupied->BrakeLevelSet(b);
}
if (mvOccupied->BrakeHandle == FVel6) // może można usunąć ograniczenie do FV4a i FVel6?
if (mvOccupied->BrakeHandle == TBrakeHandle::FVel6) // może można usunąć ograniczenie do FV4a i FVel6?
{
double b = Console::AnalogCalibrateGet(0);
b = b * 7.0 - 1.0;
@@ -5191,23 +5191,23 @@ bool TTrain::Update( double const Deltatime )
#ifdef _WIN32
if( ( DynamicObject->Mechanik != nullptr )
&& ( false == DynamicObject->Mechanik->AIControllFlag ) // nie blokujemy AI
&& ( mvOccupied->BrakeLocHandle == FD1 )
&& ( mvOccupied->BrakeLocHandle == TBrakeHandle::FD1 )
&& ( ( Global.iFeedbackMode == 4 )
/*|| ( Global.bMWDmasterEnable && Global.bMWDBreakEnable )*/ ) ) {
// Ra: nie najlepsze miejsce, ale na początek gdzieś to dać trzeba
// Firleju: dlatego kasujemy i zastepujemy funkcją w Console
auto const b = clamp<double>(
Console::AnalogCalibrateGet( 1 ) * 10.0,
Console::AnalogCalibrateGet( 1 ),
0.0,
LocalBrakePosNo );
ggLocalBrake.UpdateValue( b ); // przesów bez zaokrąglenia
mvOccupied->LocalBrakePos = int( 1.09 * b ); // sposób zaokrąglania jest do ustalenia
1.0 );
mvOccupied->LocalBrakePosA = b;
ggLocalBrake.UpdateValue( b * LocalBrakePosNo );
}
else
#endif
{
// standardowa prodedura z kranem powiązanym z klawiaturą
ggLocalBrake.UpdateValue( std::max<double>( mvOccupied->LocalBrakePos, mvOccupied->LocalBrakePosA * LocalBrakePosNo ) );
ggLocalBrake.UpdateValue( mvOccupied->LocalBrakePosA * LocalBrakePosNo );
}
ggLocalBrake.Update();
}
@@ -5369,7 +5369,7 @@ bool TTrain::Update( double const Deltatime )
}
// anti slip system activation, maintained while the control button is down
if( mvOccupied->BrakeSystem != ElectroPneumatic ) {
if( mvOccupied->BrakeSystem != TBrakeSystem::ElectroPneumatic ) {
if( ggAntiSlipButton.GetDesiredValue() > 0.95 ) {
mvControlled->AntiSlippingBrake();
}
@@ -5475,8 +5475,8 @@ TTrain::update_sounds( double const Deltatime ) {
// McZapkie-280302 - syczenie
// TODO: softer volume reduction than plain abrupt stop, perhaps as reusable wrapper?
if( ( mvOccupied->BrakeHandle == FV4a )
|| ( mvOccupied->BrakeHandle == FVel6 ) ) {
if( ( mvOccupied->BrakeHandle == TBrakeHandle::FV4a )
|| ( mvOccupied->BrakeHandle == TBrakeHandle::FVel6 ) ) {
// upuszczanie z PG
fPPress = interpolate( fPPress, static_cast<float>( mvOccupied->Handle->GetSound( s_fv4a_b ) ), 0.05f );
volume = (
@@ -7139,9 +7139,9 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
if (Parser.getToken<std::string>() == "analog")
{
// McZapkie-300302: zegarek
ggClockSInd.Init(DynamicObject->mdKabina->GetFromName("ClockShand"), gt_Rotate, 1.0/60.0);
ggClockMInd.Init(DynamicObject->mdKabina->GetFromName("ClockMhand"), gt_Rotate, 1.0/60.0);
ggClockHInd.Init(DynamicObject->mdKabina->GetFromName("ClockHhand"), gt_Rotate, 1.0/12.0);
ggClockSInd.Init(DynamicObject->mdKabina->GetFromName("ClockShand"), TGaugeType::gt_Rotate, 1.0/60.0);
ggClockMInd.Init(DynamicObject->mdKabina->GetFromName("ClockMhand"), TGaugeType::gt_Rotate, 1.0/60.0);
ggClockHInd.Init(DynamicObject->mdKabina->GetFromName("ClockHhand"), TGaugeType::gt_Rotate, 1.0/12.0);
}
}
else if (Label == "evoltage:")

View File

@@ -128,7 +128,7 @@ bool TWorld::Init( GLFWwindow *Window ) {
Controlled = NULL;
mvControlled = NULL;
SafeDelete( Train );
Camera.Type = tp_Free;
Camera.Type = TCameraType::tp_Free;
}
}
else
@@ -141,7 +141,7 @@ bool TWorld::Init( GLFWwindow *Window ) {
glfwSwapBuffers( window );
Controlled = NULL;
mvControlled = NULL;
Camera.Type = tp_Free;
Camera.Type = TCameraType::tp_Free;
DebugCamera = Camera;
Global.DebugCameraPosition = DebugCamera.Pos;
}
@@ -699,7 +699,7 @@ bool TWorld::Update() {
// fixed step part of the camera update
if( ( Train != nullptr )
&& ( Camera.Type == tp_Follow )
&& ( Camera.Type == TCameraType::tp_Follow )
&& ( false == DebugCameraFlag ) ) {
// jeśli jazda w kabinie, przeliczyć trzeba parametry kamery
Train->UpdateMechPosition( m_secondaryupdaterate );
@@ -825,7 +825,7 @@ TWorld::Update_Camera( double const Deltatime ) {
Global.CabWindowOpen = false;
if( ( Train != nullptr )
&& ( Camera.Type == tp_Follow )
&& ( Camera.Type == TCameraType::tp_Follow )
&& ( false == DebugCameraFlag ) ) {
// jeśli jazda w kabinie, przeliczyć trzeba parametry kamery
auto tempangle = Controlled->VectorFront() * ( Controlled->MoverParameters->ActiveCab == -1 ? -1 : 1 );

View File

@@ -207,6 +207,8 @@ eu07_application::init( int Argc, char *Argv[] ) {
int
eu07_application::run() {
// HACK: prevent mouse capture before simulation starts
Global.ControlPicking = true;
// TODO: move input sources and their initializations to the application mode member
input::Keyboard.init();
input::Mouse.init();
@@ -238,6 +240,7 @@ eu07_application::run() {
set_cursor( GLFW_CURSOR_DISABLED );
set_cursor_pos( 0, 0 );
Global.ControlPicking = false;
// main application loop
// TODO: split into parts and delegate these to application mode member
@@ -390,12 +393,12 @@ eu07_application::init_settings( int Argc, char *Argv[] ) {
}
else if( token == "-s" ) {
if( i + 1 < Argc ) {
Global.SceneryFile = Argv[ ++i ];
Global.SceneryFile = ToLower( Argv[ ++i ] );
}
}
else if( token == "-v" ) {
if( i + 1 < Argc ) {
Global.asHumanCtrlVehicle = Argv[ ++i ];
Global.asHumanCtrlVehicle = ToLower( Argv[ ++i ] );
}
}
else {

View File

@@ -21,6 +21,20 @@ namespace audio {
openal_renderer renderer;
float const EU07_SOUND_CUTOFFRANGE { 3000.f }; // 2750 m = max expected emitter spawn range, plus safety margin
float const EU07_SOUND_VELOCITYLIMIT { 250 / 3.6f }; // 343 m/sec ~= speed of sound; arbitrary limit of 250 km/h
// potentially clamps length of provided vector to 343 meters
// TBD: make a generic method for utilities out of this
glm::vec3
limit_velocity( glm::vec3 const &Velocity ) {
auto const ratio { glm::length( Velocity ) / EU07_SOUND_VELOCITYLIMIT };
return (
ratio > 1.f ?
Velocity / ratio :
Velocity );
}
// starts playback of queued buffers
void
@@ -97,7 +111,7 @@ openal_source::sync_with( sound_properties const &State ) {
&& ( sound_range >= 0 )
&& ( properties.location != glm::dvec3() ) ) {
// after sound position was initialized we can start velocity calculations
sound_velocity = ( State.location - properties.location ) / update_deltatime;
sound_velocity = limit_velocity( ( State.location - properties.location ) / update_deltatime );
}
// NOTE: velocity at this point can be either listener velocity for global sounds, actual sound velocity, or 0 if sound position is yet unknown
::alSourcefv( id, AL_VELOCITY, glm::value_ptr( sound_velocity ) );
@@ -311,7 +325,7 @@ openal_renderer::update( double const Deltatime ) {
m_listenerposition = listenerposition;
m_listenervelocity = (
glm::length( listenermovement ) < 1000.0 ? // large jumps are typically camera changes
listenermovement / Deltatime :
limit_velocity( listenermovement / Deltatime ) :
glm::vec3() );
::alListenerfv( AL_VELOCITY, reinterpret_cast<ALfloat const *>( glm::value_ptr( m_listenervelocity ) ) );
}

View File

@@ -69,14 +69,14 @@ private:
// members
commandsetup_sequence m_commands;
user_command m_command; // last, if any, issued command
user_command m_command { user_command::none }; // last, if any, issued command
usercommand_map m_bindings;
command_relay m_relay;
bool m_shift{ false };
bool m_ctrl{ false };
bool m_shift { false };
bool m_ctrl { false };
bindings_cache m_bindingscache;
glm::vec2 m_movementhorizontal;
float m_movementvertical;
glm::vec2 m_movementhorizontal { 0.f };
float m_movementvertical { 0.f };
std::array<char, GLFW_KEY_LAST + 1> m_keys;
};

View File

@@ -200,7 +200,7 @@ WyslijObsadzone()
r.fPar[ 16 * i + 4 ] = vehicle->GetPosition().x;
r.fPar[ 16 * i + 5 ] = vehicle->GetPosition().y;
r.fPar[ 16 * i + 6 ] = vehicle->GetPosition().z;
r.iPar[ 16 * i + 7 ] = vehicle->Mechanik->GetAction();
r.iPar[ 16 * i + 7 ] = static_cast<int>( vehicle->Mechanik->GetAction() );
strcpy( r.cString + 64 * i + 32, vehicle->GetTrack()->IsolatedName().c_str() );
strcpy( r.cString + 64 * i + 48, vehicle->Mechanik->TrainName().c_str() );
i++;

View File

@@ -51,7 +51,7 @@ struct stream_units {
std::vector<GLint> texture { GL_TEXTURE0 }; // unit associated with main texture data stream. TODO: allow multiple units per stream
};
typedef std::vector<basic_vertex> vertex_array;
using vertex_array = std::vector<basic_vertex>;
// generic geometry bank class, allows storage, update and drawing of geometry chunks
@@ -130,7 +130,7 @@ protected:
}
};
typedef std::vector<geometry_chunk> geometrychunk_sequence;
using geometrychunk_sequence = std::vector<geometry_chunk>;
// methods
inline
@@ -182,21 +182,21 @@ private:
bool is_good{ false }; // true if local content of the chunk matches the data on the opengl end
};
typedef std::vector<chunk_record> chunkrecord_sequence;
using chunkrecord_sequence = std::vector<chunk_record>;
// methods:
// create() subclass details
void
create_( gfx::geometry_handle const &Geometry );
create_( gfx::geometry_handle const &Geometry ) override;
// replace() subclass details
void
replace_( gfx::geometry_handle const &Geometry );
replace_( gfx::geometry_handle const &Geometry ) override;
// draw() subclass details
void
draw_( gfx::geometry_handle const &Geometry, gfx::stream_units const &Units, unsigned int const Streams );
draw_( gfx::geometry_handle const &Geometry, gfx::stream_units const &Units, unsigned int const Streams ) override;
// release() subclass details
void
release_();
release_() override;
void
bind_buffer();
void
@@ -237,21 +237,21 @@ private:
unsigned int streams { 0 }; // stream combination used to generate the display list
};
typedef std::vector<chunk_record> chunkrecord_sequence;
using chunkrecord_sequence = std::vector<chunk_record>;
// methods:
// create() subclass details
void
create_( gfx::geometry_handle const &Geometry );
create_( gfx::geometry_handle const &Geometry ) override;
// replace() subclass details
void
replace_( gfx::geometry_handle const &Geometry );
replace_( gfx::geometry_handle const &Geometry ) override;
// draw() subclass details
void
draw_( gfx::geometry_handle const &Geometry, gfx::stream_units const &Units, unsigned int const Streams );
draw_( gfx::geometry_handle const &Geometry, gfx::stream_units const &Units, unsigned int const Streams ) override;
// release () subclass details
void
release_();
release_() override;
void
delete_list( gfx::geometry_handle const &Geometry );
@@ -262,7 +262,7 @@ private:
// geometry bank manager, holds collection of geometry banks
typedef geometry_handle geometrybank_handle;
using geometrybank_handle = geometry_handle;
class geometrybank_manager {
@@ -302,11 +302,8 @@ public:
private:
// types:
typedef std::pair<
std::shared_ptr<geometry_bank>,
resource_timestamp > geometrybanktimepoint_pair;
typedef std::deque< geometrybanktimepoint_pair > geometrybanktimepointpair_sequence;
using geometrybanktimepoint_pair = std::pair< std::shared_ptr<geometry_bank>, resource_timestamp >;
using geometrybanktimepointpair_sequence = std::deque< geometrybanktimepoint_pair >;
// members:
geometrybanktimepointpair_sequence m_geometrybanks;

View File

@@ -2350,7 +2350,7 @@ opengl_renderer::Render( TSubModel *Submodel ) {
::glPushMatrix();
if( Submodel->fMatrix )
::glMultMatrixf( Submodel->fMatrix->readArray() );
if( Submodel->b_Anim )
if( Submodel->b_Anim != TAnimType::at_None )
Submodel->RaAnimation( Submodel->b_Anim );
}
@@ -3169,7 +3169,7 @@ opengl_renderer::Render_Alpha( TSubModel *Submodel ) {
::glPushMatrix();
if( Submodel->fMatrix )
::glMultMatrixf( Submodel->fMatrix->readArray() );
if( Submodel->b_aAnim )
if( Submodel->b_aAnim != TAnimType::at_None )
Submodel->RaAnimation( Submodel->b_aAnim );
}

View File

@@ -95,7 +95,7 @@ uart_input::recall_bindings() {
auto const bindingtype { typelookup->second };
std::array<user_command, 2> bindingcommands { user_command::none, user_command::none };
auto const commandcount { ( bindingtype == toggle ? 2 : 1 ) };
auto const commandcount { ( bindingtype == input_type_t::toggle ? 2 : 1 ) };
for( int commandidx = 0; commandidx < commandcount; ++commandidx ) {
// grab command(s) associated with the input pin
auto const bindingcommandname { entryparser.getToken<std::string>() };
@@ -166,14 +166,14 @@ void uart_input::poll()
auto const type { std::get<input_type_t>( entry ) };
auto const action { (
type != impulse ?
type != input_type_t::impulse ?
GLFW_PRESS :
( true == state ?
GLFW_PRESS :
GLFW_RELEASE ) ) };
auto const command { (
type != toggle ?
type != input_type_t::toggle ?
std::get<2>( entry ) :
( true == state ?
std::get<2>( entry ) :

2
uart.h
View File

@@ -48,7 +48,7 @@ public:
private:
// types
enum input_type_t
enum class input_type_t
{
toggle, // two commands, each mapped to one state; press event on state change
impulse, // one command; press event when set, release when cleared

View File

@@ -276,7 +276,7 @@ ui_layer::update() {
else if( mover->ActiveDir < 0 ) { uitextline2 += " R"; }
else { uitextline2 += " N"; }
uitextline3 = "Brakes:" + to_string( mover->fBrakeCtrlPos, 1, 5 ) + "+" + std::to_string( mover->LocalBrakePos ) + ( mover->SlippingWheels ? " !" : " " );
uitextline3 = "Brakes:" + to_string( mover->fBrakeCtrlPos, 1, 5 ) + "+" + to_string( mover->LocalBrakePosA * LocalBrakePosNo, 0 ) + ( mover->SlippingWheels ? " !" : " " );
uitextline4 = (
true == TestFlag( mover->SecuritySystem.Status, s_aware ) ?
@@ -472,7 +472,7 @@ ui_layer::update() {
uitextline2 += ( vehicle->MoverParameters->OilPump.is_active ? "O" : ( vehicle->MoverParameters->OilPump.is_enabled ? "o" : "." ) );
uitextline2 += ( false == vehicle->MoverParameters->ConverterAllowLocal ? "-" : ( vehicle->MoverParameters->ConverterAllow ? ( vehicle->MoverParameters->ConverterFlag ? "X" : "x" ) : "." ) );
uitextline2 += ( vehicle->MoverParameters->ConvOvldFlag ? "!" : "." );
uitextline2 += ( vehicle->MoverParameters->CompressorFlag ? "C" : ( false == vehicle->MoverParameters->CompressorAllowLocal ? "-" : ( ( vehicle->MoverParameters->CompressorAllow || vehicle->MoverParameters->CompressorStart == start::automatic ) ? "c" : "." ) ) );
uitextline2 += ( vehicle->MoverParameters->CompressorFlag ? "C" : ( false == vehicle->MoverParameters->CompressorAllowLocal ? "-" : ( ( vehicle->MoverParameters->CompressorAllow || vehicle->MoverParameters->CompressorStart == start_t::automatic ) ? "c" : "." ) ) );
uitextline2 += ( vehicle->MoverParameters->CompressorGovernorLock ? "!" : "." );
auto const train { Global.pWorld->train() };
@@ -876,9 +876,9 @@ ui_layer::update() {
uitextline2 =
"HamZ=" + to_string( vehicle->MoverParameters->fBrakeCtrlPos, 2 )
+ "; HamP=" + std::to_string( vehicle->MoverParameters->LocalBrakePos ) + "/" + to_string( vehicle->MoverParameters->LocalBrakePosA, 2 )
+ "; HamP=" + to_string( vehicle->MoverParameters->LocalBrakePosA, 2 )
+ "; NasJ=" + std::to_string( vehicle->MoverParameters->MainCtrlPos ) + "(" + std::to_string( vehicle->MoverParameters->MainCtrlActualPos ) + ")"
+ ( ( vehicle->MoverParameters->ShuntMode && vehicle->MoverParameters->EngineType == DieselElectric ) ?
+ ( ( vehicle->MoverParameters->ShuntMode && vehicle->MoverParameters->EngineType == TEngineType::DieselElectric ) ?
"; NasB=" + to_string( vehicle->MoverParameters->AnPos, 2 ) :
"; NasB=" + std::to_string( vehicle->MoverParameters->ScndCtrlPos ) + "(" + std::to_string( vehicle->MoverParameters->ScndCtrlActualPos ) + ")" )
+ "; I=" +
@@ -943,7 +943,7 @@ ui_layer::update() {
uitextline3 += " Vtrack " + to_string( vehicle->MoverParameters->RunningTrack.Velmax, 2 );
}
if( ( vehicle->MoverParameters->EnginePowerSource.SourceType == CurrentCollector )
if( ( vehicle->MoverParameters->EnginePowerSource.SourceType == TPowerSource::CurrentCollector )
|| ( vehicle->MoverParameters->TrainType == dt_EZT ) ) {
uitextline3 +=
"; pant. " + to_string( vehicle->MoverParameters->PantPress, 2 )
@@ -971,7 +971,7 @@ ui_layer::update() {
}
// induction motor data
if( vehicle->MoverParameters->EngineType == ElectricInductionMotor ) {
if( vehicle->MoverParameters->EngineType == TEngineType::ElectricInductionMotor ) {
UITable->text_lines.emplace_back( " eimc: eimv: press:", Global.UITextColor );
for( int i = 0; i <= 20; ++i ) {
@@ -994,7 +994,7 @@ ui_layer::update() {
UITable->text_lines.emplace_back( parameters, Global.UITextColor );
}
}
if (vehicle->MoverParameters->EngineType == DieselEngine) {
if (vehicle->MoverParameters->EngineType == TEngineType::DieselEngine) {
std::string parameters = "param value";
UITable->text_lines.emplace_back(parameters, Global.UITextColor);
parameters = "efill: " + to_string(vehicle->MoverParameters->dizel_fill, 2, 9);

View File

@@ -307,8 +307,6 @@ nearest_segment_point( VecType_ const &Segmentstart, VecType_ const &Segmentend,
return c1 / c2;
}
class cParser;
glm::dvec3 LoadPoint( cParser &Input );
glm::dvec3 LoadPoint( class cParser &Input );
//---------------------------------------------------------------------------