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

fixes for .fiz file parsing and diesel engine momentum calculation

This commit is contained in:
tmj-fstate
2017-12-14 22:05:18 +01:00
parent 4e6e428cea
commit b70c265a1e
2 changed files with 22 additions and 23 deletions

View File

@@ -116,11 +116,12 @@ void win1250_to_ascii( std::string &Input );
inline
std::string
extract_value( std::string const &Key, std::string const &Input ) {
// NOTE, HACK: the leading space allows to uniformly look for " variable=" substring
std::string const input { " " + Input };
std::string value;
auto lookup = Input.find( Key + "=" );
auto lookup = input.find( " " + Key + "=" );
if( lookup != std::string::npos ) {
value = Input.substr( Input.find_first_not_of( ' ', lookup + Key.size() + 1 ) );
value = input.substr( input.find_first_not_of( ' ', lookup + Key.size() + 2 ) );
lookup = value.find( ' ' );
if( lookup != std::string::npos ) {
// trim everything past the value