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

re-enabled door controls (hard-coded and limited to EZT for the time being); added more convenient version of getkyval(); fixed disappearing vehicle wheels.

This commit is contained in:
tmj-fstate
2017-01-19 17:49:49 +01:00
parent 6ab550831d
commit 8fe465afef
8 changed files with 100 additions and 64 deletions

View File

@@ -1125,3 +1125,25 @@ public:
};
extern double Distance(TLocation Loc1, TLocation Loc2, TDimension Dim1, TDimension Dim2);
template <typename _Type>
bool getkeyval( _Type &Variable, std::string const &Key, std::string const &Input ) {
auto lookup = Input.find( Key + "=" );
if( lookup == std::string::npos ) {
return false; }
std::string value = Input.substr( Input.find_first_not_of( ' ', lookup + Key.size() + 1 ) );
lookup = value.find( ' ' );
if( lookup != std::string::npos ) {
// trim everything past the value
value.erase( lookup );
}
if( true == value.empty() ) {
return false;
}
// set the specified variable to retrieved value
std::stringstream converter;
converter << value;
converter >> Variable;
return true; // all done
}

View File

@@ -6392,6 +6392,17 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
startBPT = false;
secParam = true;
SetFlag(OKFlag, param_ok);
getkeyval( aCategory, "Category", xline );
getkeyval( aType, "Type", xline ); aType = ToUpper( aType );
getkeyval( aMass, "M", xline );
getkeyval( aMred, "Mred", xline );
getkeyval( aVmax, "Vmax", xline );
getkeyval( aPWR, "PWR", xline );
getkeyval( aSandCap, "SandCap", xline );
getkeyval( aHeatingP, "HeatingP", xline );
getkeyval( aLightP, "LightP", xline );
// TODO: switch other sections to the new getkeyval() code
/*
aCategory = getkeyval(1, "Category");
aType = ToUpper(getkeyval(1, "Type"));
aMass = atof(getkeyval(3, "M").c_str());
@@ -6401,6 +6412,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
aSandCap = atoi(getkeyval(2, "SandCap").c_str());
aHeatingP = atof(getkeyval(3, "HeatingP").c_str());
aLightP = atof(getkeyval(3, "LightP").c_str());
*/
continue;
}
@@ -6774,11 +6786,11 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
ADist = dAd;
BDist = dBd;
if (WheelDiameterL == -1) // gdyby nie było parametru...
if (WheelDiameterL == 0.0) // gdyby nie było parametru...
WheelDiameterL = WheelDiameter; //... lepsze to niż zero
else
WheelDiameterL = dDl;
if (WheelDiameterT == -1) // gdyby nie było parametru...
if (WheelDiameterT == 0.0) // gdyby nie było parametru...
WheelDiameterT = WheelDiameter; //... lepsze to niż zero
else
WheelDiameterT = dDt;

View File

@@ -522,9 +522,11 @@ void TNESt3::SetSize(int size, std::string params) // ustawianie dysz (rozmiaru
else
Przekladniki[2] = std::make_shared<TRura>();
if ((params.find("3d") + params.find("4d")) != std::string::npos)
autom = false;
else
if( ( params.find( "3d" ) != std::string::npos )
|| ( params.find( "4d" ) != std::string::npos ) ) {
autom = false;
}
else
autom = true;
if ((params.find("HBG300") != std::string::npos))
HBG300 = 1;