16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 16:19: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
}