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

Merge branch 'tmj-dev' into lua

This commit is contained in:
milek7
2017-10-31 14:01:53 +01:00
26 changed files with 745 additions and 249 deletions

View File

@@ -143,10 +143,10 @@ TGauge::Load_mapping( cParser &Input ) {
sound_man->create_sound(value) :
nullptr );
}
else if( key.find( "sound" ) == 0 ) {
else if( key.compare( 0, std::min<std::size_t>( key.size(), 5 ), "sound" ) == 0 ) {
// sounds assigned to specific gauge values, defined by key soundFoo: where Foo = value
auto const indexstart = key.find_first_of( "-1234567890" );
auto const indexend = key.find_first_not_of( "-1234567890", indexstart );
auto const indexstart { key.find_first_of( "-1234567890" ) };
auto const indexend { key.find_first_not_of( "-1234567890", indexstart ) };
if( indexstart != std::string::npos ) {
m_soundfxvalues.emplace(
std::stoi( key.substr( indexstart, indexend - indexstart ) ),