mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Merge branch 'mover_in_c++' of https://github.com/tmj-fstate/maszyna into tmj-fstate-mover_in_c++
This commit is contained in:
@@ -125,7 +125,7 @@ class TAnimModel : public editor::basic_node {
|
||||
|
||||
public:
|
||||
// constructors
|
||||
TAnimModel( scene::node_data const &Nodedata );
|
||||
explicit TAnimModel( scene::node_data const &Nodedata );
|
||||
// destructor
|
||||
~TAnimModel();
|
||||
// methods
|
||||
|
||||
1
Button.h
1
Button.h
@@ -32,6 +32,7 @@ class TButton
|
||||
void
|
||||
play();
|
||||
// plays specified sound
|
||||
static
|
||||
void
|
||||
play( sound *Sound );
|
||||
|
||||
|
||||
@@ -1797,7 +1797,7 @@ void TController::AutoRewident()
|
||||
}
|
||||
if (mvOccupied->TrainType == dt_EZT)
|
||||
{
|
||||
fAccThreshold = std::max(-fBrake_a0[BrakeAccTableSize] - 8 * fBrake_a1[BrakeAccTableSize], -0.75);
|
||||
fAccThreshold = std::max(-fBrake_a0[BrakeAccTableSize] - 8 * fBrake_a1[BrakeAccTableSize], -0.6);
|
||||
fBrakeReaction = 0.25;
|
||||
}
|
||||
else if (ustaw > 16)
|
||||
@@ -5668,7 +5668,7 @@ bool TController::IsStop()
|
||||
double
|
||||
TController::TrackBlock() const {
|
||||
|
||||
return pVehicles[ TMoverParameters::side::front ]->fTrackBlock;
|
||||
return pVehicles[ side::front ]->fTrackBlock;
|
||||
}
|
||||
|
||||
void TController::MoveTo(TDynamicObject *to)
|
||||
|
||||
75
DynObj.cpp
75
DynObj.cpp
@@ -1276,21 +1276,21 @@ void TDynamicObject::CouplersDettach(double MinDist, int MyScanDir) {
|
||||
if (MyScanDir > 0) {
|
||||
// pojazd od strony sprzęgu 0
|
||||
if( ( PrevConnected != nullptr )
|
||||
&& ( MoverParameters->Couplers[ TMoverParameters::side::front ].CoupleDist > MinDist ) ) {
|
||||
&& ( MoverParameters->Couplers[ side::front ].CoupleDist > MinDist ) ) {
|
||||
// sprzęgi wirtualne zawsze przekraczają
|
||||
if( ( PrevConnectedNo == TMoverParameters::side::front ?
|
||||
if( ( PrevConnectedNo == side::front ?
|
||||
PrevConnected->PrevConnected :
|
||||
PrevConnected->NextConnected )
|
||||
== this ) {
|
||||
// Ra: nie rozłączamy znalezionego, jeżeli nie do nas podłączony
|
||||
// (może jechać w innym kierunku)
|
||||
PrevConnected->MoverParameters->Couplers[PrevConnectedNo].Connected = nullptr;
|
||||
if( PrevConnectedNo == TMoverParameters::side::front ) {
|
||||
if( PrevConnectedNo == side::front ) {
|
||||
// sprzęg 0 nie podłączony
|
||||
PrevConnected->PrevConnectedNo = 2;
|
||||
PrevConnected->PrevConnected = nullptr;
|
||||
}
|
||||
else if( PrevConnectedNo == TMoverParameters::side::rear ) {
|
||||
else if( PrevConnectedNo == side::rear ) {
|
||||
// sprzęg 1 nie podłączony
|
||||
PrevConnected->NextConnectedNo = 2;
|
||||
PrevConnected->NextConnected = nullptr;
|
||||
@@ -1299,27 +1299,27 @@ void TDynamicObject::CouplersDettach(double MinDist, int MyScanDir) {
|
||||
// za to zawsze odłączamy siebie
|
||||
PrevConnected = nullptr;
|
||||
PrevConnectedNo = 2; // sprzęg 0 nie podłączony
|
||||
MoverParameters->Couplers[ TMoverParameters::side::front ].Connected = nullptr;
|
||||
MoverParameters->Couplers[ side::front ].Connected = nullptr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// pojazd od strony sprzęgu 1
|
||||
if( ( NextConnected != nullptr )
|
||||
&& ( MoverParameters->Couplers[ TMoverParameters::side::rear ].CoupleDist > MinDist ) ) {
|
||||
&& ( MoverParameters->Couplers[ side::rear ].CoupleDist > MinDist ) ) {
|
||||
// sprzęgi wirtualne zawsze przekraczają
|
||||
if( ( NextConnectedNo == TMoverParameters::side::front ?
|
||||
if( ( NextConnectedNo == side::front ?
|
||||
NextConnected->PrevConnected :
|
||||
NextConnected->NextConnected )
|
||||
== this) {
|
||||
// Ra: nie rozłączamy znalezionego, jeżeli nie do nas podłączony
|
||||
// (może jechać w innym kierunku)
|
||||
NextConnected->MoverParameters->Couplers[ NextConnectedNo ].Connected = nullptr;
|
||||
if( NextConnectedNo == TMoverParameters::side::front ) {
|
||||
if( NextConnectedNo == side::front ) {
|
||||
// sprzęg 0 nie podłączony
|
||||
NextConnected->PrevConnectedNo = 2;
|
||||
NextConnected->PrevConnected = nullptr;
|
||||
}
|
||||
else if( NextConnectedNo == TMoverParameters::side::rear ) {
|
||||
else if( NextConnectedNo == side::rear ) {
|
||||
// sprzęg 1 nie podłączony
|
||||
NextConnected->NextConnectedNo = 2;
|
||||
NextConnected->NextConnected = nullptr;
|
||||
@@ -1411,7 +1411,7 @@ void TDynamicObject::ABuScanObjects( int Direction, double Distance )
|
||||
// siebie można bezpiecznie podłączyć jednostronnie do znalezionego
|
||||
MoverParameters->Attach( mycoupler, foundcoupler, foundobject->MoverParameters, coupling::faux );
|
||||
// MoverParameters->Couplers[MyCouplFound].Render=false; //wirtualnego nie renderujemy
|
||||
if( mycoupler == TMoverParameters::side::front ) {
|
||||
if( mycoupler == side::front ) {
|
||||
PrevConnected = foundobject; // pojazd od strony sprzęgu 0
|
||||
PrevConnectedNo = foundcoupler;
|
||||
}
|
||||
@@ -1422,7 +1422,7 @@ void TDynamicObject::ABuScanObjects( int Direction, double Distance )
|
||||
|
||||
if( foundobject->MoverParameters->Couplers[ foundcoupler ].CouplingFlag == coupling::faux ) {
|
||||
// Ra: wpinamy się wirtualnym tylko jeśli znaleziony ma wirtualny sprzęg
|
||||
if( ( foundcoupler == TMoverParameters::side::front ?
|
||||
if( ( foundcoupler == side::front ?
|
||||
foundobject->PrevConnected :
|
||||
foundobject->NextConnected )
|
||||
!= this ) {
|
||||
@@ -1430,13 +1430,13 @@ void TDynamicObject::ABuScanObjects( int Direction, double Distance )
|
||||
// otherwise we risk leaving the target's connected vehicle with active one-side connection
|
||||
foundobject->CouplersDettach(
|
||||
1.0,
|
||||
( foundcoupler == TMoverParameters::side::front ?
|
||||
( foundcoupler == side::front ?
|
||||
1 :
|
||||
-1 ) );
|
||||
}
|
||||
foundobject->MoverParameters->Attach( foundcoupler, mycoupler, this->MoverParameters, coupling::faux );
|
||||
|
||||
if( foundcoupler == TMoverParameters::side::front ) {
|
||||
if( foundcoupler == side::front ) {
|
||||
// jeśli widoczny sprzęg 0 znalezionego
|
||||
if( ( DebugModeFlag )
|
||||
&& ( foundobject->PrevConnected )
|
||||
@@ -1553,8 +1553,6 @@ TDynamicObject::TDynamicObject()
|
||||
iAxleFirst = 0; // numer pierwszej osi w kierunku ruchu (przełączenie
|
||||
// następuje, gdy osie sa na
|
||||
// tym samym torze)
|
||||
iInventory = 0; // flagi bitowe posiadanych submodeli (zaktualizuje się po
|
||||
// wczytaniu MMD)
|
||||
RaLightsSet(0, 0); // początkowe zerowanie stanu świateł
|
||||
// Ra: domyślne ilości animacji dla zgodności wstecz (gdy brak ilości podanych
|
||||
// w MMD)
|
||||
@@ -1942,19 +1940,19 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
|
||||
btEndSignals21.Init("endsignal23", mdModel, false);
|
||||
btEndSignals13.Init("endsignal12", mdModel, false);
|
||||
btEndSignals23.Init("endsignal22", mdModel, false);
|
||||
iInventory |= btEndSignals11.Active() ? 0x01 : 0; // informacja, czy ma poszczególne światła
|
||||
iInventory |= btEndSignals21.Active() ? 0x02 : 0;
|
||||
iInventory |= btEndSignals13.Active() ? 0x04 : 0;
|
||||
iInventory |= btEndSignals23.Active() ? 0x08 : 0;
|
||||
iInventory[ side::front ] |= btEndSignals11.Active() ? light::redmarker_left : 0; // informacja, czy ma poszczególne światła
|
||||
iInventory[ side::front ] |= btEndSignals13.Active() ? light::redmarker_right : 0;
|
||||
iInventory[ side::rear ] |= btEndSignals21.Active() ? light::redmarker_left : 0;
|
||||
iInventory[ side::rear ] |= btEndSignals23.Active() ? light::redmarker_right : 0;
|
||||
// ABu: to niestety zostawione dla kompatybilnosci modeli:
|
||||
btEndSignals1.Init("endsignals1", mdModel, false);
|
||||
btEndSignals2.Init("endsignals2", mdModel, false);
|
||||
btEndSignalsTab1.Init("endtab1", mdModel, false);
|
||||
btEndSignalsTab2.Init("endtab2", mdModel, false);
|
||||
iInventory |= btEndSignals1.Active() ? 0x10 : 0;
|
||||
iInventory |= btEndSignals2.Active() ? 0x20 : 0;
|
||||
iInventory |= btEndSignalsTab1.Active() ? 0x40 : 0; // tabliczki blaszane
|
||||
iInventory |= btEndSignalsTab2.Active() ? 0x80 : 0;
|
||||
iInventory[ side::front ] |= btEndSignals1.Active() ? ( light::redmarker_left | light::redmarker_right ) : 0;
|
||||
iInventory[ side::front ] |= btEndSignalsTab1.Active() ? light::rearendsignals : 0; // tabliczki blaszane
|
||||
iInventory[ side::rear ] |= btEndSignals2.Active() ? ( light::redmarker_left | light::redmarker_right ) : 0;
|
||||
iInventory[ side::rear ] |= btEndSignalsTab2.Active() ? light::rearendsignals : 0;
|
||||
// ABu Uwaga! tu zmienic w modelu!
|
||||
btHeadSignals11.Init("headlamp13", mdModel, false); // lewe
|
||||
btHeadSignals12.Init("headlamp11", mdModel, false); // górne
|
||||
@@ -1962,7 +1960,13 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
|
||||
btHeadSignals21.Init("headlamp23", mdModel, false);
|
||||
btHeadSignals22.Init("headlamp21", mdModel, false);
|
||||
btHeadSignals23.Init("headlamp22", mdModel, false);
|
||||
btMechanik1.Init("mechanik1", mdLowPolyInt, false);
|
||||
iInventory[ side::front ] |= btHeadSignals11.Active() ? light::headlight_left : 0;
|
||||
iInventory[ side::front ] |= btHeadSignals12.Active() ? light::headlight_upper : 0;
|
||||
iInventory[ side::front ] |= btHeadSignals13.Active() ? light::headlight_right : 0;
|
||||
iInventory[ side::rear ] |= btHeadSignals21.Active() ? light::headlight_left : 0;
|
||||
iInventory[ side::rear ] |= btHeadSignals22.Active() ? light::headlight_upper : 0;
|
||||
iInventory[ side::rear ] |= btHeadSignals23.Active() ? light::headlight_right : 0;
|
||||
btMechanik1.Init("mechanik1", mdLowPolyInt, false);
|
||||
btMechanik2.Init("mechanik2", mdLowPolyInt, false);
|
||||
TurnOff(); // resetowanie zmiennych submodeli
|
||||
|
||||
@@ -5000,7 +5004,7 @@ void TDynamicObject::RaLightsSet(int head, int rear)
|
||||
// pojazdu
|
||||
if (!MoverParameters)
|
||||
return; // może tego nie być na początku
|
||||
if (rear == 2 + 32 + 64)
|
||||
if (rear == ( light::redmarker_left | light::redmarker_right | light::rearendsignals ) )
|
||||
{ // jeśli koniec pociągu, to trzeba ustalić, czy
|
||||
// jest tam czynna lokomotywa
|
||||
// EN57 może nie mieć końcówek od środka członu
|
||||
@@ -5009,15 +5013,20 @@ void TDynamicObject::RaLightsSet(int head, int rear)
|
||||
{ // jeśli ma zarówno światła jak i końcówki, ustalić, czy jest w stanie
|
||||
// aktywnym
|
||||
// np. lokomotywa na zimno będzie mieć końcówki a nie światła
|
||||
rear = 64; // tablice blaszane
|
||||
rear = light::rearendsignals; // tablice blaszane
|
||||
// trzeba to uzależnić od "załączenia baterii" w pojeździe
|
||||
}
|
||||
if (rear == 2 + 32 + 64) // jeśli nadal obydwie możliwości
|
||||
if (iInventory &
|
||||
(iDirection ? 0x2A : 0x15)) // czy ma jakieś światła czerowone od danej strony
|
||||
rear = 2 + 32; // dwa światła czerwone
|
||||
else
|
||||
rear = 64; // tablice blaszane
|
||||
if( rear == ( light::redmarker_left | light::redmarker_right | light::rearendsignals ) ) // jeśli nadal obydwie możliwości
|
||||
if( iInventory[
|
||||
( iDirection ?
|
||||
side::rear :
|
||||
side::front ) ] & ( light::redmarker_left | light::redmarker_right ) ) {
|
||||
// czy ma jakieś światła czerowone od danej strony
|
||||
rear = ( light::redmarker_left | light::redmarker_right ); // dwa światła czerwone
|
||||
}
|
||||
else {
|
||||
rear = light::rearendsignals; // tablice blaszane
|
||||
}
|
||||
}
|
||||
if (iDirection) // w zależności od kierunku pojazdu w składzie
|
||||
{ // jesli pojazd stoi sprzęgiem 0 w stronę czoła
|
||||
@@ -5439,7 +5448,7 @@ vehicle_table::update_traction( TDynamicObject *Vehicle ) {
|
||||
// pętla po pantografach
|
||||
auto pantograph { Vehicle->pants[ pantographindex ].fParamPants };
|
||||
if( true == (
|
||||
pantographindex == TMoverParameters::side::front ?
|
||||
pantographindex == side::front ?
|
||||
Vehicle->MoverParameters->PantFrontUp :
|
||||
Vehicle->MoverParameters->PantRearUp ) ) {
|
||||
// jeśli pantograf podniesiony
|
||||
|
||||
3
DynObj.h
3
DynObj.h
@@ -338,7 +338,7 @@ private:
|
||||
bool bBrakeAcc;
|
||||
sound* rsUnbrake = nullptr; // yB - odglos luzowania
|
||||
float ModCamRot;
|
||||
int iInventory; // flagi bitowe posiadanych submodeli (np. świateł)
|
||||
int iInventory[ 2 ] { 0, 0 }; // flagi bitowe posiadanych submodeli (np. świateł)
|
||||
void TurnOff();
|
||||
|
||||
public:
|
||||
@@ -464,6 +464,7 @@ private:
|
||||
void RadioStop();
|
||||
void Damage(char flag);
|
||||
void RaLightsSet(int head, int rear);
|
||||
int LightList( side const Side ) const { return iInventory[ Side ]; }
|
||||
TDynamicObject * FirstFind(int &coupler_nr, int cf = 1);
|
||||
float GetEPP(); // wyliczanie sredniego cisnienia w PG
|
||||
int DirectionSet(int d); // ustawienie kierunku w składzie
|
||||
|
||||
@@ -130,13 +130,13 @@ bool TEventLauncher::check_conditions()
|
||||
bool bCond = false;
|
||||
if (iKey != 0)
|
||||
{
|
||||
// tylko jeśli okno jest aktywne
|
||||
// tylko jeśli okno jest aktywne
|
||||
if( iKey > 255 ) {
|
||||
// key and modifier
|
||||
auto const modifier = ( iKey & 0xff00 ) >> 8;
|
||||
bCond = ( Console::Pressed( iKey & 0xff ) )
|
||||
&& ( modifier & 1 ? Global::shiftState : true )
|
||||
&& ( modifier & 2 ? Global::ctrlState : true );
|
||||
&& ( ( modifier & 1 ) ? Global::shiftState : true )
|
||||
&& ( ( modifier & 2 ) ? Global::ctrlState : true );
|
||||
}
|
||||
else {
|
||||
// just key
|
||||
|
||||
@@ -18,7 +18,7 @@ class TEventLauncher : public editor::basic_node {
|
||||
|
||||
public:
|
||||
// constructor
|
||||
TEventLauncher( scene::node_data const &Nodedata ) : basic_node( Nodedata ) {}
|
||||
explicit TEventLauncher( scene::node_data const &Nodedata ) : basic_node( Nodedata ) {}
|
||||
// legacy constructor
|
||||
TEventLauncher() = default;
|
||||
|
||||
|
||||
@@ -140,6 +140,11 @@ static int const ctrain_passenger = 16; //mostek przejściowy
|
||||
static int const ctrain_scndpneumatic = 32; //przewody 8 atm (żółte; zasilanie powietrzem)
|
||||
static int const ctrain_heating = 64; //przewody ogrzewania WN
|
||||
static int const ctrain_depot = 128; //nie rozłączalny podczas zwykłych manewrów (międzyczłonowy), we wpisie wartość ujemna
|
||||
// vehicle sides; exclusive
|
||||
enum side {
|
||||
front = 0,
|
||||
rear
|
||||
};
|
||||
// possible coupling types; can be combined
|
||||
enum coupling {
|
||||
faux = 0x0,
|
||||
@@ -162,6 +167,16 @@ enum range {
|
||||
enum start {
|
||||
manual,
|
||||
automatic
|
||||
};
|
||||
// recognized vehicle light locations and types; can be combined
|
||||
enum light {
|
||||
|
||||
headlight_left = 0x01,
|
||||
redmarker_left = 0x02,
|
||||
headlight_upper = 0x04,
|
||||
headlight_right = 0x10,
|
||||
redmarker_right = 0x20,
|
||||
rearendsignals = 0x40
|
||||
};
|
||||
/*typ hamulca elektrodynamicznego*/
|
||||
static int const dbrake_none = 0;
|
||||
@@ -699,15 +714,6 @@ public:
|
||||
int LightsDefPos = 1;
|
||||
bool LightsWrap = false;
|
||||
int Lights[2][17]; // pozycje świateł, przód - tył, 1 .. 16
|
||||
enum light {
|
||||
|
||||
headlight_left = 0x01,
|
||||
redmarker_left = 0x02,
|
||||
headlight_upper = 0x04,
|
||||
headlight_right = 0x10,
|
||||
redmarker_right = 0x20,
|
||||
rearendsignals = 0x40
|
||||
};
|
||||
int ScndInMain{ 0 }; /*zaleznosc bocznika od nastawnika*/
|
||||
bool MBrake = false; /*Czy jest hamulec reczny*/
|
||||
double StopBrakeDecc = 0.0;
|
||||
@@ -802,10 +808,6 @@ public:
|
||||
TRotation Rot;
|
||||
std::string Name; /*nazwa wlasna*/
|
||||
TCoupling Couplers[2]; //urzadzenia zderzno-sprzegowe, polaczenia miedzy wagonami
|
||||
enum side {
|
||||
front = 0,
|
||||
rear
|
||||
};
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
double HVCouplers[ 2 ][ 2 ]; //przewod WN
|
||||
enum hvcoupler {
|
||||
|
||||
@@ -294,10 +294,13 @@ bool FileExists( std::string const &Filename ) {
|
||||
}
|
||||
|
||||
// returns time of last modification for specified file
|
||||
time_t
|
||||
std::time_t
|
||||
last_modified( std::string const &Filename ) {
|
||||
|
||||
std::string fn = Filename;
|
||||
std::replace(fn.begin(), fn.end(), '\\', '/');
|
||||
struct stat filestat;
|
||||
if( ::stat( Filename.c_str(), &filestat ) == 0 ) { return filestat.st_mtime; }
|
||||
else { return 0; }
|
||||
if( ::stat( fn.c_str(), &filestat ) == 0 )
|
||||
return filestat.st_mtime;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -160,4 +160,4 @@ extract_value( bool &Variable, std::string const &Key, std::string const &Input,
|
||||
bool FileExists( std::string const &Filename );
|
||||
|
||||
// returns time of last modification for specified file
|
||||
time_t last_modified( std::string const &Filename );
|
||||
std::time_t last_modified( std::string const &Filename );
|
||||
|
||||
@@ -137,7 +137,7 @@ bool TMemCell::Compare( std::string const &szTestText, double const fTestValue1,
|
||||
&& ( !TestFlag( CheckMask, conditional_memval2 ) || ( fValue2 == fTestValue2 ) ) );
|
||||
};
|
||||
|
||||
bool TMemCell::IsVelocity()
|
||||
bool TMemCell::IsVelocity() const
|
||||
{ // sprawdzenie, czy event odczytu tej komórki ma być do skanowania, czy do kolejkowania
|
||||
if (eCommand == cm_SetVelocity)
|
||||
return true;
|
||||
|
||||
@@ -19,7 +19,7 @@ class TMemCell : public editor::basic_node {
|
||||
public:
|
||||
std::string asTrackName; // McZapkie-100302 - zeby nazwe toru na ktory jest Putcommand wysylane pamietac
|
||||
|
||||
TMemCell( scene::node_data const &Nodedata );
|
||||
explicit TMemCell( scene::node_data const &Nodedata );
|
||||
|
||||
void
|
||||
UpdateValues( std::string const &szNewText, double const fNewValue1, double const fNewValue2, int const CheckMask );
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
return bCommand; };
|
||||
void StopCommandSent();
|
||||
TCommandType CommandCheck();
|
||||
bool IsVelocity();
|
||||
bool IsVelocity() const;
|
||||
void AssignEvents(TEvent *e);
|
||||
|
||||
private:
|
||||
|
||||
@@ -1743,7 +1743,7 @@ void TModel3d::Init()
|
||||
// 2012-02 funkcje do tworzenia terenu z E3D
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
int TModel3d::TerrainCount()
|
||||
int TModel3d::TerrainCount() const
|
||||
{ // zliczanie kwadratów kilometrowych (główna
|
||||
// linia po Next) do tworznia tablicy
|
||||
int i = 0;
|
||||
|
||||
14
Model3d.h
14
Model3d.h
@@ -184,15 +184,13 @@ public:
|
||||
};
|
||||
void InitialRotate(bool doit);
|
||||
void BinInit(TSubModel *s, float4x4 *m, std::vector<std::string> *t, std::vector<std::string> *n, bool dynamic);
|
||||
void ReplacableSet(material_handle const *r, int a)
|
||||
{
|
||||
static void ReplacableSet(material_handle const *r, int a) {
|
||||
ReplacableSkinId = r;
|
||||
iAlpha = a;
|
||||
};
|
||||
iAlpha = a; };
|
||||
void Name_Material( std::string const &Name );
|
||||
void Name( std::string const &Name );
|
||||
// Ra: funkcje do budowania terenu z E3D
|
||||
int Flags() { return iFlags; };
|
||||
int Flags() const { return iFlags; };
|
||||
void UnFlagNext() { iFlags &= 0x00FFFFFF; };
|
||||
void ColorsSet( glm::vec3 const &Ambient, glm::vec3 const &Diffuse, glm::vec3 const &Specular );
|
||||
// sets light level (alpha component of illumination color) to specified value
|
||||
@@ -201,7 +199,7 @@ public:
|
||||
return fMatrix ? *(fMatrix->TranslationGet()) + v_TransVector : v_TransVector; }
|
||||
inline float3 Translation2Get() {
|
||||
return *(fMatrix->TranslationGet()) + Child->Translation1Get(); }
|
||||
material_handle GetMaterial() {
|
||||
material_handle GetMaterial() const {
|
||||
return m_material; }
|
||||
void ParentMatrix(float4x4 *m);
|
||||
float MaxY( float4x4 const &m );
|
||||
@@ -250,8 +248,8 @@ public:
|
||||
void SaveToBinFile(std::string const &FileName);
|
||||
int Flags() const { return iFlags; };
|
||||
void Init();
|
||||
std::string NameGet() { return m_filename; };
|
||||
int TerrainCount();
|
||||
std::string NameGet() const { return m_filename; };
|
||||
int TerrainCount() const;
|
||||
TSubModel * TerrainSquare(int n);
|
||||
void deserialize(std::istream &s, size_t size, bool dynamic);
|
||||
};
|
||||
|
||||
@@ -61,11 +61,11 @@ class garbage_collector {
|
||||
|
||||
public:
|
||||
// constructor:
|
||||
garbage_collector( Container_ &Container, int const Secondstolive, int const Sweepsize, std::string const Resourcename = "resource" ) :
|
||||
m_container( Container ),
|
||||
m_unusedresourcetimetolive { std::chrono::seconds( Secondstolive ) },
|
||||
m_unusedresourcesweepsize( Sweepsize ),
|
||||
m_resourcename( Resourcename )
|
||||
garbage_collector( Container_ &Container, unsigned int const Secondstolive, std::size_t const Sweepsize, std::string const Resourcename = "resource" ) :
|
||||
m_unusedresourcetimetolive{ std::chrono::seconds{ Secondstolive } },
|
||||
m_unusedresourcesweepsize{ Sweepsize },
|
||||
m_resourcename{ Resourcename },
|
||||
m_container{ Container }
|
||||
{}
|
||||
|
||||
// methods:
|
||||
|
||||
@@ -674,7 +674,7 @@ opengl_texture::release( bool const Backup ) {
|
||||
}
|
||||
|
||||
void
|
||||
opengl_texture::set_filtering() {
|
||||
opengl_texture::set_filtering() const {
|
||||
|
||||
// default texture mode
|
||||
::glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
|
||||
@@ -61,7 +61,7 @@ private:
|
||||
void load_DDS();
|
||||
void load_TEX();
|
||||
void load_TGA();
|
||||
void set_filtering();
|
||||
void set_filtering() const;
|
||||
void downsize( GLuint const Format );
|
||||
|
||||
// members
|
||||
|
||||
23
Track.h
23
Track.h
@@ -96,16 +96,11 @@ class TSwitchExtension
|
||||
|
||||
class TIsolated
|
||||
{ // obiekt zbierający zajętości z kilku odcinków
|
||||
int iAxles = 0; // ilość osi na odcinkach obsługiwanych przez obiekt
|
||||
TIsolated *pNext = nullptr; // odcinki izolowane są trzymane w postaci listy jednikierunkowej
|
||||
static TIsolated *pRoot; // początek listy
|
||||
public:
|
||||
std::string asName; // nazwa obiektu, baza do nazw eventów
|
||||
TEvent *evBusy = nullptr; // zdarzenie wyzwalane po zajęciu grupy
|
||||
TEvent *evFree = nullptr; // zdarzenie wyzwalane po całkowitym zwolnieniu zajętości grupy
|
||||
TMemCell *pMemCell = nullptr; // automatyczna komórka pamięci, która współpracuje z odcinkiem izolowanym
|
||||
public:
|
||||
// constructors
|
||||
TIsolated();
|
||||
TIsolated(const std::string &n, TIsolated *i);
|
||||
// methods
|
||||
static void DeleteAll();
|
||||
static TIsolated * Find(const std::string &n); // znalezienie obiektu albo utworzenie nowego
|
||||
void Modify(int i, TDynamicObject *o); // dodanie lub odjęcie osi
|
||||
@@ -115,6 +110,16 @@ class TIsolated
|
||||
return (pRoot); };
|
||||
TIsolated * Next() {
|
||||
return (pNext); };
|
||||
// members
|
||||
std::string asName; // nazwa obiektu, baza do nazw eventów
|
||||
TEvent *evBusy { nullptr }; // zdarzenie wyzwalane po zajęciu grupy
|
||||
TEvent *evFree { nullptr }; // zdarzenie wyzwalane po całkowitym zwolnieniu zajętości grupy
|
||||
TMemCell *pMemCell { nullptr }; // automatyczna komórka pamięci, która współpracuje z odcinkiem izolowanym
|
||||
private:
|
||||
// members
|
||||
int iAxles { 0 }; // ilość osi na odcinkach obsługiwanych przez obiekt
|
||||
TIsolated *pNext { nullptr }; // odcinki izolowane są trzymane w postaci listy jednikierunkowej
|
||||
static TIsolated *pRoot; // początek listy
|
||||
};
|
||||
|
||||
// trajektoria ruchu - opakowanie
|
||||
@@ -184,7 +189,7 @@ public:
|
||||
bool ScannedFlag = false; // McZapkie: do zaznaczania kolorem torów skanowanych przez AI
|
||||
TGroundNode *nFouling[ 2 ] = { nullptr, nullptr }; // współrzędne ukresu albo oporu kozła
|
||||
|
||||
TTrack( scene::node_data const &Nodedata );
|
||||
explicit TTrack( scene::node_data const &Nodedata );
|
||||
virtual ~TTrack();
|
||||
|
||||
void Init();
|
||||
|
||||
@@ -53,7 +53,7 @@ class TTraction : public editor::basic_node {
|
||||
glm::dvec3 m_origin;
|
||||
geometry_handle m_geometry;
|
||||
|
||||
TTraction( scene::node_data const &Nodedata );
|
||||
explicit TTraction( scene::node_data const &Nodedata );
|
||||
|
||||
void Load( cParser *parser, glm::dvec3 const &pOrigin );
|
||||
// set origin point
|
||||
|
||||
578
Train.cpp
578
Train.cpp
@@ -247,6 +247,8 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
|
||||
{ user_command::motoroverloadrelaythresholdtoggle, &TTrain::OnCommand_motoroverloadrelaythresholdtoggle },
|
||||
{ user_command::motoroverloadrelayreset, &TTrain::OnCommand_motoroverloadrelayreset },
|
||||
{ user_command::heatingtoggle, &TTrain::OnCommand_heatingtoggle },
|
||||
{ user_command::lightspresetactivatenext, &TTrain::OnCommand_lightspresetactivatenext },
|
||||
{ user_command::lightspresetactivateprevious, &TTrain::OnCommand_lightspresetactivateprevious },
|
||||
{ user_command::headlighttoggleleft, &TTrain::OnCommand_headlighttoggleleft },
|
||||
{ user_command::headlighttoggleright, &TTrain::OnCommand_headlighttoggleright },
|
||||
{ user_command::headlighttoggleupper, &TTrain::OnCommand_headlighttoggleupper },
|
||||
@@ -2145,6 +2147,60 @@ void TTrain::OnCommand_motoroverloadrelayreset( TTrain *Train, command_data cons
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_lightspresetactivatenext( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if( Train->mvOccupied->LightsPosNo == 0 ) {
|
||||
// lights are controlled by preset selector
|
||||
return;
|
||||
}
|
||||
if( Command.action != GLFW_PRESS ) {
|
||||
// one change per key press
|
||||
return;
|
||||
}
|
||||
|
||||
if( ( Train->mvOccupied->LightsPos < Train->mvOccupied->LightsPosNo )
|
||||
|| ( true == Train->mvOccupied->LightsWrap ) ) {
|
||||
// active light preset is stored as value in range 1-LigthPosNo
|
||||
Train->mvOccupied->LightsPos = (
|
||||
Train->mvOccupied->LightsPos < Train->mvOccupied->LightsPosNo ?
|
||||
Train->mvOccupied->LightsPos + 1 :
|
||||
1 ); // wrap mode
|
||||
|
||||
Train->SetLights();
|
||||
// visual feedback
|
||||
if( Train->ggLightsButton.SubModel != nullptr ) {
|
||||
Train->ggLightsButton.UpdateValue( Train->mvOccupied->LightsPos - 1, Train->dsbSwitch );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_lightspresetactivateprevious( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if( Train->mvOccupied->LightsPosNo == 0 ) {
|
||||
// lights are controlled by preset selector
|
||||
return;
|
||||
}
|
||||
if( Command.action != GLFW_PRESS ) {
|
||||
// one change per key press
|
||||
return;
|
||||
}
|
||||
|
||||
if( ( Train->mvOccupied->LightsPos > 1 )
|
||||
|| ( true == Train->mvOccupied->LightsWrap ) ) {
|
||||
// active light preset is stored as value in range 1-LigthPosNo
|
||||
Train->mvOccupied->LightsPos = (
|
||||
Train->mvOccupied->LightsPos > 1 ?
|
||||
Train->mvOccupied->LightsPos - 1 :
|
||||
Train->mvOccupied->LightsPosNo ); // wrap mode
|
||||
|
||||
Train->SetLights();
|
||||
// visual feedback
|
||||
if( Train->ggLightsButton.SubModel != nullptr ) {
|
||||
Train->ggLightsButton.UpdateValue( Train->mvOccupied->LightsPos - 1, Train->dsbSwitch );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TTrain::OnCommand_headlighttoggleleft( TTrain *Train, command_data const &Command ) {
|
||||
|
||||
if( Train->mvOccupied->LightsPosNo > 0 ) {
|
||||
@@ -2152,12 +2208,12 @@ void TTrain::OnCommand_headlighttoggleleft( TTrain *Train, command_data const &C
|
||||
return;
|
||||
}
|
||||
|
||||
int const lightsindex =
|
||||
int const vehicleside =
|
||||
( Train->mvOccupied->ActiveCab == 1 ?
|
||||
0 :
|
||||
1 );
|
||||
side::front :
|
||||
side::rear );
|
||||
|
||||
bool current_state = (bool)(Train->DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::headlight_left);
|
||||
bool current_state = (bool)(Train->DynamicObject->iLights[ vehicleside ] & light::headlight_left);
|
||||
|
||||
if (Command.desired_state == command_data::ON && current_state)
|
||||
return;
|
||||
@@ -2168,17 +2224,17 @@ void TTrain::OnCommand_headlighttoggleleft( TTrain *Train, command_data const &C
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
if( !current_state ) {
|
||||
// turn on
|
||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_left;
|
||||
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_left;
|
||||
// visual feedback
|
||||
Train->ggLeftLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||
// if the light is controlled by 3-way switch, disable marker light
|
||||
if( Train->ggLeftEndLightButton.SubModel == nullptr ) {
|
||||
Train->DynamicObject->iLights[ lightsindex ] &= ~TMoverParameters::light::redmarker_left;
|
||||
Train->DynamicObject->iLights[ vehicleside ] &= ~light::redmarker_left;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//turn off
|
||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_left;
|
||||
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_left;
|
||||
// visual feedback
|
||||
Train->ggLeftLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||
}
|
||||
@@ -2192,12 +2248,12 @@ void TTrain::OnCommand_headlighttoggleright( TTrain *Train, command_data const &
|
||||
return;
|
||||
}
|
||||
|
||||
int const lightsindex =
|
||||
int const vehicleside =
|
||||
( Train->mvOccupied->ActiveCab == 1 ?
|
||||
0 :
|
||||
1 );
|
||||
side::front :
|
||||
side::rear );
|
||||
|
||||
bool current_state = (bool)(Train->DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::headlight_right);
|
||||
bool current_state = (bool)(Train->DynamicObject->iLights[ vehicleside ] & light::headlight_right);
|
||||
|
||||
if (Command.desired_state == command_data::ON && current_state)
|
||||
return;
|
||||
@@ -2208,17 +2264,17 @@ void TTrain::OnCommand_headlighttoggleright( TTrain *Train, command_data const &
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
if( !current_state ) {
|
||||
// turn on
|
||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_right;
|
||||
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_right;
|
||||
// visual feedback
|
||||
Train->ggRightLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||
// if the light is controlled by 3-way switch, disable marker light
|
||||
if( Train->ggRightEndLightButton.SubModel == nullptr ) {
|
||||
Train->DynamicObject->iLights[ lightsindex ] &= ~TMoverParameters::light::redmarker_right;
|
||||
Train->DynamicObject->iLights[ vehicleside ] &= ~light::redmarker_right;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//turn off
|
||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_right;
|
||||
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_right;
|
||||
// visual feedback
|
||||
Train->ggRightLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||
}
|
||||
@@ -2232,12 +2288,12 @@ void TTrain::OnCommand_headlighttoggleupper( TTrain *Train, command_data const &
|
||||
return;
|
||||
}
|
||||
|
||||
int const lightsindex =
|
||||
int const vehicleside =
|
||||
( Train->mvOccupied->ActiveCab == 1 ?
|
||||
0 :
|
||||
1 );
|
||||
side::front :
|
||||
side::rear );
|
||||
|
||||
bool current_state = (bool)(Train->DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::headlight_upper);
|
||||
bool current_state = (bool)(Train->DynamicObject->iLights[ vehicleside ] & light::headlight_upper);
|
||||
|
||||
if (Command.desired_state == command_data::ON && current_state)
|
||||
return;
|
||||
@@ -2248,13 +2304,13 @@ void TTrain::OnCommand_headlighttoggleupper( TTrain *Train, command_data const &
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
if( !current_state ) {
|
||||
// turn on
|
||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_upper;
|
||||
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_upper;
|
||||
// visual feedback
|
||||
Train->ggUpperLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||
}
|
||||
else {
|
||||
//turn off
|
||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_upper;
|
||||
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_upper;
|
||||
// visual feedback
|
||||
Train->ggUpperLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||
}
|
||||
@@ -2268,16 +2324,16 @@ void TTrain::OnCommand_redmarkertoggleleft( TTrain *Train, command_data const &C
|
||||
return;
|
||||
}
|
||||
|
||||
int const lightsindex =
|
||||
int const vehicleside =
|
||||
( Train->mvOccupied->ActiveCab == 1 ?
|
||||
0 :
|
||||
1 );
|
||||
side::front :
|
||||
side::rear );
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
if( ( Train->DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::redmarker_left ) == 0 ) {
|
||||
if( ( Train->DynamicObject->iLights[ vehicleside ] & light::redmarker_left ) == 0 ) {
|
||||
// turn on
|
||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_left;
|
||||
Train->DynamicObject->iLights[ vehicleside ] ^= light::redmarker_left;
|
||||
// visual feedback
|
||||
if( Train->ggLeftEndLightButton.SubModel != nullptr ) {
|
||||
Train->ggLeftEndLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||
@@ -2287,12 +2343,12 @@ void TTrain::OnCommand_redmarkertoggleleft( TTrain *Train, command_data const &C
|
||||
// this is crude, but for now will do
|
||||
Train->ggLeftLightButton.UpdateValue( -1.0, Train->dsbSwitch );
|
||||
// if the light is controlled by 3-way switch, disable the headlight
|
||||
Train->DynamicObject->iLights[ lightsindex ] &= ~TMoverParameters::light::headlight_left;
|
||||
Train->DynamicObject->iLights[ vehicleside ] &= ~light::headlight_left;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//turn off
|
||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_left;
|
||||
Train->DynamicObject->iLights[ vehicleside ] ^= light::redmarker_left;
|
||||
// visual feedback
|
||||
if( Train->ggLeftEndLightButton.SubModel != nullptr ) {
|
||||
Train->ggLeftEndLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||
@@ -2313,16 +2369,16 @@ void TTrain::OnCommand_redmarkertoggleright( TTrain *Train, command_data const &
|
||||
return;
|
||||
}
|
||||
|
||||
int const lightsindex =
|
||||
int const vehicleside =
|
||||
( Train->mvOccupied->ActiveCab == 1 ?
|
||||
0 :
|
||||
1 );
|
||||
side::front :
|
||||
side::rear );
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
if( ( Train->DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::redmarker_right ) == 0 ) {
|
||||
if( ( Train->DynamicObject->iLights[ vehicleside ] & light::redmarker_right ) == 0 ) {
|
||||
// turn on
|
||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_right;
|
||||
Train->DynamicObject->iLights[ vehicleside ] ^= light::redmarker_right;
|
||||
// visual feedback
|
||||
if( Train->ggRightEndLightButton.SubModel != nullptr ) {
|
||||
Train->ggRightEndLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||
@@ -2332,12 +2388,12 @@ void TTrain::OnCommand_redmarkertoggleright( TTrain *Train, command_data const &
|
||||
// this is crude, but for now will do
|
||||
Train->ggRightLightButton.UpdateValue( -1.0, Train->dsbSwitch );
|
||||
// if the light is controlled by 3-way switch, disable the headlight
|
||||
Train->DynamicObject->iLights[ lightsindex ] &= ~TMoverParameters::light::headlight_right;
|
||||
Train->DynamicObject->iLights[ vehicleside ] &= ~light::headlight_right;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//turn off
|
||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_right;
|
||||
Train->DynamicObject->iLights[ vehicleside ] ^= light::redmarker_right;
|
||||
// visual feedback
|
||||
if( Train->ggRightEndLightButton.SubModel != nullptr ) {
|
||||
Train->ggRightEndLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||
@@ -2358,23 +2414,23 @@ void TTrain::OnCommand_headlighttogglerearleft( TTrain *Train, command_data cons
|
||||
return;
|
||||
}
|
||||
|
||||
int const lightsindex =
|
||||
int const vehicleside =
|
||||
( Train->mvOccupied->ActiveCab == 1 ?
|
||||
1 :
|
||||
0 );
|
||||
side::rear :
|
||||
side::front );
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// NOTE: we toggle the light on opposite side, as 'rear right' is 'front left' on the rear end etc
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
if( ( Train->DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::headlight_right ) == 0 ) {
|
||||
if( ( Train->DynamicObject->iLights[ vehicleside ] & light::headlight_right ) == 0 ) {
|
||||
// turn on
|
||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_right;
|
||||
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_right;
|
||||
// visual feedback
|
||||
Train->ggRearLeftLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||
}
|
||||
else {
|
||||
//turn off
|
||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_right;
|
||||
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_right;
|
||||
// visual feedback
|
||||
Train->ggRearLeftLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||
}
|
||||
@@ -2388,23 +2444,23 @@ void TTrain::OnCommand_headlighttogglerearright( TTrain *Train, command_data con
|
||||
return;
|
||||
}
|
||||
|
||||
int const lightsindex =
|
||||
int const vehicleside =
|
||||
( Train->mvOccupied->ActiveCab == 1 ?
|
||||
1 :
|
||||
0 );
|
||||
side::rear :
|
||||
side::front );
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// NOTE: we toggle the light on opposite side, as 'rear right' is 'front left' on the rear end etc
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
if( ( Train->DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::headlight_left ) == 0 ) {
|
||||
if( ( Train->DynamicObject->iLights[ vehicleside ] & light::headlight_left ) == 0 ) {
|
||||
// turn on
|
||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_left;
|
||||
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_left;
|
||||
// visual feedback
|
||||
Train->ggRearRightLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||
}
|
||||
else {
|
||||
//turn off
|
||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_left;
|
||||
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_left;
|
||||
// visual feedback
|
||||
Train->ggRearRightLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||
}
|
||||
@@ -2418,22 +2474,22 @@ void TTrain::OnCommand_headlighttogglerearupper( TTrain *Train, command_data con
|
||||
return;
|
||||
}
|
||||
|
||||
int const lightsindex =
|
||||
int const vehicleside =
|
||||
( Train->mvOccupied->ActiveCab == 1 ?
|
||||
1 :
|
||||
0 );
|
||||
side::rear :
|
||||
side::front );
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
if( ( Train->DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::headlight_upper ) == 0 ) {
|
||||
if( ( Train->DynamicObject->iLights[ vehicleside ] & light::headlight_upper ) == 0 ) {
|
||||
// turn on
|
||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_upper;
|
||||
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_upper;
|
||||
// visual feedback
|
||||
Train->ggRearUpperLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||
}
|
||||
else {
|
||||
//turn off
|
||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::headlight_upper;
|
||||
Train->DynamicObject->iLights[ vehicleside ] ^= light::headlight_upper;
|
||||
// visual feedback
|
||||
Train->ggRearUpperLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||
}
|
||||
@@ -2447,23 +2503,23 @@ void TTrain::OnCommand_redmarkertogglerearleft( TTrain *Train, command_data cons
|
||||
return;
|
||||
}
|
||||
|
||||
int const lightsindex =
|
||||
int const vehicleside =
|
||||
( Train->mvOccupied->ActiveCab == 1 ?
|
||||
1 :
|
||||
0 );
|
||||
side::rear :
|
||||
side::front );
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// NOTE: we toggle the light on opposite side, as 'rear right' is 'front left' on the rear end etc
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
if( ( Train->DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::redmarker_right ) == 0 ) {
|
||||
if( ( Train->DynamicObject->iLights[ vehicleside ] & light::redmarker_right ) == 0 ) {
|
||||
// turn on
|
||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_right;
|
||||
Train->DynamicObject->iLights[ vehicleside ] ^= light::redmarker_right;
|
||||
// visual feedback
|
||||
Train->ggRearLeftEndLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||
}
|
||||
else {
|
||||
//turn off
|
||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_right;
|
||||
Train->DynamicObject->iLights[ vehicleside ] ^= light::redmarker_right;
|
||||
// visual feedback
|
||||
Train->ggRearLeftEndLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||
}
|
||||
@@ -2477,23 +2533,23 @@ void TTrain::OnCommand_redmarkertogglerearright( TTrain *Train, command_data con
|
||||
return;
|
||||
}
|
||||
|
||||
int const lightsindex =
|
||||
int const vehicleside =
|
||||
( Train->mvOccupied->ActiveCab == 1 ?
|
||||
1 :
|
||||
0 );
|
||||
side::rear :
|
||||
side::front );
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// NOTE: we toggle the light on opposite side, as 'rear right' is 'front left' on the rear end etc
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
if( ( Train->DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::redmarker_left ) == 0 ) {
|
||||
if( ( Train->DynamicObject->iLights[ vehicleside ] & light::redmarker_left ) == 0 ) {
|
||||
// turn on
|
||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_left;
|
||||
Train->DynamicObject->iLights[ vehicleside ] ^= light::redmarker_left;
|
||||
// visual feedback
|
||||
Train->ggRearRightEndLightButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||
}
|
||||
else {
|
||||
//turn off
|
||||
Train->DynamicObject->iLights[ lightsindex ] ^= TMoverParameters::light::redmarker_left;
|
||||
Train->DynamicObject->iLights[ vehicleside ] ^= light::redmarker_left;
|
||||
// visual feedback
|
||||
Train->ggRearRightEndLightButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||
}
|
||||
@@ -3014,7 +3070,8 @@ void TTrain::OnKeyDown(int cKey)
|
||||
DynamicObject->Mechanik->TakeControl(true);
|
||||
}
|
||||
}
|
||||
else if (cKey == Global::Keys[k_UpperSign]) // ABu 060205: światło górne -
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
else if (cKey == Global::Keys[k_UpperSign]) // ABu 060205: światło górne -
|
||||
// włączenie
|
||||
{
|
||||
if (mvOccupied->LightsPosNo > 0) //kręciolek od swiatel
|
||||
@@ -3031,6 +3088,7 @@ void TTrain::OnKeyDown(int cKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else // McZapkie-240302 - klawisze bez shifta
|
||||
{
|
||||
@@ -3127,8 +3185,7 @@ void TTrain::OnKeyDown(int cKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
// McZapkie-240302 - wylaczanie automatycznego pilota (w trybie ~debugmode
|
||||
// mozna tylko raz)
|
||||
// McZapkie-240302 - wylaczanie automatycznego pilota (w trybie ~debugmode mozna tylko raz)
|
||||
else if (cKey == GLFW_KEY_Q) // bez Shift
|
||||
{
|
||||
if (DynamicObject->Mechanik)
|
||||
@@ -3363,6 +3420,7 @@ if
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
else if (cKey == Global::Keys[k_UpperSign]) // ABu 060205: światło górne -
|
||||
// wyłączenie
|
||||
{
|
||||
@@ -3380,6 +3438,7 @@ if
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// else
|
||||
if (DebugModeFlag)
|
||||
{ // przesuwanie składu o 100m
|
||||
@@ -4432,9 +4491,6 @@ bool TTrain::Update( double const Deltatime )
|
||||
true :
|
||||
false ) );
|
||||
|
||||
// hunter-261211: jakis stary kod (i niezgodny z prawda),
|
||||
// zahaszowalem i poprawilem
|
||||
// youBy-220913: ale przyda sie do lampki samej przetwornicy
|
||||
btLampkaPrzetw.Turn( !mvControlled->ConverterFlag );
|
||||
btLampkaNadmPrzetw.Turn( mvControlled->ConvOvldFlag );
|
||||
|
||||
@@ -4445,10 +4501,12 @@ bool TTrain::Update( double const Deltatime )
|
||||
|
||||
btLampkaBezoporowa.Turn(mvControlled->ResistorsFlagCheck() ||
|
||||
(mvControlled->MainCtrlActualPos == 0)); // do EU04
|
||||
if ((mvControlled->Itot != 0) || (mvOccupied->BrakePress > 2) ||
|
||||
(mvOccupied->PipePress < 3.6))
|
||||
btLampkaStyczn.TurnOff(); // Ra: czy to jest udawanie działania
|
||||
// styczników liniowych?
|
||||
if( ( mvControlled->Itot != 0 )
|
||||
|| ( mvOccupied->BrakePress > 2 )
|
||||
|| ( mvOccupied->PipePress < 3.6 ) ) {
|
||||
// Ra: czy to jest udawanie działania styczników liniowych?
|
||||
btLampkaStyczn.TurnOff();
|
||||
}
|
||||
else if (mvOccupied->BrakePress < 1)
|
||||
btLampkaStyczn.TurnOn(); // mozna prowadzic rozruch
|
||||
if (((TestFlag(mvControlled->Couplers[1].CouplingFlag, ctrain_controll)) &&
|
||||
@@ -4628,15 +4686,8 @@ bool TTrain::Update( double const Deltatime )
|
||||
btLampkaNadmPrzetwB.TurnOn();
|
||||
btLampkaPrzetwB.TurnOff();
|
||||
}
|
||||
}
|
||||
|
||||
// hunter-261211: jakis stary kod (i niezgodny z prawda), zahaszowalem
|
||||
// if (tmp)
|
||||
// if (tmp->MoverParameters->ConverterFlag==true)
|
||||
// btLampkaNadmPrzetwB.TurnOff();
|
||||
// else
|
||||
// btLampkaNadmPrzetwB.TurnOn();
|
||||
|
||||
} //**************************************************** */
|
||||
if( mvControlled->Battery || mvControlled->ConverterFlag )
|
||||
{
|
||||
switch (mvControlled->TrainType)
|
||||
@@ -4666,6 +4717,18 @@ bool TTrain::Update( double const Deltatime )
|
||||
btLampkaForward.Turn(mvControlled->ActiveDir > 0); // jazda do przodu
|
||||
btLampkaBackward.Turn(mvControlled->ActiveDir < 0); // jazda do tyłu
|
||||
btLampkaED.Turn(mvControlled->DynamicBrakeFlag); // hamulec ED
|
||||
// light indicators
|
||||
// NOTE: sides are hardcoded to deal with setups where single cab is equipped with all indicators
|
||||
btLampkaUpperLight.Turn( ( mvOccupied->iLights[ side::front ] & light::headlight_upper ) != 0 );
|
||||
btLampkaLeftLight.Turn( ( mvOccupied->iLights[ side::front ] & light::headlight_left ) != 0 );
|
||||
btLampkaRightLight.Turn( ( mvOccupied->iLights[ side::front ] & light::headlight_right ) != 0 );
|
||||
btLampkaLeftEndLight.Turn( ( mvOccupied->iLights[ side::front ] & light::redmarker_left ) != 0 );
|
||||
btLampkaRightEndLight.Turn( ( mvOccupied->iLights[ side::front ] & light::redmarker_right ) != 0 );
|
||||
btLampkaRearUpperLight.Turn( ( mvOccupied->iLights[ side::rear ] & light::headlight_upper ) != 0 );
|
||||
btLampkaRearLeftLight.Turn( ( mvOccupied->iLights[ side::rear ] & light::headlight_left ) != 0 );
|
||||
btLampkaRearRightLight.Turn( ( mvOccupied->iLights[ side::rear ] & light::headlight_right ) != 0 );
|
||||
btLampkaRearLeftEndLight.Turn( ( mvOccupied->iLights[ side::rear ] & light::redmarker_left ) != 0 );
|
||||
btLampkaRearRightEndLight.Turn( ( mvOccupied->iLights[ side::rear ] & light::redmarker_right ) != 0 );
|
||||
}
|
||||
else
|
||||
{ // gdy bateria wyłączona
|
||||
@@ -4681,7 +4744,19 @@ bool TTrain::Update( double const Deltatime )
|
||||
btLampkaForward.TurnOff();
|
||||
btLampkaBackward.TurnOff();
|
||||
btLampkaED.TurnOff();
|
||||
// light indicators
|
||||
btLampkaUpperLight.TurnOff();
|
||||
btLampkaLeftLight.TurnOff();
|
||||
btLampkaRightLight.TurnOff();
|
||||
btLampkaLeftEndLight.TurnOff();
|
||||
btLampkaRightEndLight.TurnOff();
|
||||
btLampkaRearUpperLight.TurnOff();
|
||||
btLampkaRearLeftLight.TurnOff();
|
||||
btLampkaRearRightLight.TurnOff();
|
||||
btLampkaRearLeftEndLight.TurnOff();
|
||||
btLampkaRearRightEndLight.TurnOff();
|
||||
}
|
||||
|
||||
// McZapkie-080602: obroty (albo translacje) regulatorow
|
||||
if (ggMainCtrl.SubModel) {
|
||||
|
||||
@@ -4939,12 +5014,6 @@ bool TTrain::Update( double const Deltatime )
|
||||
ggRearRightLightButton.PutValue(-1);
|
||||
}
|
||||
#endif
|
||||
if (ggLightsButton.SubModel)
|
||||
{
|
||||
ggLightsButton.PutValue(mvOccupied->LightsPos - 1);
|
||||
ggLightsButton.Update();
|
||||
}
|
||||
ggDimHeadlightsButton.Update();
|
||||
//---------
|
||||
// hunter-080812: poprawka na ogrzewanie w elektrykach - usuniete uzaleznienie od przetwornicy
|
||||
if ((((mvControlled->EngineType == ElectricSeriesMotor) && (mvControlled->Mains == true) &&
|
||||
@@ -5009,9 +5078,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
}
|
||||
}
|
||||
|
||||
//******************************************
|
||||
// przelaczniki
|
||||
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
if( Console::Pressed( Global::Keys[ k_Horn ] ) )
|
||||
{
|
||||
@@ -5748,6 +5815,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
ggPantCompressorButton.Update();
|
||||
ggPantCompressorValve.Update();
|
||||
|
||||
ggLightsButton.Update();
|
||||
ggUpperLightButton.Update();
|
||||
ggLeftLightButton.Update();
|
||||
ggRightLightButton.Update();
|
||||
@@ -5759,6 +5827,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
ggRearRightLightButton.Update();
|
||||
ggRearLeftEndLightButton.Update();
|
||||
ggRearRightEndLightButton.Update();
|
||||
ggDimHeadlightsButton.Update();
|
||||
//------------
|
||||
ggConverterButton.Update();
|
||||
ggConverterLocalButton.Update();
|
||||
@@ -5769,14 +5838,14 @@ bool TTrain::Update( double const Deltatime )
|
||||
ggHornButton.Update();
|
||||
ggHornLowButton.Update();
|
||||
ggHornHighButton.Update();
|
||||
/*
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
ggUniversal1Button.Update();
|
||||
ggUniversal2Button.Update();
|
||||
if( Universal4Active ) {
|
||||
ggUniversal4Button.PermIncValue( dt );
|
||||
}
|
||||
ggUniversal4Button.Update();
|
||||
*/
|
||||
#endif
|
||||
for( auto &universal : ggUniversals ) {
|
||||
universal.Update();
|
||||
}
|
||||
@@ -6733,6 +6802,17 @@ void TTrain::clear_cab_controls()
|
||||
btLampkaWylSzybkiB.Clear();
|
||||
btLampkaForward.Clear();
|
||||
btLampkaBackward.Clear();
|
||||
// light indicators
|
||||
btLampkaUpperLight.Clear();
|
||||
btLampkaLeftLight.Clear();
|
||||
btLampkaRightLight.Clear();
|
||||
btLampkaLeftEndLight.Clear();
|
||||
btLampkaRightEndLight.Clear();
|
||||
btLampkaRearUpperLight.Clear();
|
||||
btLampkaRearLeftLight.Clear();
|
||||
btLampkaRearRightLight.Clear();
|
||||
btLampkaRearLeftEndLight.Clear();
|
||||
btLampkaRearRightEndLight.Clear();
|
||||
btCabLight.Clear(); // hunter-171012
|
||||
ggLeftLightButton.Clear();
|
||||
ggRightLightButton.Clear();
|
||||
@@ -6842,21 +6922,23 @@ void TTrain::set_cab_controls() {
|
||||
ggMaxCurrentCtrl.PutValue( 1.0 );
|
||||
}
|
||||
// lights
|
||||
int const lightsindex =
|
||||
( mvOccupied->ActiveCab == 1 ?
|
||||
0 :
|
||||
1 );
|
||||
ggLightsButton.PutValue( mvOccupied->LightsPos - 1 );
|
||||
|
||||
if( ( DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::headlight_left ) != 0 ) {
|
||||
int const vehicleside =
|
||||
( mvOccupied->ActiveCab == 1 ?
|
||||
side::front :
|
||||
side::rear );
|
||||
|
||||
if( ( DynamicObject->iLights[ vehicleside ] & light::headlight_left ) != 0 ) {
|
||||
ggLeftLightButton.PutValue( 1.0 );
|
||||
}
|
||||
if( ( DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::headlight_right ) != 0 ) {
|
||||
if( ( DynamicObject->iLights[ vehicleside ] & light::headlight_right ) != 0 ) {
|
||||
ggRightLightButton.PutValue( 1.0 );
|
||||
}
|
||||
if( ( DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::headlight_upper ) != 0 ) {
|
||||
if( ( DynamicObject->iLights[ vehicleside ] & light::headlight_upper ) != 0 ) {
|
||||
ggUpperLightButton.PutValue( 1.0 );
|
||||
}
|
||||
if( ( DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::redmarker_left ) != 0 ) {
|
||||
if( ( DynamicObject->iLights[ vehicleside ] & light::redmarker_left ) != 0 ) {
|
||||
if( ggLeftEndLightButton.SubModel != nullptr ) {
|
||||
ggLeftEndLightButton.PutValue( 1.0 );
|
||||
}
|
||||
@@ -6864,7 +6946,7 @@ void TTrain::set_cab_controls() {
|
||||
ggLeftLightButton.PutValue( -1.0 );
|
||||
}
|
||||
}
|
||||
if( ( DynamicObject->iLights[ lightsindex ] & TMoverParameters::light::redmarker_right ) != 0 ) {
|
||||
if( ( DynamicObject->iLights[ vehicleside ] & light::redmarker_right ) != 0 ) {
|
||||
if( ggRightEndLightButton.SubModel != nullptr ) {
|
||||
ggRightEndLightButton.PutValue( 1.0 );
|
||||
}
|
||||
@@ -6938,227 +7020,88 @@ void TTrain::set_cab_controls() {
|
||||
// TODO: when cleaning up break setting indicator state into a separate function, so we can reuse it
|
||||
}
|
||||
|
||||
// initializes a button matching provided label. returns: true if the label was found, false
|
||||
// otherwise
|
||||
// NOTE: this is temporary work-around for compiler else-if limit
|
||||
// initializes a button matching provided label. returns: true if the label was found, false otherwise
|
||||
// TODO: refactor the cabin controls into some sensible structure
|
||||
bool TTrain::initialize_button(cParser &Parser, std::string const &Label, int const Cabindex)
|
||||
{
|
||||
/*
|
||||
TButton *bt; // roboczy wskaźnik na obiekt animujący lampkę
|
||||
*/
|
||||
// SEKCJA LAMPEK
|
||||
if (Label == "i-maxft:")
|
||||
{
|
||||
btLampkaMaxSila.Load(Parser, DynamicObject->mdKabina);
|
||||
bool TTrain::initialize_button(cParser &Parser, std::string const &Label, int const Cabindex) {
|
||||
|
||||
std::unordered_map<std::string, TButton &> const lights = {
|
||||
{ "i-maxft:", btLampkaMaxSila },
|
||||
{ "i-maxftt:", btLampkaPrzekrMaxSila },
|
||||
{ "i-radio:", btLampkaRadio },
|
||||
{ "i-manual_brake:", btLampkaHamulecReczny },
|
||||
{ "i-door_blocked:", btLampkaBlokadaDrzwi },
|
||||
{ "i-slippery:", btLampkaPoslizg },
|
||||
{ "i-contactors:", btLampkaStyczn },
|
||||
{ "i-conv_ovld:", btLampkaNadmPrzetw },
|
||||
{ "i-converter:", btLampkaPrzetw },
|
||||
{ "i-diff_relay:", btLampkaPrzekRozn },
|
||||
{ "i-diff_relay2:", btLampkaPrzekRoznPom },
|
||||
{ "i-motor_ovld:", btLampkaNadmSil },
|
||||
{ "i-train_controll:", btLampkaUkrotnienie },
|
||||
{ "i-brake_delay_r:", btLampkaHamPosp },
|
||||
{ "i-mainbreaker:", btLampkaWylSzybki },
|
||||
{ "i-vent_ovld:", btLampkaNadmWent },
|
||||
{ "i-comp_ovld:", btLampkaNadmSpr },
|
||||
{ "i-resistors:", btLampkaOpory },
|
||||
{ "i-no_resistors:", btLampkaBezoporowa },
|
||||
{ "i-no_resistors_b:", btLampkaBezoporowaB },
|
||||
{ "i-highcurrent:", btLampkaWysRozr },
|
||||
{ "i-vent_trim:", btLampkaWentZaluzje },
|
||||
{ "i-trainheating:", btLampkaOgrzewanieSkladu },
|
||||
{ "i-security_aware:", btLampkaCzuwaka },
|
||||
{ "i-security_cabsignal:", btLampkaSHP },
|
||||
{ "i-door_left:", btLampkaDoorLeft },
|
||||
{ "i-door_right:", btLampkaDoorRight },
|
||||
{ "i-departure_signal:", btLampkaDepartureSignal },
|
||||
{ "i-reserve:", btLampkaRezerwa },
|
||||
{ "i-scnd:", btLampkaBoczniki },
|
||||
{ "i-scnd1:", btLampkaBocznik1 },
|
||||
{ "i-scnd2:", btLampkaBocznik2 },
|
||||
{ "i-scnd3:", btLampkaBocznik3 },
|
||||
{ "i-scnd4:", btLampkaBocznik4 },
|
||||
{ "i-braking:", btLampkaHamienie },
|
||||
{ "i-dynamicbrake:", btLampkaED },
|
||||
{ "i-braking-ezt:", btLampkaHamowanie1zes },
|
||||
{ "i-braking-ezt2:", btLampkaHamowanie2zes },
|
||||
{ "i-compressor:", btLampkaSprezarka },
|
||||
{ "i-compressorb:", btLampkaSprezarkaB },
|
||||
{ "i-voltbrake:", btLampkaNapNastHam },
|
||||
{ "i-mainbreakerb:", btLampkaWylSzybkiB },
|
||||
{ "i-resistorsb:", btLampkaOporyB },
|
||||
{ "i-contactorsb:", btLampkaStycznB },
|
||||
{ "i-conv_ovldb:", btLampkaNadmPrzetwB },
|
||||
{ "i-converterb:", btLampkaPrzetwB },
|
||||
{ "i-forward:", btLampkaForward },
|
||||
{ "i-backward:", btLampkaBackward },
|
||||
{ "i-upperlight:", btLampkaUpperLight },
|
||||
{ "i-leftlight:", btLampkaLeftLight },
|
||||
{ "i-rightlight:", btLampkaRightLight },
|
||||
{ "i-leftend:", btLampkaLeftEndLight },
|
||||
{ "i-rightend:", btLampkaRightEndLight },
|
||||
{ "i-rearupperlight:", btLampkaRearUpperLight },
|
||||
{ "i-rearleftlight:", btLampkaRearLeftLight },
|
||||
{ "i-rearrightlight:", btLampkaRearRightLight },
|
||||
{ "i-rearleftend:", btLampkaRearLeftEndLight },
|
||||
{ "i-rearrightend:", btLampkaRearRightEndLight },
|
||||
{ "i-cablight:", btCabLight }
|
||||
};
|
||||
auto lookup = lights.find( Label );
|
||||
if( lookup != lights.end() ) {
|
||||
lookup->second.Load( Parser, DynamicObject->mdKabina );
|
||||
}
|
||||
else if (Label == "i-maxftt:")
|
||||
{
|
||||
btLampkaPrzekrMaxSila.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-radio:")
|
||||
{
|
||||
btLampkaRadio.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-manual_brake:")
|
||||
{
|
||||
btLampkaHamulecReczny.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-door_blocked:")
|
||||
{
|
||||
btLampkaBlokadaDrzwi.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-slippery:")
|
||||
{
|
||||
btLampkaPoslizg.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-contactors:")
|
||||
{
|
||||
btLampkaStyczn.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-conv_ovld:")
|
||||
{
|
||||
btLampkaNadmPrzetw.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-converter:")
|
||||
{
|
||||
btLampkaPrzetw.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-diff_relay:")
|
||||
{
|
||||
btLampkaPrzekRozn.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-diff_relay2:")
|
||||
{
|
||||
btLampkaPrzekRoznPom.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-motor_ovld:")
|
||||
{
|
||||
btLampkaNadmSil.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-train_controll:")
|
||||
{
|
||||
btLampkaUkrotnienie.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-brake_delay_r:")
|
||||
{
|
||||
btLampkaHamPosp.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-mainbreaker:")
|
||||
{
|
||||
btLampkaWylSzybki.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-vent_ovld:")
|
||||
{
|
||||
btLampkaNadmWent.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-comp_ovld:")
|
||||
{
|
||||
btLampkaNadmSpr.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-resistors:")
|
||||
{
|
||||
btLampkaOpory.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-no_resistors:")
|
||||
{
|
||||
btLampkaBezoporowa.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-no_resistors_b:")
|
||||
{
|
||||
btLampkaBezoporowaB.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-highcurrent:")
|
||||
{
|
||||
btLampkaWysRozr.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-instrumentlight:")
|
||||
{
|
||||
btInstrumentLight.Load(Parser, DynamicObject->mdKabina, DynamicObject->mdModel);
|
||||
|
||||
else if( Label == "i-instrumentlight:" ) {
|
||||
btInstrumentLight.Load( Parser, DynamicObject->mdKabina, DynamicObject->mdModel );
|
||||
InstrumentLightType = 0;
|
||||
}
|
||||
else if (Label == "i-instrumentlight_M:")
|
||||
{
|
||||
btInstrumentLight.Load(Parser, DynamicObject->mdKabina, DynamicObject->mdModel);
|
||||
else if( Label == "i-instrumentlight_M:" ) {
|
||||
btInstrumentLight.Load( Parser, DynamicObject->mdKabina, DynamicObject->mdModel );
|
||||
InstrumentLightType = 1;
|
||||
}
|
||||
else if (Label == "i-instrumentlight_C:")
|
||||
{
|
||||
btInstrumentLight.Load(Parser, DynamicObject->mdKabina, DynamicObject->mdModel);
|
||||
else if( Label == "i-instrumentlight_C:" ) {
|
||||
btInstrumentLight.Load( Parser, DynamicObject->mdKabina, DynamicObject->mdModel );
|
||||
InstrumentLightType = 2;
|
||||
}
|
||||
else if (Label == "i-vent_trim:")
|
||||
{
|
||||
btLampkaWentZaluzje.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-trainheating:")
|
||||
{
|
||||
btLampkaOgrzewanieSkladu.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-security_aware:")
|
||||
{
|
||||
btLampkaCzuwaka.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-security_cabsignal:")
|
||||
{
|
||||
btLampkaSHP.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-door_left:")
|
||||
{
|
||||
btLampkaDoorLeft.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-door_right:")
|
||||
{
|
||||
btLampkaDoorRight.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-departure_signal:")
|
||||
{
|
||||
btLampkaDepartureSignal.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-reserve:")
|
||||
{
|
||||
btLampkaRezerwa.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-scnd:")
|
||||
{
|
||||
btLampkaBoczniki.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-scnd1:")
|
||||
{
|
||||
btLampkaBocznik1.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-scnd2:")
|
||||
{
|
||||
btLampkaBocznik2.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-scnd3:")
|
||||
{
|
||||
btLampkaBocznik3.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-scnd4:")
|
||||
{
|
||||
btLampkaBocznik4.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-braking:")
|
||||
{
|
||||
btLampkaHamienie.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if( Label == "i-dynamicbrake:" ) {
|
||||
|
||||
btLampkaED.Load( Parser, DynamicObject->mdKabina );
|
||||
}
|
||||
else if (Label == "i-braking-ezt:")
|
||||
{
|
||||
btLampkaHamowanie1zes.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-braking-ezt2:")
|
||||
{
|
||||
btLampkaHamowanie2zes.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-compressor:")
|
||||
{
|
||||
btLampkaSprezarka.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-compressorb:")
|
||||
{
|
||||
btLampkaSprezarkaB.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-voltbrake:")
|
||||
{
|
||||
btLampkaNapNastHam.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-mainbreakerb:")
|
||||
{
|
||||
btLampkaWylSzybkiB.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-resistorsb:")
|
||||
{
|
||||
btLampkaOporyB.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-contactorsb:")
|
||||
{
|
||||
btLampkaStycznB.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-conv_ovldb:")
|
||||
{
|
||||
btLampkaNadmPrzetwB.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-converterb:")
|
||||
{
|
||||
btLampkaPrzetwB.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-forward:")
|
||||
{
|
||||
btLampkaForward.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-backward:")
|
||||
{
|
||||
btLampkaBackward.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-cablight:")
|
||||
{ // hunter-171012
|
||||
btCabLight.Load(Parser, DynamicObject->mdKabina);
|
||||
}
|
||||
else if (Label == "i-doors:")
|
||||
{
|
||||
int i = Parser.getToken<int>() - 1;
|
||||
@@ -7175,15 +7118,10 @@ bool TTrain::initialize_button(cParser &Parser, std::string const &Label, int co
|
||||
return true;
|
||||
}
|
||||
|
||||
// initializes a gauge matching provided label. returns: true if the label was found, false
|
||||
// otherwise
|
||||
// NOTE: this is temporary work-around for compiler else-if limit
|
||||
// initializes a gauge matching provided label. returns: true if the label was found, false otherwise
|
||||
// TODO: refactor the cabin controls into some sensible structure
|
||||
bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int const Cabindex) {
|
||||
|
||||
/*
|
||||
TGauge *gg { nullptr }; // roboczy wskaźnik na obiekt animujący gałkę
|
||||
*/
|
||||
std::unordered_map<std::string, TGauge &> const gauges = {
|
||||
{ "mainctrl:", ggMainCtrl },
|
||||
{ "scndctrl:", ggScndCtrl },
|
||||
|
||||
13
Train.h
13
Train.h
@@ -171,6 +171,8 @@ class TTrain
|
||||
static void OnCommand_motoroverloadrelaythresholdtoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_motoroverloadrelayreset( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_heatingtoggle( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_lightspresetactivatenext( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_lightspresetactivateprevious( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_headlighttoggleleft( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_headlighttoggleright( TTrain *Train, command_data const &Command );
|
||||
static void OnCommand_headlighttoggleupper( TTrain *Train, command_data const &Command );
|
||||
@@ -366,6 +368,17 @@ public: // reszta może by?publiczna
|
||||
TButton btLampkaHamulecReczny;
|
||||
TButton btLampkaForward; // Ra: lampki w przód i w ty?dla komputerowych kabin
|
||||
TButton btLampkaBackward;
|
||||
// light indicators
|
||||
TButton btLampkaUpperLight;
|
||||
TButton btLampkaLeftLight;
|
||||
TButton btLampkaRightLight;
|
||||
TButton btLampkaLeftEndLight;
|
||||
TButton btLampkaRightEndLight;
|
||||
TButton btLampkaRearUpperLight;
|
||||
TButton btLampkaRearLeftLight;
|
||||
TButton btLampkaRearRightLight;
|
||||
TButton btLampkaRearLeftEndLight;
|
||||
TButton btLampkaRearRightEndLight;
|
||||
|
||||
TButton btCabLight; // hunter-171012: lampa oswietlajaca kabine
|
||||
// Ra 2013-12: wirtualne "lampki" do odbijania na haslerze w PoKeys
|
||||
|
||||
22
World.cpp
22
World.cpp
@@ -690,7 +690,7 @@ void TWorld::OnKeyDown(int cKey)
|
||||
*/
|
||||
if (cKey == Global::Keys[k_Heating]) // Ra: klawisz nie jest najszczęśliwszy
|
||||
{ // zmiana próżny/ładowny; Ra: zabrane z kabiny
|
||||
auto *vehicle { std::get<TDynamicObject *>( simulation::Region->find_vehicle( Global::pCameraPosition, 20, false, false ) ) };
|
||||
auto *vehicle { std::get<TDynamicObject *>( simulation::Region->find_vehicle( Global::pCameraPosition, 10, false, false ) ) };
|
||||
if (vehicle)
|
||||
{
|
||||
if (Global::shiftState ? vehicle->MoverParameters->IncBrakeMult() :
|
||||
@@ -703,7 +703,7 @@ void TWorld::OnKeyDown(int cKey)
|
||||
}
|
||||
else if (cKey == Global::Keys[k_EndSign])
|
||||
{ // Ra 2014-07: zabrane z kabiny
|
||||
auto *vehicle { std::get<TDynamicObject *>( simulation::Region->find_vehicle( Global::pCameraPosition, 20, false, true ) ) };
|
||||
auto *vehicle { std::get<TDynamicObject *>( simulation::Region->find_vehicle( Global::pCameraPosition, 10, false, true ) ) };
|
||||
if (vehicle)
|
||||
{
|
||||
int CouplNr = (LengthSquared3(vehicle->HeadPosition() - Camera.Pos) >
|
||||
@@ -715,9 +715,9 @@ void TWorld::OnKeyDown(int cKey)
|
||||
CouplNr = 0; // z [-1,1] zrobić [0,1]
|
||||
int mask, set = 0; // Ra: [Shift]+[Ctrl]+[T] odpala mi jakąś idiotyczną zmianę tapety pulpitu :/
|
||||
if (Global::shiftState) // z [Shift] zapalanie
|
||||
set = mask = TMoverParameters::light::rearendsignals; // bez [Ctrl] założyć tabliczki
|
||||
set = mask = light::rearendsignals; // bez [Ctrl] założyć tabliczki
|
||||
else if (Global::ctrlState)
|
||||
set = mask = ( TMoverParameters::light::redmarker_left | TMoverParameters::light::redmarker_right ); // z [Ctrl] zapalić światła czerwone
|
||||
set = mask = ( light::redmarker_left | light::redmarker_right ); // z [Ctrl] zapalić światła czerwone
|
||||
else
|
||||
mask = 2 + 32 + 64; // wyłączanie ściąga wszystko
|
||||
if (((vehicle->iLights[CouplNr]) & mask) != set)
|
||||
@@ -732,7 +732,7 @@ void TWorld::OnKeyDown(int cKey)
|
||||
}
|
||||
else if (cKey == Global::Keys[k_IncLocalBrakeLevel])
|
||||
{ // zahamowanie dowolnego pojazdu
|
||||
auto *vehicle { std::get<TDynamicObject *>( simulation::Region->find_vehicle( Global::pCameraPosition, 20, false, false ) ) };
|
||||
auto *vehicle { std::get<TDynamicObject *>( simulation::Region->find_vehicle( Global::pCameraPosition, 10, false, false ) ) };
|
||||
if (vehicle)
|
||||
{
|
||||
if (Global::ctrlState)
|
||||
@@ -751,7 +751,7 @@ void TWorld::OnKeyDown(int cKey)
|
||||
}
|
||||
else if (cKey == Global::Keys[k_DecLocalBrakeLevel])
|
||||
{ // odhamowanie dowolnego pojazdu
|
||||
auto *vehicle { std::get<TDynamicObject *>( simulation::Region->find_vehicle( Global::pCameraPosition, 20, false, false ) ) };
|
||||
auto *vehicle { std::get<TDynamicObject *>( simulation::Region->find_vehicle( Global::pCameraPosition, 10, false, false ) ) };
|
||||
if (vehicle)
|
||||
{
|
||||
if (Global::ctrlState)
|
||||
@@ -1456,15 +1456,15 @@ TWorld::Update_UI() {
|
||||
"; TC:"
|
||||
+ to_string( vehicle->MoverParameters->TotalCurrent, 0 );
|
||||
auto const frontcouplerhighvoltage =
|
||||
to_string( vehicle->MoverParameters->Couplers[ TMoverParameters::side::front ].power_high.voltage, 0 )
|
||||
to_string( vehicle->MoverParameters->Couplers[ side::front ].power_high.voltage, 0 )
|
||||
+ "@"
|
||||
+ to_string( vehicle->MoverParameters->Couplers[ TMoverParameters::side::front ].power_high.current, 0 );
|
||||
+ to_string( vehicle->MoverParameters->Couplers[ side::front ].power_high.current, 0 );
|
||||
auto const rearcouplerhighvoltage =
|
||||
to_string( vehicle->MoverParameters->Couplers[ TMoverParameters::side::rear ].power_high.voltage, 0 )
|
||||
to_string( vehicle->MoverParameters->Couplers[ side::rear ].power_high.voltage, 0 )
|
||||
+ "@"
|
||||
+ to_string( vehicle->MoverParameters->Couplers[ TMoverParameters::side::rear ].power_high.current, 0 );
|
||||
+ to_string( vehicle->MoverParameters->Couplers[ side::rear ].power_high.current, 0 );
|
||||
uitextline2 += ", HV: ";
|
||||
if( vehicle->MoverParameters->Couplers[ TMoverParameters::side::front ].power_high.local == false ) {
|
||||
if( vehicle->MoverParameters->Couplers[ side::front ].power_high.local == false ) {
|
||||
uitextline2 +=
|
||||
"(" + frontcouplerhighvoltage + ")-"
|
||||
+ ":F" + ( vehicle->DirectionGet() ? "<<" : ">>" ) + "R:"
|
||||
|
||||
@@ -105,6 +105,8 @@ const int k_ProgramHelp = 48;
|
||||
/*
|
||||
// const int k_FreeFlyMode= 59;
|
||||
*/
|
||||
{ "lightspresetactivatenext", command_target::vehicle },
|
||||
{ "lightspresetactivateprevious", command_target::vehicle },
|
||||
{ "headlighttoggleleft", command_target::vehicle },
|
||||
{ "headlighttoggleright", command_target::vehicle },
|
||||
{ "headlighttoggleupper", command_target::vehicle },
|
||||
|
||||
@@ -100,6 +100,8 @@ const int k_ProgramHelp = 48;
|
||||
/*
|
||||
// const int k_FreeFlyMode= 59;
|
||||
*/
|
||||
lightspresetactivatenext,
|
||||
lightspresetactivateprevious,
|
||||
headlighttoggleleft,
|
||||
headlighttoggleright,
|
||||
headlighttoggleupper,
|
||||
@@ -117,10 +119,6 @@ const int k_ProgramHelp = 48;
|
||||
interiorlightdimtoggle,
|
||||
instrumentlighttoggle,
|
||||
/*
|
||||
const int k_Univ1 = 66;
|
||||
const int k_Univ2 = 67;
|
||||
const int k_Univ3 = 68;
|
||||
const int k_Univ4 = 69;
|
||||
const int k_EndSign = 70;
|
||||
const int k_Active = 71;
|
||||
*/
|
||||
|
||||
@@ -318,6 +318,10 @@ const int k_ProgramHelp = 48;
|
||||
/*
|
||||
// const int k_FreeFlyMode= 59;
|
||||
*/
|
||||
// lightspresetactivatenext
|
||||
{ GLFW_KEY_T | keymodifier::shift },
|
||||
// lightspresetactivateprevious
|
||||
{ GLFW_KEY_T },
|
||||
// headlighttoggleleft
|
||||
{ GLFW_KEY_Y },
|
||||
// headlighttoggleright
|
||||
|
||||
@@ -23,8 +23,8 @@ light_array::insert( TDynamicObject const *Owner ) {
|
||||
|
||||
// we're only storing lights for locos, which have two sets of lights, front and rear
|
||||
// for a more generic role this function would have to be tweaked to add vehicle type-specific light combinations
|
||||
data.emplace_back( Owner, 0 );
|
||||
data.emplace_back( Owner, 1 );
|
||||
data.emplace_back( Owner, side::front );
|
||||
data.emplace_back( Owner, side::rear );
|
||||
}
|
||||
|
||||
void
|
||||
@@ -44,7 +44,7 @@ light_array::update() {
|
||||
|
||||
for( auto &light : data ) {
|
||||
// update light parameters to match current data of the owner
|
||||
if( light.index == 0 ) {
|
||||
if( light.index == side::front ) {
|
||||
// front light set
|
||||
light.position = light.owner->GetPosition() + ( light.owner->VectorFront() * light.owner->GetLength() * 0.4 );
|
||||
light.direction = glm::make_vec3( light.owner->VectorFront().getArray() );
|
||||
@@ -57,34 +57,25 @@ light_array::update() {
|
||||
light.direction.z = -light.direction.z;
|
||||
}
|
||||
// determine intensity of this light set
|
||||
if( ( true == light.owner->MoverParameters->Battery ) || ( true == light.owner->MoverParameters->ConverterFlag ) ) {
|
||||
if( ( true == light.owner->MoverParameters->Battery )
|
||||
|| ( true == light.owner->MoverParameters->ConverterFlag ) ) {
|
||||
// with power on, the intensity depends on the state of activated switches
|
||||
auto const &lightbits = light.owner->iLights[ light.index ];
|
||||
// first we cross-check the list of enabled lights with the lights installed in the vehicle...
|
||||
auto const lights { light.owner->iLights[ light.index ] & light.owner->LightList( static_cast<side>( light.index ) ) };
|
||||
// ...then check their individual state
|
||||
light.count = 0
|
||||
+ ( ( lightbits & TMoverParameters::light::headlight_left ) ? 1 : 0 )
|
||||
+ ( ( lightbits & TMoverParameters::light::headlight_right ) ? 1 : 0 )
|
||||
+ ( ( lightbits & TMoverParameters::light::headlight_upper ) ? 1 : 0 );
|
||||
+ ( ( lights & light::headlight_left ) ? 1 : 0 )
|
||||
+ ( ( lights & light::headlight_right ) ? 1 : 0 )
|
||||
+ ( ( lights & light::headlight_upper ) ? 1 : 0 );
|
||||
|
||||
if( light.count > 0 ) {
|
||||
// TODO: intensity can be affected further by dim switch or other factors
|
||||
light.intensity = std::max( 0.0f, std::log( (float)light.count + 1.0f ) );
|
||||
light.intensity *= ( light.owner->DimHeadlights ? 0.6f : 1.0f );
|
||||
// TBD, TODO: intensity can be affected further by other factors
|
||||
}
|
||||
else {
|
||||
light.intensity = 0.0f;
|
||||
}
|
||||
/*
|
||||
// crude catch for unmanned modules which share the light state with the controlled unit.
|
||||
// why don't they get their own light bits btw ._.
|
||||
// TODO, TBD: have separate light bits for each vehicle, so this override isn't necessary
|
||||
// NOTE: should be no longer needed, test and delete if there's no ill effects
|
||||
if( ( light.owner->Controller == AIdriver )
|
||||
&& ( light.owner->Mechanik == nullptr ) ) {
|
||||
|
||||
light.intensity = 0.0f;
|
||||
light.count = 0;
|
||||
}
|
||||
*/
|
||||
}
|
||||
else {
|
||||
// with battery off the lights are off
|
||||
|
||||
@@ -304,8 +304,8 @@ mouse_input::default_bindings() {
|
||||
user_command::redmarkertoggleright,
|
||||
user_command::none } },
|
||||
{ "lights_sw:", {
|
||||
user_command::none,
|
||||
user_command::none } }, // TODO: implement commands for lights controller
|
||||
user_command::lightspresetactivatenext,
|
||||
user_command::lightspresetactivateprevious } },
|
||||
{ "rearupperlight_sw:", {
|
||||
user_command::headlighttogglerearupper,
|
||||
user_command::none } },
|
||||
|
||||
@@ -199,8 +199,10 @@ private:
|
||||
bind_buffer();
|
||||
void
|
||||
delete_buffer();
|
||||
static
|
||||
void
|
||||
bind_streams( stream_units const &Units, unsigned int const Streams );
|
||||
static
|
||||
void
|
||||
release_streams();
|
||||
|
||||
@@ -310,7 +312,7 @@ private:
|
||||
// methods
|
||||
inline
|
||||
bool
|
||||
valid( geometry_handle const &Geometry ) {
|
||||
valid( geometry_handle const &Geometry ) const {
|
||||
return ( ( Geometry.bank != 0 )
|
||||
&& ( Geometry.bank <= m_geometrybanks.size() ) ); }
|
||||
inline
|
||||
|
||||
22
scene.cpp
22
scene.cpp
@@ -384,7 +384,7 @@ basic_cell::register_end( TTraction *Traction ) {
|
||||
|
||||
// find a vehicle located nearest to specified point, within specified radius, optionally ignoring vehicles without drivers. reurns: located vehicle and distance
|
||||
std::tuple<TDynamicObject *, float>
|
||||
basic_cell::find( glm::dvec3 const &Point, float const Radius, bool const Onlycontrolled, bool const Findbycoupler ) {
|
||||
basic_cell::find( glm::dvec3 const &Point, float const Radius, bool const Onlycontrolled, bool const Findbycoupler ) const {
|
||||
|
||||
TDynamicObject *vehiclenearest { nullptr };
|
||||
float leastdistance { std::numeric_limits<float>::max() };
|
||||
@@ -419,7 +419,7 @@ basic_cell::find( glm::dvec3 const &Point, float const Radius, bool const Onlyco
|
||||
|
||||
// finds a path with one of its ends located in specified point. returns: located path and id of the matching endpoint
|
||||
std::tuple<TTrack *, int>
|
||||
basic_cell::find( glm::dvec3 const &Point, TTrack const *Exclude ) {
|
||||
basic_cell::find( glm::dvec3 const &Point, TTrack const *Exclude ) const {
|
||||
|
||||
Math3D::vector3 point { Point.x, Point.y, Point.z }; // sad workaround until math classes unification
|
||||
int endpointid;
|
||||
@@ -439,7 +439,7 @@ basic_cell::find( glm::dvec3 const &Point, TTrack const *Exclude ) {
|
||||
|
||||
// finds a traction piece with one of its ends located in specified point. returns: located traction piece and id of the matching endpoint
|
||||
std::tuple<TTraction *, int>
|
||||
basic_cell::find( glm::dvec3 const &Point, TTraction const *Exclude ) {
|
||||
basic_cell::find( glm::dvec3 const &Point, TTraction const *Exclude ) const {
|
||||
|
||||
int endpointid;
|
||||
|
||||
@@ -458,7 +458,7 @@ basic_cell::find( glm::dvec3 const &Point, TTraction const *Exclude ) {
|
||||
|
||||
// finds a traction piece located nearest to specified point, sharing section with specified other piece and powered in specified direction. returns: located traction piece
|
||||
std::tuple<TTraction *, int, float>
|
||||
basic_cell::find( glm::dvec3 const &Point, TTraction const *Other, int const Currentdirection ) {
|
||||
basic_cell::find( glm::dvec3 const &Point, TTraction const *Other, int const Currentdirection ) const {
|
||||
|
||||
TTraction
|
||||
*tractionnearest { nullptr };
|
||||
@@ -862,7 +862,12 @@ basic_region::update_traction( TDynamicObject *Vehicle, int const Pantographinde
|
||||
void
|
||||
basic_region::serialize( std::string const &Scenariofile ) const {
|
||||
|
||||
auto filename { Global::asCurrentSceneryPath + Scenariofile };
|
||||
auto filename { Scenariofile };
|
||||
if( filename[ 0 ] == '$' ) {
|
||||
// trim leading $ char rainsted utility may add to the base name for modified .scn files
|
||||
filename.erase( 0, 1 );
|
||||
}
|
||||
filename = Global::asCurrentSceneryPath + filename;
|
||||
if( ( filename.rfind( '.' ) != std::string::npos )
|
||||
&& ( filename.rfind( '.' ) != filename.rfind( ".." ) + 1 ) ) {
|
||||
// trim extension, it's typically going to be for different file type
|
||||
@@ -900,7 +905,12 @@ basic_region::serialize( std::string const &Scenariofile ) const {
|
||||
bool
|
||||
basic_region::deserialize( std::string const &Scenariofile ) {
|
||||
|
||||
auto filename { Global::asCurrentSceneryPath + Scenariofile };
|
||||
auto filename { Scenariofile };
|
||||
if( filename[ 0 ] == '$' ) {
|
||||
// trim leading $ char rainsted utility may add to the base name for modified .scn files
|
||||
filename.erase( 0, 1 );
|
||||
}
|
||||
filename = Global::asCurrentSceneryPath + filename;
|
||||
if( ( filename.rfind( '.' ) != std::string::npos )
|
||||
&& ( filename.rfind( '.' ) != filename.rfind( ".." ) + 1 ) ) {
|
||||
// trim extension, it's typically going to be for different file type
|
||||
|
||||
9
scene.h
9
scene.h
@@ -117,16 +117,16 @@ public:
|
||||
register_end( TTraction *Traction );
|
||||
// find a vehicle located nearest to specified point, within specified radius. reurns: located vehicle and distance
|
||||
std::tuple<TDynamicObject *, float>
|
||||
find( glm::dvec3 const &Point, float const Radius, bool const Onlycontrolled, bool const Findbycoupler );
|
||||
find( glm::dvec3 const &Point, float const Radius, bool const Onlycontrolled, bool const Findbycoupler ) const;
|
||||
// finds a path with one of its ends located in specified point. returns: located path and id of the matching endpoint
|
||||
std::tuple<TTrack *, int>
|
||||
find( glm::dvec3 const &Point, TTrack const *Exclude );
|
||||
find( glm::dvec3 const &Point, TTrack const *Exclude ) const;
|
||||
// finds a traction piece with one of its ends located in specified point. returns: located traction piece and id of the matching endpoint
|
||||
std::tuple<TTraction *, int>
|
||||
find( glm::dvec3 const &Point, TTraction const *Exclude );
|
||||
find( glm::dvec3 const &Point, TTraction const *Exclude ) const;
|
||||
// finds a traction piece located nearest to specified point, sharing section with specified other piece and powered in specified direction. returns: located traction piece
|
||||
std::tuple<TTraction *, int, float>
|
||||
find( glm::dvec3 const &Point, TTraction const *Other, int const Currentdirection );
|
||||
find( glm::dvec3 const &Point, TTraction const *Other, int const Currentdirection ) const;
|
||||
// sets center point of the cell
|
||||
void
|
||||
center( glm::dvec3 Center );
|
||||
@@ -351,6 +351,7 @@ private:
|
||||
bool
|
||||
point_inside( glm::dvec3 const &Location );
|
||||
// legacy method, trims provided shape to fit into a section. adds trimmed part at the end of provided list, returns true if changes were made
|
||||
static
|
||||
bool
|
||||
RaTriangleDivider( shape_node &Shape, std::deque<shape_node> &Shapes );
|
||||
// provides access to section enclosing specified point
|
||||
|
||||
@@ -307,7 +307,7 @@ struct basic_node {
|
||||
|
||||
public:
|
||||
// constructor
|
||||
basic_node( scene::node_data const &Nodedata );
|
||||
explicit basic_node( scene::node_data const &Nodedata );
|
||||
// destructor
|
||||
virtual ~basic_node() = default;
|
||||
// methods
|
||||
|
||||
@@ -316,11 +316,8 @@ state_manager::deserialize_node( cParser &Input, scene::scratch_data &Scratchpad
|
||||
}
|
||||
|
||||
if( ( vehicle->MoverParameters->CategoryFlag == 1 ) // trains only
|
||||
&& ( ( vehicle->MoverParameters->SecuritySystem.SystemType != 0 )
|
||||
|| ( vehicle->MoverParameters->SandCapacity > 0.0 ) ) ) {
|
||||
// we check for presence of security system or sand load, as a way to determine whether the vehicle is a controllable engine
|
||||
// NOTE: this isn't 100% precise, e.g. middle EZT module comes with security system, while it has no lights, and some engines
|
||||
// don't have security systems fitted
|
||||
&& ( ( vehicle->LightList( side::front ) & ( light::headlight_left | light::headlight_right | light::headlight_upper ) != 0 )
|
||||
|| ( vehicle->LightList( side::rear ) & ( light::headlight_left | light::headlight_right | light::headlight_upper ) != 0 ) ) ) {
|
||||
simulation::Lights.insert( vehicle );
|
||||
}
|
||||
}
|
||||
@@ -609,7 +606,7 @@ state_manager::deserialize_endtrainset( cParser &Input, scene::scratch_data &Scr
|
||||
}
|
||||
if( Scratchpad.trainset.couplings.back() == coupling::faux ) {
|
||||
// jeśli ostatni pojazd ma sprzęg 0 to założymy mu końcówki blaszane (jak AI się odpali, to sobie poprawi)
|
||||
Scratchpad.trainset.vehicles.back()->RaLightsSet( -1, TMoverParameters::light::rearendsignals );
|
||||
Scratchpad.trainset.vehicles.back()->RaLightsSet( -1, light::rearendsignals );
|
||||
}
|
||||
// all done
|
||||
Scratchpad.trainset.is_open = false;
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
// methods
|
||||
// legacy method, calculates changes in simulation state over specified time
|
||||
void
|
||||
update( double dt, int iter );
|
||||
update( double Deltatime, int Iterationcount );
|
||||
bool
|
||||
deserialize( std::string const &Scenariofile );
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ Type_
|
||||
clamp_circular( Type_ Value, Type_ const Range = static_cast<Type_>(360) ) {
|
||||
|
||||
Value -= Range * (int)( Value / Range ); // clamp the range to 0-360
|
||||
if( Value < 0.0 ) Value += Range;
|
||||
if( Value < Type_(0) ) Value += Range;
|
||||
|
||||
return Value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user