mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 08:39:18 +02:00
control for alerter, doors, vehicle lights. support for multiple logs. fixes for relaytype 45, 46
This commit is contained in:
6
EU07.cpp
6
EU07.cpp
@@ -214,7 +214,11 @@ int main(int argc, char *argv[])
|
|||||||
if (!glfwInit())
|
if (!glfwInit())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
DeleteFile("errors.txt");
|
#ifdef _WINDOWS
|
||||||
|
DeleteFile( "log.txt" );
|
||||||
|
DeleteFile( "errors.txt" );
|
||||||
|
_mkdir("logs");
|
||||||
|
#endif
|
||||||
Global::LoadIniFile("eu07.ini");
|
Global::LoadIniFile("eu07.ini");
|
||||||
Global::InitKeys();
|
Global::InitKeys();
|
||||||
|
|
||||||
|
|||||||
@@ -166,6 +166,7 @@ bool Global::bOldSmudge = false; // Używanie starej smugi
|
|||||||
bool Global::bWireFrame = false;
|
bool Global::bWireFrame = false;
|
||||||
bool Global::bSoundEnabled = true;
|
bool Global::bSoundEnabled = true;
|
||||||
int Global::iWriteLogEnabled = 3; // maska bitowa: 1-zapis do pliku, 2-okienko, 4-nazwy torów
|
int Global::iWriteLogEnabled = 3; // maska bitowa: 1-zapis do pliku, 2-okienko, 4-nazwy torów
|
||||||
|
bool Global::MultipleLogs{ false };
|
||||||
bool Global::bManageNodes = true;
|
bool Global::bManageNodes = true;
|
||||||
bool Global::bDecompressDDS = false; // czy programowa dekompresja DDS
|
bool Global::bDecompressDDS = false; // czy programowa dekompresja DDS
|
||||||
|
|
||||||
@@ -374,7 +375,11 @@ void Global::ConfigParse(cParser &Parser)
|
|||||||
Global::iWriteLogEnabled = stol_def(token,3);
|
Global::iWriteLogEnabled = stol_def(token,3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (token == "adjustscreenfreq")
|
else if( token == "multiplelogs" ) {
|
||||||
|
Parser.getTokens();
|
||||||
|
Parser >> Global::MultipleLogs;
|
||||||
|
}
|
||||||
|
else if( token == "adjustscreenfreq" )
|
||||||
{
|
{
|
||||||
// McZapkie-240403 - czestotliwosc odswiezania ekranu
|
// McZapkie-240403 - czestotliwosc odswiezania ekranu
|
||||||
Parser.getTokens();
|
Parser.getTokens();
|
||||||
|
|||||||
@@ -214,6 +214,7 @@ class Global
|
|||||||
static void SetCameraPosition(Math3D::vector3 pNewCameraPosition);
|
static void SetCameraPosition(Math3D::vector3 pNewCameraPosition);
|
||||||
static void SetCameraRotation(double Yaw);
|
static void SetCameraRotation(double Yaw);
|
||||||
static int iWriteLogEnabled; // maska bitowa: 1-zapis do pliku, 2-okienko
|
static int iWriteLogEnabled; // maska bitowa: 1-zapis do pliku, 2-okienko
|
||||||
|
static bool MultipleLogs;
|
||||||
// McZapkie-221002: definicja swiatla dziennego
|
// McZapkie-221002: definicja swiatla dziennego
|
||||||
static float Background[3];
|
static float Background[3];
|
||||||
static GLfloat AtmoColor[];
|
static GLfloat AtmoColor[];
|
||||||
|
|||||||
@@ -386,7 +386,7 @@ void TGroundNode::RenderAlphaVBO()
|
|||||||
if( ( PROBLEND ) ) // sprawdza, czy w nazwie nie ma @ //Q: 13122011 - Szociu: 27012012
|
if( ( PROBLEND ) ) // sprawdza, czy w nazwie nie ma @ //Q: 13122011 - Szociu: 27012012
|
||||||
{
|
{
|
||||||
glDisable( GL_BLEND );
|
glDisable( GL_BLEND );
|
||||||
glAlphaFunc( GL_GREATER, 0.45f ); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
glAlphaFunc( GL_GREATER, 0.50f ); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -662,7 +662,7 @@ void TGroundNode::RenderAlphaDL()
|
|||||||
if ((PROBLEND)) // sprawdza, czy w nazwie nie ma @ //Q: 13122011 - Szociu: 27012012
|
if ((PROBLEND)) // sprawdza, czy w nazwie nie ma @ //Q: 13122011 - Szociu: 27012012
|
||||||
{
|
{
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glAlphaFunc(GL_GREATER, 0.45f); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
glAlphaFunc(GL_GREATER, 0.50f); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
if (!DisplayListID) //||Global::bReCompile) //Ra: wymuszenie rekompilacji
|
if (!DisplayListID) //||Global::bReCompile) //Ra: wymuszenie rekompilacji
|
||||||
@@ -4758,7 +4758,7 @@ TGround::Render( Math3D::vector3 const &Camera ) {
|
|||||||
bool TGround::RenderDL(vector3 pPosition)
|
bool TGround::RenderDL(vector3 pPosition)
|
||||||
{ // renderowanie scenerii z Display List - faza nieprzezroczystych
|
{ // renderowanie scenerii z Display List - faza nieprzezroczystych
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glAlphaFunc(GL_GREATER, 0.45f); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
glAlphaFunc(GL_GREATER, 0.50f); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
||||||
++TGroundRect::iFrameNumber; // zwięszenie licznika ramek (do usuwniania nadanimacji)
|
++TGroundRect::iFrameNumber; // zwięszenie licznika ramek (do usuwniania nadanimacji)
|
||||||
CameraDirection.x = sin(Global::pCameraRotation); // wektor kierunkowy
|
CameraDirection.x = sin(Global::pCameraRotation); // wektor kierunkowy
|
||||||
CameraDirection.z = cos(Global::pCameraRotation);
|
CameraDirection.z = cos(Global::pCameraRotation);
|
||||||
@@ -4848,7 +4848,7 @@ bool TGround::RenderAlphaDL(vector3 pPosition)
|
|||||||
bool TGround::RenderVBO(vector3 pPosition)
|
bool TGround::RenderVBO(vector3 pPosition)
|
||||||
{ // renderowanie scenerii z VBO - faza nieprzezroczystych
|
{ // renderowanie scenerii z VBO - faza nieprzezroczystych
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glAlphaFunc(GL_GREATER, 0.45f); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
glAlphaFunc(GL_GREATER, 0.50f); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
||||||
++TGroundRect::iFrameNumber; // zwięszenie licznika ramek
|
++TGroundRect::iFrameNumber; // zwięszenie licznika ramek
|
||||||
CameraDirection.x = sin(Global::pCameraRotation); // wektor kierunkowy
|
CameraDirection.x = sin(Global::pCameraRotation); // wektor kierunkowy
|
||||||
CameraDirection.z = cos(Global::pCameraRotation);
|
CameraDirection.z = cos(Global::pCameraRotation);
|
||||||
|
|||||||
47
Logs.cpp
47
Logs.cpp
@@ -18,6 +18,33 @@ std::ofstream comms; // lista komunikatow "comms.txt", można go wyłączyć
|
|||||||
|
|
||||||
char endstring[10] = "\n";
|
char endstring[10] = "\n";
|
||||||
|
|
||||||
|
std::string filename_date() {
|
||||||
|
|
||||||
|
::SYSTEMTIME st;
|
||||||
|
::GetSystemTime( &st );
|
||||||
|
char buffer[ 256 ];
|
||||||
|
sprintf( buffer,
|
||||||
|
"%d%02d%02d_%02d%02d",
|
||||||
|
st.wYear,
|
||||||
|
st.wMonth,
|
||||||
|
st.wDay,
|
||||||
|
st.wHour,
|
||||||
|
st.wMinute );
|
||||||
|
|
||||||
|
return std::string( buffer );
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string filename_scenery() {
|
||||||
|
|
||||||
|
auto extension = Global::SceneryFile.rfind( '.' );
|
||||||
|
if( extension != std::string::npos ) {
|
||||||
|
return Global::SceneryFile.substr( 0, extension );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Global::SceneryFile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WriteConsoleOnly(const char *str, double value)
|
void WriteConsoleOnly(const char *str, double value)
|
||||||
{
|
{
|
||||||
char buf[255];
|
char buf[255];
|
||||||
@@ -57,8 +84,14 @@ void WriteLog(const char *str, bool newline)
|
|||||||
{
|
{
|
||||||
if (Global::iWriteLogEnabled & 1)
|
if (Global::iWriteLogEnabled & 1)
|
||||||
{
|
{
|
||||||
if (!output.is_open())
|
if( !output.is_open() ) {
|
||||||
output.open("log.txt", std::ios::trunc);
|
|
||||||
|
std::string const filename =
|
||||||
|
( Global::MultipleLogs ?
|
||||||
|
"logs/log (" + filename_scenery() + ") " + filename_date() + ".txt" :
|
||||||
|
"log.txt" );
|
||||||
|
output.open( filename, std::ios::trunc );
|
||||||
|
}
|
||||||
output << str;
|
output << str;
|
||||||
if (newline)
|
if (newline)
|
||||||
output << "\n";
|
output << "\n";
|
||||||
@@ -72,9 +105,13 @@ void WriteLog(const char *str, bool newline)
|
|||||||
|
|
||||||
void ErrorLog(const char *str)
|
void ErrorLog(const char *str)
|
||||||
{ // Ra: bezwarunkowa rejestracja poważnych błędów
|
{ // Ra: bezwarunkowa rejestracja poważnych błędów
|
||||||
if (!errors.is_open())
|
if (!errors.is_open()) {
|
||||||
{
|
|
||||||
errors.open("errors.txt", std::ios::trunc);
|
std::string const filename =
|
||||||
|
( Global::MultipleLogs ?
|
||||||
|
"logs/errors (" + filename_scenery() + ") " + filename_date() + ".txt" :
|
||||||
|
"errors.txt" );
|
||||||
|
errors.open( filename, std::ios::trunc );
|
||||||
errors << "EU07.EXE " + Global::asRelease << "\n";
|
errors << "EU07.EXE " + Global::asRelease << "\n";
|
||||||
}
|
}
|
||||||
if (str)
|
if (str)
|
||||||
|
|||||||
@@ -416,37 +416,30 @@ struct TPowerParameters
|
|||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
_mover__3 RHeater;
|
_mover__3 RHeater;
|
||||||
|
|
||||||
};
|
};
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
_mover__2 RPowerCable;
|
_mover__2 RPowerCable;
|
||||||
|
|
||||||
};
|
};
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
TCurrentCollector CollectorParameters;
|
TCurrentCollector CollectorParameters;
|
||||||
|
|
||||||
};
|
};
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
_mover__1 RAccumulator;
|
_mover__1 RAccumulator;
|
||||||
|
|
||||||
};
|
};
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
TEngineTypes GeneratorEngine;
|
TEngineTypes GeneratorEngine;
|
||||||
|
|
||||||
};
|
};
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
double InputVoltage;
|
double InputVoltage;
|
||||||
|
|
||||||
};
|
};
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
TPowerType PowerType;
|
TPowerType PowerType;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -670,10 +663,18 @@ public:
|
|||||||
/*nastawniki:*/
|
/*nastawniki:*/
|
||||||
int MainCtrlPosNo = 0; /*ilosc pozycji nastawnika*/
|
int MainCtrlPosNo = 0; /*ilosc pozycji nastawnika*/
|
||||||
int ScndCtrlPosNo = 0;
|
int ScndCtrlPosNo = 0;
|
||||||
int LightsPosNo = 0; // NOTE: values higher than 0 seem to break the current code for light switches
|
int LightsPosNo = 0;
|
||||||
int LightsDefPos = 1;
|
int LightsDefPos = 1;
|
||||||
bool LightsWrap = false;
|
bool LightsWrap = false;
|
||||||
int Lights[2][17]; // pozycje świateł, przód - tył, 1 .. 16
|
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,
|
||||||
|
};
|
||||||
bool ScndInMain = false; /*zaleznosc bocznika od nastawnika*/
|
bool ScndInMain = false; /*zaleznosc bocznika od nastawnika*/
|
||||||
bool MBrake = false; /*Czy jest hamulec reczny*/
|
bool MBrake = false; /*Czy jest hamulec reczny*/
|
||||||
double StopBrakeDecc = 0.0;
|
double StopBrakeDecc = 0.0;
|
||||||
@@ -1173,6 +1174,10 @@ extract_value( _Type &Variable, std::string const &Key, std::string const &Input
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
bool
|
||||||
|
extract_value( bool &Variable, std::string const &Key, std::string const &Input, std::string const &Default );
|
||||||
|
|
||||||
inline
|
inline
|
||||||
std::string
|
std::string
|
||||||
extract_value( std::string const &Key, std::string const &Input ) {
|
extract_value( std::string const &Key, std::string const &Input ) {
|
||||||
|
|||||||
@@ -1814,8 +1814,9 @@ bool TMoverParameters::IncScndCtrl(int CtrlSpeed)
|
|||||||
LastRelayTime = 0;
|
LastRelayTime = 0;
|
||||||
|
|
||||||
if ((OK) && (EngineType == ElectricInductionMotor))
|
if ((OK) && (EngineType == ElectricInductionMotor))
|
||||||
|
// NOTE: round() already adds 0.5, are the ones added here as well correct?
|
||||||
if ((Vmax < 250))
|
if ((Vmax < 250))
|
||||||
ScndCtrlActualPos = Round(Vel + 0.5f);
|
ScndCtrlActualPos = Round(Vel + 0.5);
|
||||||
else
|
else
|
||||||
ScndCtrlActualPos = Round(Vel * 1.0 / 2 + 0.5);
|
ScndCtrlActualPos = Round(Vel * 1.0 / 2 + 0.5);
|
||||||
|
|
||||||
@@ -2031,10 +2032,12 @@ void TMoverParameters::SecuritySystemCheck(double dt)
|
|||||||
(Battery)) // Ra: EZT ma teraz czuwak w rozrządczym
|
(Battery)) // Ra: EZT ma teraz czuwak w rozrządczym
|
||||||
{
|
{
|
||||||
// CA
|
// CA
|
||||||
if (Vel >=
|
if( ( SecuritySystem.AwareMinSpeed > 0.0 ?
|
||||||
SecuritySystem
|
( Vel >= SecuritySystem.AwareMinSpeed ) :
|
||||||
.AwareMinSpeed) // domyślnie predkość większa od 10% Vmax, albo podanej jawnie w FIZ
|
( ActiveDir != 0 ) ) ) {
|
||||||
{
|
// domyślnie predkość większa od 10% Vmax, albo podanej jawnie w FIZ
|
||||||
|
// with defined minspeed of 0 the alerter will activate with reverser out of neutral position
|
||||||
|
// this emulates behaviour of engines like SM42
|
||||||
SecuritySystem.SystemTimer += dt;
|
SecuritySystem.SystemTimer += dt;
|
||||||
if (TestFlag(SecuritySystem.SystemType, 1) &&
|
if (TestFlag(SecuritySystem.SystemType, 1) &&
|
||||||
TestFlag(SecuritySystem.Status, s_aware)) // jeśli świeci albo miga
|
TestFlag(SecuritySystem.Status, s_aware)) // jeśli świeci albo miga
|
||||||
@@ -4087,106 +4090,152 @@ double TMoverParameters::TractionForce(double dt)
|
|||||||
if ((MainCtrlPos == 0) || (ShuntMode))
|
if ((MainCtrlPos == 0) || (ShuntMode))
|
||||||
ScndCtrlPos = 0;
|
ScndCtrlPos = 0;
|
||||||
|
|
||||||
else if (AutoRelayFlag)
|
else {
|
||||||
switch (RelayType)
|
if( AutoRelayFlag ) {
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
if ((Im <= (MPTRelay[ScndCtrlPos].Iup * PosRatio)) &&
|
|
||||||
(ScndCtrlPos < ScndCtrlPosNo))
|
|
||||||
++ScndCtrlPos;
|
|
||||||
if ((Im >= (MPTRelay[ScndCtrlPos].Idown * PosRatio)) && (ScndCtrlPos > 0))
|
|
||||||
--ScndCtrlPos;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
if ((MPTRelay[ScndCtrlPos].Iup < Vel) && (ScndCtrlPos < ScndCtrlPosNo))
|
|
||||||
++ScndCtrlPos;
|
|
||||||
if ((MPTRelay[ScndCtrlPos].Idown > Vel) && (ScndCtrlPos > 0))
|
|
||||||
--ScndCtrlPos;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2:
|
|
||||||
{
|
|
||||||
if ((MPTRelay[ScndCtrlPos].Iup < Vel) && (ScndCtrlPos < ScndCtrlPosNo) &&
|
|
||||||
(EnginePower < (tmp * 0.99)))
|
|
||||||
++ScndCtrlPos;
|
|
||||||
if ((MPTRelay[ScndCtrlPos].Idown < Im) && (ScndCtrlPos > 0))
|
|
||||||
--ScndCtrlPos;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 41:
|
|
||||||
{
|
|
||||||
if ((MainCtrlPos == MainCtrlPosNo) &&
|
|
||||||
(tmpV * 3.6 > MPTRelay[ScndCtrlPos].Iup) && (ScndCtrlPos < ScndCtrlPosNo))
|
|
||||||
{
|
|
||||||
++ScndCtrlPos;
|
|
||||||
enrot = enrot * 0.73;
|
|
||||||
}
|
|
||||||
if ((Im > MPTRelay[ScndCtrlPos].Idown) && (ScndCtrlPos > 0))
|
|
||||||
--ScndCtrlPos;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 45:
|
|
||||||
{
|
|
||||||
if ((MainCtrlPos > 11) && (ScndCtrlPos < ScndCtrlPosNo))
|
|
||||||
if ((ScndCtrlPos == 0))
|
|
||||||
if ((MPTRelay[ScndCtrlPos].Iup > Im))
|
|
||||||
++ScndCtrlPos;
|
|
||||||
else if ((MPTRelay[ScndCtrlPos].Iup < Vel))
|
|
||||||
++ScndCtrlPos;
|
|
||||||
|
|
||||||
// malenie
|
switch( RelayType ) {
|
||||||
if ((ScndCtrlPos > 0) && (MainCtrlPos < 12))
|
|
||||||
if ((ScndCtrlPos == ScndCtrlPosNo))
|
|
||||||
if ((MPTRelay[ScndCtrlPos].Idown < Im))
|
|
||||||
--ScndCtrlPos;
|
|
||||||
else if ((MPTRelay[ScndCtrlPos].Idown > Vel))
|
|
||||||
--ScndCtrlPos;
|
|
||||||
if ((MainCtrlPos < 11) && (ScndCtrlPos > 2))
|
|
||||||
ScndCtrlPos = 2;
|
|
||||||
if ((MainCtrlPos < 9) && (ScndCtrlPos > 0))
|
|
||||||
ScndCtrlPos = 0;
|
|
||||||
}
|
|
||||||
case 46:
|
|
||||||
{
|
|
||||||
// wzrastanie
|
|
||||||
if ((MainCtrlPos > 9) && (ScndCtrlPos < ScndCtrlPosNo))
|
|
||||||
if ((ScndCtrlPos) % 2 == 0)
|
|
||||||
if ((MPTRelay[ScndCtrlPos].Iup > Im))
|
|
||||||
++ScndCtrlPos;
|
|
||||||
else if ((MPTRelay[ScndCtrlPos - 1].Iup > Im) &&
|
|
||||||
(MPTRelay[ScndCtrlPos].Iup < Vel))
|
|
||||||
++ScndCtrlPos;
|
|
||||||
|
|
||||||
// malenie
|
case 0: {
|
||||||
if ((MainCtrlPos < 10) && (ScndCtrlPos > 0))
|
|
||||||
if ((ScndCtrlPos) % 2 == 0)
|
if( ( Im <= ( MPTRelay[ ScndCtrlPos ].Iup * PosRatio ) ) &&
|
||||||
if ((MPTRelay[ScndCtrlPos].Idown < Im))
|
( ScndCtrlPos < ScndCtrlPosNo ) )
|
||||||
|
++ScndCtrlPos;
|
||||||
|
if( ( Im >= ( MPTRelay[ ScndCtrlPos ].Idown * PosRatio ) ) && ( ScndCtrlPos > 0 ) )
|
||||||
--ScndCtrlPos;
|
--ScndCtrlPos;
|
||||||
else if ((MPTRelay[ScndCtrlPos + 1].Idown < Im) &&
|
break;
|
||||||
(MPTRelay[ScndCtrlPos].Idown > Vel))
|
}
|
||||||
|
case 1: {
|
||||||
|
|
||||||
|
if( ( MPTRelay[ ScndCtrlPos ].Iup < Vel ) && ( ScndCtrlPos < ScndCtrlPosNo ) )
|
||||||
|
++ScndCtrlPos;
|
||||||
|
if( ( MPTRelay[ ScndCtrlPos ].Idown > Vel ) && ( ScndCtrlPos > 0 ) )
|
||||||
--ScndCtrlPos;
|
--ScndCtrlPos;
|
||||||
if ((MainCtrlPos < 9) && (ScndCtrlPos > 2))
|
break;
|
||||||
ScndCtrlPos = 2;
|
}
|
||||||
if ((MainCtrlPos < 6) && (ScndCtrlPos > 0))
|
case 2: {
|
||||||
ScndCtrlPos = 0;
|
|
||||||
|
if( ( MPTRelay[ ScndCtrlPos ].Iup < Vel ) && ( ScndCtrlPos < ScndCtrlPosNo ) &&
|
||||||
|
( EnginePower < ( tmp * 0.99 ) ) )
|
||||||
|
++ScndCtrlPos;
|
||||||
|
if( ( MPTRelay[ ScndCtrlPos ].Idown < Im ) && ( ScndCtrlPos > 0 ) )
|
||||||
|
--ScndCtrlPos;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 41:
|
||||||
|
{
|
||||||
|
if( ( MainCtrlPos == MainCtrlPosNo )
|
||||||
|
&& ( tmpV * 3.6 > MPTRelay[ ScndCtrlPos ].Iup )
|
||||||
|
&& ( ScndCtrlPos < ScndCtrlPosNo ) ) {
|
||||||
|
++ScndCtrlPos;
|
||||||
|
enrot = enrot * 0.73;
|
||||||
|
}
|
||||||
|
if( ( Im > MPTRelay[ ScndCtrlPos ].Idown )
|
||||||
|
&& ( ScndCtrlPos > 0 ) ) {
|
||||||
|
--ScndCtrlPos;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 45:
|
||||||
|
{
|
||||||
|
if( ( MainCtrlPos >= 10 ) && ( ScndCtrlPos < ScndCtrlPosNo ) ) {
|
||||||
|
if( ScndCtrlPos == 0 ) {
|
||||||
|
if( Im < MPTRelay[ ScndCtrlPos ].Iup ) {
|
||||||
|
++ScndCtrlPos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if( Vel > MPTRelay[ ScndCtrlPos ].Iup ) {
|
||||||
|
++ScndCtrlPos;
|
||||||
|
}
|
||||||
|
// check for cases where the speed drops below threshold for level 2 or 3
|
||||||
|
if( ( ScndCtrlPos > 1 )
|
||||||
|
&& ( Vel < MPTRelay[ ScndCtrlPos - 1 ].Idown ) ){
|
||||||
|
--ScndCtrlPos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// malenie
|
||||||
|
if( ( ScndCtrlPos > 0 ) && ( MainCtrlPos < 10 ) ) {
|
||||||
|
if( ScndCtrlPos == 1 ) {
|
||||||
|
if( Im > MPTRelay[ ScndCtrlPos - 1 ].Idown ) {
|
||||||
|
--ScndCtrlPos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if( Vel < MPTRelay[ ScndCtrlPos ].Idown ) {
|
||||||
|
--ScndCtrlPos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 3rd level drops with master controller at position lower than 10...
|
||||||
|
if( MainCtrlPos < 10 ) {
|
||||||
|
ScndCtrlPos = std::min( 2, ScndCtrlPos );
|
||||||
|
}
|
||||||
|
// ...and below position 7 field shunt drops altogether
|
||||||
|
if( MainCtrlPos < 7 ) {
|
||||||
|
ScndCtrlPos = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 46:
|
||||||
|
{
|
||||||
|
// wzrastanie
|
||||||
|
if( ( MainCtrlPos >= 10 )
|
||||||
|
&& ( ScndCtrlPos < ScndCtrlPosNo ) ) {
|
||||||
|
if( ( ScndCtrlPos ) % 2 == 0 ) {
|
||||||
|
if( ( MPTRelay[ ScndCtrlPos ].Iup > Im ) ) {
|
||||||
|
++ScndCtrlPos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if( ( MPTRelay[ ScndCtrlPos - 1 ].Iup > Im )
|
||||||
|
&& ( MPTRelay[ ScndCtrlPos ].Iup < Vel ) ) {
|
||||||
|
++ScndCtrlPos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// malenie
|
||||||
|
if( ( MainCtrlPos < 10 )
|
||||||
|
&& ( ScndCtrlPos > 0 ) ) {
|
||||||
|
if( ( ScndCtrlPos ) % 2 == 0 ) {
|
||||||
|
if( ( MPTRelay[ ScndCtrlPos ].Idown < Im ) ) {
|
||||||
|
--ScndCtrlPos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if( ( MPTRelay[ ScndCtrlPos + 1 ].Idown < Im )
|
||||||
|
&& ( MPTRelay[ ScndCtrlPos ].Idown > Vel ) ) {
|
||||||
|
--ScndCtrlPos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( MainCtrlPos < 10 ) {
|
||||||
|
ScndCtrlPos = std::min( 2, ScndCtrlPos );
|
||||||
|
}
|
||||||
|
if( MainCtrlPos < 7 ) {
|
||||||
|
ScndCtrlPos = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} // switch RelayType
|
||||||
}
|
}
|
||||||
} // switch RelayType
|
}
|
||||||
break;
|
break;
|
||||||
} // DieselElectric
|
} // DieselElectric
|
||||||
|
|
||||||
case ElectricInductionMotor:
|
case ElectricInductionMotor:
|
||||||
{
|
{
|
||||||
if ((Mains)) // nie wchodzić w funkcję bez potrzeby
|
if( ( Mains ) ) {
|
||||||
if ((abs(Voltage) < EnginePowerSource.CollectorParameters.MinV) ||
|
// nie wchodzić w funkcję bez potrzeby
|
||||||
(abs(Voltage) > EnginePowerSource.CollectorParameters.MaxV + 200))
|
if( ( abs( Voltage ) < EnginePowerSource.CollectorParameters.MinV )
|
||||||
{
|
|| ( abs( Voltage ) > EnginePowerSource.CollectorParameters.MaxV + 200 ) ) {
|
||||||
MainSwitch(false);
|
MainSwitch( false );
|
||||||
}
|
}
|
||||||
tmpV = abs(nrot) * (PI * WheelDiameter) *
|
}
|
||||||
3.6; //*DirAbsolute*eimc[eimc_s_p]; - do przemyslenia dzialanie pp
|
tmpV = abs(nrot) * (PI * WheelDiameter) * 3.6; //*DirAbsolute*eimc[eimc_s_p]; - do przemyslenia dzialanie pp
|
||||||
if ((Mains))
|
if ((Mains))
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -7915,3 +7964,22 @@ double TMoverParameters::ShowCurrentP(int AmpN)
|
|||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
bool
|
||||||
|
extract_value( bool &Variable, std::string const &Key, std::string const &Input, std::string const &Default ) {
|
||||||
|
|
||||||
|
auto value = extract_value( Key, Input );
|
||||||
|
if( false == value.empty() ) {
|
||||||
|
// set the specified variable to retrieved value
|
||||||
|
Variable = ( ToLower( value ) == "yes" );
|
||||||
|
return true; // located the variable
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// set the variable to provided default value
|
||||||
|
if( false == Default.empty() ) {
|
||||||
|
Variable = ( ToLower( Default ) == "yes" );
|
||||||
|
}
|
||||||
|
return false; // supplied the default
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -72,23 +72,11 @@ double Min0R(double x1, double x2)
|
|||||||
// TODO: replace with something sensible
|
// TODO: replace with something sensible
|
||||||
std::string Now() {
|
std::string Now() {
|
||||||
|
|
||||||
std::time_t timenow = std::time( nullptr );
|
std::time_t timenow = std::time( nullptr );
|
||||||
std::tm tm = *std::localtime( &timenow );
|
std::tm tm = *std::localtime( &timenow );
|
||||||
std::stringstream converter;
|
std::stringstream converter;
|
||||||
converter << std::put_time( &tm, "%c" );
|
converter << std::put_time( &tm, "%c" );
|
||||||
return converter.str();
|
return converter.str();
|
||||||
|
|
||||||
/* char buffer[ 256 ];
|
|
||||||
sprintf( buffer,
|
|
||||||
"%d-%02d-%02d %02d:%02d:%02d.%03d",
|
|
||||||
st.wYear,
|
|
||||||
st.wMonth,
|
|
||||||
st.wDay,
|
|
||||||
st.wHour,
|
|
||||||
st.wMinute,
|
|
||||||
st.wSecond,
|
|
||||||
st.wMilliseconds );
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TestFlag(int Flag, int Value)
|
bool TestFlag(int Flag, int Value)
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ inline double Sign(double x)
|
|||||||
return x >= 0 ? 1.0 : -1.0;
|
return x >= 0 ? 1.0 : -1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline long Round(float f)
|
inline long Round(double const f)
|
||||||
{
|
{
|
||||||
return (long)(f + 0.5);
|
return (long)(f + 0.5);
|
||||||
//return lround(f);
|
//return lround(f);
|
||||||
|
|||||||
100
Train.h
100
Train.h
@@ -70,37 +70,32 @@ class TTrain
|
|||||||
bool InitializeCab(int NewCabNo, std::string const &asFileName);
|
bool InitializeCab(int NewCabNo, std::string const &asFileName);
|
||||||
TTrain();
|
TTrain();
|
||||||
~TTrain();
|
~TTrain();
|
||||||
// bool Init(TTrack *Track);
|
|
||||||
// McZapkie-010302
|
// McZapkie-010302
|
||||||
bool Init(TDynamicObject *NewDynamicObject, bool e3d = false);
|
bool Init(TDynamicObject *NewDynamicObject, bool e3d = false);
|
||||||
void OnKeyDown(int cKey);
|
void OnKeyDown(int cKey);
|
||||||
void OnKeyUp(int cKey);
|
void OnKeyUp(int cKey);
|
||||||
void OnCommand( command_data const &Command );
|
|
||||||
|
|
||||||
// bool SHP() { fShpTimer= 0; };
|
inline vector3 GetDirection() { return DynamicObject->VectorFront(); };
|
||||||
|
inline vector3 GetUp() { return DynamicObject->VectorUp(); };
|
||||||
inline vector3 GetDirection()
|
|
||||||
{
|
|
||||||
return DynamicObject->VectorFront();
|
|
||||||
};
|
|
||||||
inline vector3 GetUp()
|
|
||||||
{
|
|
||||||
return DynamicObject->VectorUp();
|
|
||||||
};
|
|
||||||
void UpdateMechPosition(double dt);
|
void UpdateMechPosition(double dt);
|
||||||
vector3 GetWorldMechPosition();
|
vector3 GetWorldMechPosition();
|
||||||
bool Update( double const Deltatime );
|
bool Update( double const Deltatime );
|
||||||
bool m_updated = false;
|
bool m_updated = false;
|
||||||
void MechStop();
|
void MechStop();
|
||||||
void SetLights();
|
void SetLights();
|
||||||
// virtual bool RenderAlpha();
|
|
||||||
// McZapkie-310302: ladowanie parametrow z pliku
|
// McZapkie-310302: ladowanie parametrow z pliku
|
||||||
bool LoadMMediaFile(std::string const &asFileName);
|
bool LoadMMediaFile(std::string const &asFileName);
|
||||||
PyObject *GetTrainState();
|
PyObject *GetTrainState();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// types
|
||||||
|
typedef void( *command_handler )( TTrain *Train, command_data const &Command );
|
||||||
|
typedef std::unordered_map<user_command, command_handler> commandhandler_map;
|
||||||
// clears state of all cabin controls
|
// clears state of all cabin controls
|
||||||
void clear_cab_controls();
|
void clear_cab_controls();
|
||||||
|
// sets cabin controls based on current state of the vehicle
|
||||||
|
// NOTE: we can get rid of this function once we have per-cab persistent state
|
||||||
|
void set_cab_controls();
|
||||||
// initializes a gauge matching provided label. returns: true if the label was found, false
|
// initializes a gauge matching provided label. returns: true if the label was found, false
|
||||||
// otherwise
|
// otherwise
|
||||||
bool initialize_gauge(cParser &Parser, std::string const &Label, int const Cabindex);
|
bool initialize_gauge(cParser &Parser, std::string const &Label, int const Cabindex);
|
||||||
@@ -109,20 +104,67 @@ class TTrain
|
|||||||
bool initialize_button(cParser &Parser, std::string const &Label, int const Cabindex);
|
bool initialize_button(cParser &Parser, std::string const &Label, int const Cabindex);
|
||||||
// plays specified sound, or fallback sound if the primary sound isn't presend
|
// plays specified sound, or fallback sound if the primary sound isn't presend
|
||||||
// NOTE: temporary routine until sound system is sorted out and paired with switches
|
// NOTE: temporary routine until sound system is sorted out and paired with switches
|
||||||
void play_sound( PSound Sound, PSound Fallbacksound = nullptr );
|
void play_sound( PSound Sound, int const Volume = DSBVOLUME_MAX, DWORD const Flags = 0 );
|
||||||
|
void play_sound( PSound Sound, PSound Fallbacksound, int const Volume, DWORD const Flags );
|
||||||
|
// helper, returns true for EMU with oerlikon brake
|
||||||
|
bool is_eztoer() const;
|
||||||
|
// command handlers
|
||||||
|
// NOTE: we're currently using universal handlers and static handler map but it may be beneficial to have these implemented on individual class instance basis
|
||||||
|
// TBD, TODO: consider this approach if we ever want to have customized consist behaviour to received commands, based on the consist/vehicle type or whatever
|
||||||
|
static void OnCommand_mastercontrollerincrease( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_mastercontrollerincreasefast( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_mastercontrollerdecrease( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_mastercontrollerdecreasefast( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_secondcontrollerincrease( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_secondcontrollerincreasefast( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_secondcontrollerdecrease( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_secondcontrollerdecreasefast( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_independentbrakeincrease( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_independentbrakeincreasefast( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_independentbrakedecrease( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_independentbrakedecreasefast( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_independentbrakebailoff( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_trainbrakeincrease( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_trainbrakedecrease( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_trainbrakecharging( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_trainbrakerelease( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_trainbrakefirstservice( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_trainbrakeservice( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_trainbrakefullservice( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_trainbrakeemergency( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_reverserincrease( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_reverserdecrease( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_alerteracknowledge( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_batterytoggle( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_pantographtogglefront( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_pantographtogglerear( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_linebreakertoggle( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_convertertoggle( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_compressortoggle( 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 );
|
||||||
|
static void OnCommand_redmarkertoggleleft( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_redmarkertoggleright( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_headlighttogglerearleft( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_headlighttogglerearright( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_headlighttogglerearupper( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_redmarkertogglerearleft( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_redmarkertogglerearright( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_doortoggleleft( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_doortoggleright( TTrain *Train, command_data const &Command );
|
||||||
|
|
||||||
// helper variable, to prevent immediate switch between closing and opening line breaker circuit
|
// members
|
||||||
bool m_linebreakerclosed{ false };
|
|
||||||
|
|
||||||
private: //żeby go nic z zewnątrz nie przestawiało
|
|
||||||
TDynamicObject *DynamicObject; // przestawia zmiana pojazdu [F5]
|
TDynamicObject *DynamicObject; // przestawia zmiana pojazdu [F5]
|
||||||
private: //żeby go nic z zewnątrz nie przestawiało
|
|
||||||
TMoverParameters *mvControlled; // człon, w którym sterujemy silnikiem
|
TMoverParameters *mvControlled; // człon, w którym sterujemy silnikiem
|
||||||
TMoverParameters *mvOccupied; // człon, w którym sterujemy hamulcem
|
TMoverParameters *mvOccupied; // człon, w którym sterujemy hamulcem
|
||||||
TMoverParameters *mvSecond; // drugi człon (ET40, ET41, ET42, ukrotnienia)
|
TMoverParameters *mvSecond; // drugi człon (ET40, ET41, ET42, ukrotnienia)
|
||||||
TMoverParameters *mvThird; // trzeci człon (SN61)
|
TMoverParameters *mvThird; // trzeci człon (SN61)
|
||||||
public: // reszta może by?publiczna
|
// helper variable, to prevent immediate switch between closing and opening line breaker circuit
|
||||||
// AnsiString asMessage;
|
bool m_linebreakerclosed{ false };
|
||||||
|
static const commandhandler_map m_commandhandlers;
|
||||||
|
|
||||||
|
public: // reszta może by?publiczna
|
||||||
|
|
||||||
// McZapkie: definicje wskaźników
|
// McZapkie: definicje wskaźników
|
||||||
// Ra 2014-08: częsciowo przeniesione do tablicy w TCab
|
// Ra 2014-08: częsciowo przeniesione do tablicy w TCab
|
||||||
@@ -220,7 +262,6 @@ class TTrain
|
|||||||
TGauge ggTrainHeatingButton;
|
TGauge ggTrainHeatingButton;
|
||||||
TGauge ggSignallingButton;
|
TGauge ggSignallingButton;
|
||||||
TGauge ggDoorSignallingButton;
|
TGauge ggDoorSignallingButton;
|
||||||
// TModel3d *mdKabina; McZapkie-030303: to do dynobj
|
|
||||||
// TGauge ggDistCounter; //Ra 2014-07: licznik kilometrów
|
// TGauge ggDistCounter; //Ra 2014-07: licznik kilometrów
|
||||||
// TGauge ggVelocityDgt; //i od razu prędkościomierz
|
// TGauge ggVelocityDgt; //i od razu prędkościomierz
|
||||||
|
|
||||||
@@ -422,18 +463,9 @@ class TTrain
|
|||||||
public:
|
public:
|
||||||
float fPress[20][3]; // cisnienia dla wszystkich czlonow
|
float fPress[20][3]; // cisnienia dla wszystkich czlonow
|
||||||
float fEIMParams[9][10]; // parametry dla silnikow asynchronicznych
|
float fEIMParams[9][10]; // parametry dla silnikow asynchronicznych
|
||||||
int RadioChannel()
|
int RadioChannel() { return iRadioChannel; };
|
||||||
{
|
inline TDynamicObject *Dynamic() { return DynamicObject; };
|
||||||
return iRadioChannel;
|
inline TMoverParameters *Controlled() { return mvControlled; };
|
||||||
};
|
|
||||||
inline TDynamicObject *Dynamic()
|
|
||||||
{
|
|
||||||
return DynamicObject;
|
|
||||||
};
|
|
||||||
inline TMoverParameters *Controlled()
|
|
||||||
{
|
|
||||||
return mvControlled;
|
|
||||||
};
|
|
||||||
void DynamicSet(TDynamicObject *d);
|
void DynamicSet(TDynamicObject *d);
|
||||||
void Silence();
|
void Silence();
|
||||||
};
|
};
|
||||||
|
|||||||
31
World.cpp
31
World.cpp
@@ -1692,13 +1692,18 @@ TWorld::Update_UI() {
|
|||||||
// timetable
|
// timetable
|
||||||
TDynamicObject *tmp =
|
TDynamicObject *tmp =
|
||||||
( FreeFlyModeFlag ?
|
( FreeFlyModeFlag ?
|
||||||
Ground.DynamicNearest( Camera.Pos ) :
|
Ground.DynamicNearest( Camera.Pos ) :
|
||||||
Controlled ); // w trybie latania lokalizujemy wg mapy
|
Controlled ); // w trybie latania lokalizujemy wg mapy
|
||||||
|
|
||||||
if( tmp == nullptr ) { break; }
|
if( tmp == nullptr ) { break; }
|
||||||
if( tmp->Mechanik == nullptr ) { break; }
|
// if the nearest located vehicle doesn't have a direct driver, try to query its owner
|
||||||
|
auto const owner = (
|
||||||
|
tmp->Mechanik != nullptr ?
|
||||||
|
tmp->Mechanik :
|
||||||
|
tmp->ctOwner );
|
||||||
|
if( owner == nullptr ){ break; }
|
||||||
|
|
||||||
auto const table = tmp->Mechanik->Timetable();
|
auto const table = owner->Timetable();
|
||||||
if( table == nullptr ) { break; }
|
if( table == nullptr ) { break; }
|
||||||
|
|
||||||
auto const &time = simulation::Time.data();
|
auto const &time = simulation::Time.data();
|
||||||
@@ -1711,14 +1716,12 @@ TWorld::Update_UI() {
|
|||||||
uitextline1 += " (paused)";
|
uitextline1 += " (paused)";
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Controlled
|
uitextline2 = Global::Bezogonkow( owner->Relation(), true ) + " (" + owner->Timetable()->TrainName + ")";
|
||||||
&& Controlled->Mechanik ) {
|
auto const nextstation = Global::Bezogonkow( owner->NextStop(), true );
|
||||||
uitextline2 = Global::Bezogonkow( Controlled->Mechanik->Relation(), true ) + " (" + tmp->Mechanik->Timetable()->TrainName + ")";
|
if( !nextstation.empty() ) {
|
||||||
if( !uitextline2.empty() ) {
|
// jeśli jest podana relacja, to dodajemy punkt następnego zatrzymania
|
||||||
// jeśli jest podana relacja, to dodajemy punkt następnego zatrzymania
|
uitextline3 = " -> " + nextstation;
|
||||||
uitextline3 = " -> " + Global::Bezogonkow( Controlled->Mechanik->NextStop(), true );
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( Global::iScreenMode[ Global::iTextMode - GLFW_KEY_F1 ] == 1 ) {
|
if( Global::iScreenMode[ Global::iTextMode - GLFW_KEY_F1 ] == 1 ) {
|
||||||
|
|
||||||
@@ -1731,7 +1734,7 @@ TWorld::Update_UI() {
|
|||||||
UITable->text_lines.emplace_back( "+----------------------------+-------+-------+-----+", Global::UITextColor );
|
UITable->text_lines.emplace_back( "+----------------------------+-------+-------+-----+", Global::UITextColor );
|
||||||
|
|
||||||
TMTableLine *tableline;
|
TMTableLine *tableline;
|
||||||
for( int i = tmp->Mechanik->iStationStart; i <= std::min( tmp->Mechanik->iStationStart + 15, table->StationCount ); ++i ) {
|
for( int i = owner->iStationStart; i <= std::min( owner->iStationStart + 15, table->StationCount ); ++i ) {
|
||||||
// wyświetlenie pozycji z rozkładu
|
// wyświetlenie pozycji z rozkładu
|
||||||
tableline = table->TimeTable + i; // linijka rozkładu
|
tableline = table->TimeTable + i; // linijka rozkładu
|
||||||
|
|
||||||
@@ -1752,7 +1755,7 @@ TWorld::Update_UI() {
|
|||||||
|
|
||||||
UITable->text_lines.emplace_back(
|
UITable->text_lines.emplace_back(
|
||||||
Global::Bezogonkow( "| " + station + " | " + arrival + " | " + departure + " | " + vmax + " | " + tableline->StationWare, true ),
|
Global::Bezogonkow( "| " + station + " | " + arrival + " | " + departure + " | " + vmax + " | " + tableline->StationWare, true ),
|
||||||
( ( tmp->Mechanik->iStationStart < table->StationIndex ) && ( i < table->StationIndex ) ?
|
( ( owner->iStationStart < table->StationIndex ) && ( i < table->StationIndex ) ?
|
||||||
float4( 0.0f, 1.0f, 0.0f, 1.0f ) :// czas minął i odjazd był, to nazwa stacji będzie na zielono
|
float4( 0.0f, 1.0f, 0.0f, 1.0f ) :// czas minął i odjazd był, to nazwa stacji będzie na zielono
|
||||||
Global::UITextColor )
|
Global::UITextColor )
|
||||||
);
|
);
|
||||||
|
|||||||
57
command.cpp
57
command.cpp
@@ -91,6 +91,9 @@ const int k_Fuse = 26;
|
|||||||
const int k_MaxCurrent = 29;
|
const int k_MaxCurrent = 29;
|
||||||
const int k_CurrentAutoRelay = 30;
|
const int k_CurrentAutoRelay = 30;
|
||||||
const int k_BrakeProfile = 31;
|
const int k_BrakeProfile = 31;
|
||||||
|
*/
|
||||||
|
{ user_command::alerteracknowledge, command_target::vehicle },
|
||||||
|
/*
|
||||||
const int k_Czuwak = 32;
|
const int k_Czuwak = 32;
|
||||||
const int k_Horn = 33;
|
const int k_Horn = 33;
|
||||||
const int k_Horn2 = 34;
|
const int k_Horn2 = 34;
|
||||||
@@ -118,10 +121,10 @@ const int k_DeCouple = 45;
|
|||||||
const int k_ProgramQuit = 46;
|
const int k_ProgramQuit = 46;
|
||||||
// const int k_ProgramPause= 47;
|
// const int k_ProgramPause= 47;
|
||||||
const int k_ProgramHelp = 48;
|
const int k_ProgramHelp = 48;
|
||||||
const int k_OpenLeft = 49;
|
*/
|
||||||
const int k_OpenRight = 50;
|
{ user_command::doortoggleleft, command_target::vehicle },
|
||||||
const int k_CloseLeft = 51;
|
{ user_command::doortoggleright, command_target::vehicle },
|
||||||
const int k_CloseRight = 52;
|
/*
|
||||||
const int k_DepartureSignal = 53;
|
const int k_DepartureSignal = 53;
|
||||||
*/
|
*/
|
||||||
{ user_command::pantographtogglefront, command_target::vehicle },
|
{ user_command::pantographtogglefront, command_target::vehicle },
|
||||||
@@ -129,9 +132,18 @@ const int k_DepartureSignal = 53;
|
|||||||
/*
|
/*
|
||||||
const int k_Heating = 58;
|
const int k_Heating = 58;
|
||||||
// const int k_FreeFlyMode= 59;
|
// const int k_FreeFlyMode= 59;
|
||||||
const int k_LeftSign = 60;
|
*/
|
||||||
const int k_UpperSign = 61;
|
{ user_command::headlighttoggleleft, command_target::vehicle },
|
||||||
const int k_RightSign = 62;
|
{ user_command::headlighttoggleright, command_target::vehicle },
|
||||||
|
{ user_command::headlighttoggleupper, command_target::vehicle },
|
||||||
|
{ user_command::redmarkertoggleleft, command_target::vehicle },
|
||||||
|
{ user_command::redmarkertoggleright, command_target::vehicle },
|
||||||
|
{ user_command::headlighttogglerearleft, command_target::vehicle },
|
||||||
|
{ user_command::headlighttogglerearright, command_target::vehicle },
|
||||||
|
{ user_command::headlighttogglerearupper, command_target::vehicle },
|
||||||
|
{ user_command::redmarkertogglerearleft, command_target::vehicle },
|
||||||
|
{ user_command::redmarkertogglerearright, command_target::vehicle },
|
||||||
|
/*
|
||||||
const int k_SmallCompressor = 63;
|
const int k_SmallCompressor = 63;
|
||||||
const int k_StLinOff = 64;
|
const int k_StLinOff = 64;
|
||||||
const int k_CurrentNext = 65;
|
const int k_CurrentNext = 65;
|
||||||
@@ -189,6 +201,9 @@ const int k_Fuse = 26;
|
|||||||
const int k_MaxCurrent = 29;
|
const int k_MaxCurrent = 29;
|
||||||
const int k_CurrentAutoRelay = 30;
|
const int k_CurrentAutoRelay = 30;
|
||||||
const int k_BrakeProfile = 31;
|
const int k_BrakeProfile = 31;
|
||||||
|
*/
|
||||||
|
"alerteracknowledge",
|
||||||
|
/*
|
||||||
const int k_Czuwak = 32;
|
const int k_Czuwak = 32;
|
||||||
const int k_Horn = 33;
|
const int k_Horn = 33;
|
||||||
const int k_Horn2 = 34;
|
const int k_Horn2 = 34;
|
||||||
@@ -216,10 +231,10 @@ const int k_DeCouple = 45;
|
|||||||
const int k_ProgramQuit = 46;
|
const int k_ProgramQuit = 46;
|
||||||
// const int k_ProgramPause= 47;
|
// const int k_ProgramPause= 47;
|
||||||
const int k_ProgramHelp = 48;
|
const int k_ProgramHelp = 48;
|
||||||
const int k_OpenLeft = 49;
|
*/
|
||||||
const int k_OpenRight = 50;
|
"doortoggleleft",
|
||||||
const int k_CloseLeft = 51;
|
"doortoggleright",
|
||||||
const int k_CloseRight = 52;
|
/*
|
||||||
const int k_DepartureSignal = 53;
|
const int k_DepartureSignal = 53;
|
||||||
*/
|
*/
|
||||||
"pantographtogglefront",
|
"pantographtogglefront",
|
||||||
@@ -227,9 +242,18 @@ const int k_DepartureSignal = 53;
|
|||||||
/*
|
/*
|
||||||
const int k_Heating = 58;
|
const int k_Heating = 58;
|
||||||
// const int k_FreeFlyMode= 59;
|
// const int k_FreeFlyMode= 59;
|
||||||
const int k_LeftSign = 60;
|
*/
|
||||||
const int k_UpperSign = 61;
|
"headlighttoggleleft",
|
||||||
const int k_RightSign = 62;
|
"headlighttoggleright",
|
||||||
|
"headlighttoggleupper",
|
||||||
|
"redmarkertoggleleft",
|
||||||
|
"redmarkertoggleright",
|
||||||
|
"headlighttogglerearleft",
|
||||||
|
"headlighttogglerearright",
|
||||||
|
"headlighttogglerearupper",
|
||||||
|
"redmarkertogglerearleft",
|
||||||
|
"redmarkertogglerearright",
|
||||||
|
/*
|
||||||
const int k_SmallCompressor = 63;
|
const int k_SmallCompressor = 63;
|
||||||
const int k_StLinOff = 64;
|
const int k_StLinOff = 64;
|
||||||
const int k_CurrentNext = 65;
|
const int k_CurrentNext = 65;
|
||||||
@@ -258,8 +282,9 @@ command_relay::post( user_command const Command, std::uint64_t const Param1, std
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( ( lookup->second == command_target::vehicle )
|
if( ( lookup->second == command_target::vehicle )
|
||||||
&& ( true == FreeFlyModeFlag ) ) {
|
&& ( true == FreeFlyModeFlag )
|
||||||
// don't pass vehicle commands if the user isn't in one
|
&& ( false == DebugModeFlag ) ) {
|
||||||
|
// don't pass vehicle commands if the user isn't in one, unless we're in debug mode
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
26
command.h
26
command.h
@@ -51,6 +51,9 @@ const int k_Fuse = 26;
|
|||||||
const int k_MaxCurrent = 29;
|
const int k_MaxCurrent = 29;
|
||||||
const int k_CurrentAutoRelay = 30;
|
const int k_CurrentAutoRelay = 30;
|
||||||
const int k_BrakeProfile = 31;
|
const int k_BrakeProfile = 31;
|
||||||
|
*/
|
||||||
|
alerteracknowledge,
|
||||||
|
/*
|
||||||
const int k_Czuwak = 32;
|
const int k_Czuwak = 32;
|
||||||
const int k_Horn = 33;
|
const int k_Horn = 33;
|
||||||
const int k_Horn2 = 34;
|
const int k_Horn2 = 34;
|
||||||
@@ -78,10 +81,10 @@ const int k_DeCouple = 45;
|
|||||||
const int k_ProgramQuit = 46;
|
const int k_ProgramQuit = 46;
|
||||||
// const int k_ProgramPause= 47;
|
// const int k_ProgramPause= 47;
|
||||||
const int k_ProgramHelp = 48;
|
const int k_ProgramHelp = 48;
|
||||||
const int k_OpenLeft = 49;
|
*/
|
||||||
const int k_OpenRight = 50;
|
doortoggleleft,
|
||||||
const int k_CloseLeft = 51;
|
doortoggleright,
|
||||||
const int k_CloseRight = 52;
|
/*
|
||||||
const int k_DepartureSignal = 53;
|
const int k_DepartureSignal = 53;
|
||||||
*/
|
*/
|
||||||
pantographtogglefront,
|
pantographtogglefront,
|
||||||
@@ -89,9 +92,18 @@ const int k_DepartureSignal = 53;
|
|||||||
/*
|
/*
|
||||||
const int k_Heating = 58;
|
const int k_Heating = 58;
|
||||||
// const int k_FreeFlyMode= 59;
|
// const int k_FreeFlyMode= 59;
|
||||||
const int k_LeftSign = 60;
|
*/
|
||||||
const int k_UpperSign = 61;
|
headlighttoggleleft,
|
||||||
const int k_RightSign = 62;
|
headlighttoggleright,
|
||||||
|
headlighttoggleupper,
|
||||||
|
redmarkertoggleleft,
|
||||||
|
redmarkertoggleright,
|
||||||
|
headlighttogglerearleft,
|
||||||
|
headlighttogglerearright,
|
||||||
|
headlighttogglerearupper,
|
||||||
|
redmarkertogglerearleft,
|
||||||
|
redmarkertogglerearright,
|
||||||
|
/*
|
||||||
const int k_SmallCompressor = 63;
|
const int k_SmallCompressor = 63;
|
||||||
const int k_StLinOff = 64;
|
const int k_StLinOff = 64;
|
||||||
const int k_CurrentNext = 65;
|
const int k_CurrentNext = 65;
|
||||||
|
|||||||
@@ -130,7 +130,9 @@ const int k_Fuse = 26;
|
|||||||
const int k_MaxCurrent = 29;
|
const int k_MaxCurrent = 29;
|
||||||
const int k_CurrentAutoRelay = 30;
|
const int k_CurrentAutoRelay = 30;
|
||||||
const int k_BrakeProfile = 31;
|
const int k_BrakeProfile = 31;
|
||||||
const int k_Czuwak = 32;
|
*/
|
||||||
|
{ "alerteracknowledge", command_target::vehicle, GLFW_KEY_SPACE },
|
||||||
|
/*
|
||||||
const int k_Horn = 33;
|
const int k_Horn = 33;
|
||||||
const int k_Horn2 = 34;
|
const int k_Horn2 = 34;
|
||||||
const int k_FailedEngineCutOff = 35;
|
const int k_FailedEngineCutOff = 35;
|
||||||
@@ -157,10 +159,10 @@ const int k_DeCouple = 45;
|
|||||||
const int k_ProgramQuit = 46;
|
const int k_ProgramQuit = 46;
|
||||||
// const int k_ProgramPause= 47;
|
// const int k_ProgramPause= 47;
|
||||||
const int k_ProgramHelp = 48;
|
const int k_ProgramHelp = 48;
|
||||||
const int k_OpenLeft = 49;
|
*/
|
||||||
const int k_OpenRight = 50;
|
{ "doortoggleleft", command_target::vehicle, GLFW_KEY_COMMA },
|
||||||
const int k_CloseLeft = 51;
|
{ "doortoggleright", command_target::vehicle, GLFW_KEY_PERIOD },
|
||||||
const int k_CloseRight = 52;
|
/*
|
||||||
const int k_DepartureSignal = 53;
|
const int k_DepartureSignal = 53;
|
||||||
*/
|
*/
|
||||||
{ "pantographtogglefront", command_target::vehicle, GLFW_KEY_P },
|
{ "pantographtogglefront", command_target::vehicle, GLFW_KEY_P },
|
||||||
@@ -168,9 +170,18 @@ const int k_DepartureSignal = 53;
|
|||||||
/*
|
/*
|
||||||
const int k_Heating = 58;
|
const int k_Heating = 58;
|
||||||
// const int k_FreeFlyMode= 59;
|
// const int k_FreeFlyMode= 59;
|
||||||
const int k_LeftSign = 60;
|
*/
|
||||||
const int k_UpperSign = 61;
|
{ "headlighttoggleleft", command_target::vehicle, GLFW_KEY_Y },
|
||||||
const int k_RightSign = 62;
|
{ "headlighttoggleright", command_target::vehicle, GLFW_KEY_I },
|
||||||
|
{ "headlighttoggleupper", command_target::vehicle, GLFW_KEY_U },
|
||||||
|
{ "redmarkertoggleleft", command_target::vehicle, GLFW_KEY_Y | keymodifier::shift },
|
||||||
|
{ "redmarkertoggleright", command_target::vehicle, GLFW_KEY_I | keymodifier::shift },
|
||||||
|
{ "headlighttogglerearleft", command_target::vehicle, GLFW_KEY_Y | keymodifier::control },
|
||||||
|
{ "headlighttogglerearright", command_target::vehicle, GLFW_KEY_I | keymodifier::control },
|
||||||
|
{ "headlighttogglerearupper", command_target::vehicle, GLFW_KEY_U | keymodifier::control },
|
||||||
|
{ "redmarkertogglerearleft", command_target::vehicle, GLFW_KEY_Y | keymodifier::control | keymodifier::shift },
|
||||||
|
{ "redmarkertogglerearright", command_target::vehicle, GLFW_KEY_I | keymodifier::control | keymodifier::shift },
|
||||||
|
/*
|
||||||
const int k_SmallCompressor = 63;
|
const int k_SmallCompressor = 63;
|
||||||
const int k_StLinOff = 64;
|
const int k_StLinOff = 64;
|
||||||
const int k_CurrentNext = 65;
|
const int k_CurrentNext = 65;
|
||||||
|
|||||||
@@ -220,7 +220,7 @@
|
|||||||
<Filter>Source Files\input</Filter>
|
<Filter>Source Files\input</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="gamepadinput.cpp">
|
<ClCompile Include="gamepadinput.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files\input</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -429,7 +429,7 @@
|
|||||||
<Filter>Header Files\input</Filter>
|
<Filter>Header Files\input</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="gamepadinput.h">
|
<ClInclude Include="gamepadinput.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\input</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ bool
|
|||||||
opengl_renderer::Render( TGround *Ground ) {
|
opengl_renderer::Render( TGround *Ground ) {
|
||||||
|
|
||||||
glDisable( GL_BLEND );
|
glDisable( GL_BLEND );
|
||||||
glAlphaFunc( GL_GREATER, 0.45f ); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
glAlphaFunc( GL_GREATER, 0.50f ); // im mniejsza wartość, tym większa ramka, domyślnie 0.1f
|
||||||
glEnable( GL_LIGHTING );
|
glEnable( GL_LIGHTING );
|
||||||
glColor3f( 1.0f, 1.0f, 1.0f );
|
glColor3f( 1.0f, 1.0f, 1.0f );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user