16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 00:09:19 +02:00

Merge branch 'tmj-dev' into milek-dev

This commit is contained in:
milek7
2018-05-22 21:28:00 +02:00
11 changed files with 299 additions and 149 deletions

View File

@@ -336,9 +336,7 @@ std::vector<std::string> const TTrain::fPress_labels = {
};
TTrain::TTrain() {
/*
Universal4Active = false;
*/
ShowNextCurrent = false;
// McZapkie-240302 - przyda sie do tachometru
fTachoVelocity = 0;
@@ -433,10 +431,10 @@ bool TTrain::Init(TDynamicObject *NewDynamicObject, bool e3d)
PyObject *TTrain::GetTrainState() {
auto const &mover = DynamicObject->MoverParameters;
auto const *mover = DynamicObject->MoverParameters;
auto *dict = PyDict_New();
if( ( dict == nullptr )
|| ( mover == nullptr ) ) {
|| ( mover == nullptr ) ) {
return nullptr;
}
@@ -759,7 +757,8 @@ void TTrain::OnCommand_secondcontrollerincrease( TTrain *Train, command_data con
if( Command.action != GLFW_RELEASE ) {
// on press or hold
if( Train->mvControlled->ShuntMode ) {
if( ( Train->mvControlled->EngineType == DieselElectric )
&& ( true == Train->mvControlled->ShuntMode ) ) {
Train->mvControlled->AnPos = clamp(
Train->mvControlled->AnPos + 0.025,
0.0, 1.0 );
@@ -774,7 +773,13 @@ void TTrain::OnCommand_secondcontrollerincreasefast( TTrain *Train, command_data
if( Command.action != GLFW_RELEASE ) {
// on press or hold
Train->mvControlled->IncScndCtrl( 2 );
if( ( Train->mvControlled->EngineType == DieselElectric )
&& ( true == Train->mvControlled->ShuntMode ) ) {
Train->mvControlled->AnPos = 1.0;
}
else {
Train->mvControlled->IncScndCtrl( 2 );
}
}
}
@@ -820,12 +825,15 @@ void TTrain::OnCommand_secondcontrollerdecrease( TTrain *Train, command_data con
if( Command.action != GLFW_RELEASE ) {
// on press or hold
if( Train->mvControlled->ShuntMode ) {
if( ( Train->mvControlled->EngineType == DieselElectric )
&& ( true == Train->mvControlled->ShuntMode ) ) {
Train->mvControlled->AnPos = clamp(
Train->mvControlled->AnPos - 0.025,
0.0, 1.0 );
}
Train->mvControlled->DecScndCtrl( 1 );
else {
Train->mvControlled->DecScndCtrl( 1 );
}
}
}
@@ -833,7 +841,13 @@ void TTrain::OnCommand_secondcontrollerdecreasefast( TTrain *Train, command_data
if( Command.action != GLFW_RELEASE ) {
// on press or hold
Train->mvControlled->DecScndCtrl( 2 );
if( ( Train->mvControlled->EngineType == DieselElectric )
&& ( true == Train->mvControlled->ShuntMode ) ) {
Train->mvControlled->AnPos = 0.0;
}
else {
Train->mvControlled->DecScndCtrl( 2 );
}
}
}
@@ -5978,6 +5992,11 @@ bool TTrain::InitializeCab(int NewCabNo, std::string const &asFileName)
// bieżąca sciezka do tekstur to dynamic/...
Global.asCurrentTexturePath = DynamicObject->asBaseDir;
// szukaj kabinę jako oddzielny model
// name can contain leading slash, erase it to avoid creation of double slashes when the name is combined with current directory
replace_slashes( token );
if( token[ 0 ] == '/' ) {
token.erase( 0, 1 );
}
TModel3d *kabina = TModelsManager::GetModel(DynamicObject->asBaseDir + token, true);
// z powrotem defaultowa sciezka do tekstur
Global.asCurrentTexturePath = szTexturePath;