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

build 171030: binary serialization for region terrain

This commit is contained in:
tmj-fstate
2017-10-30 23:41:22 +01:00
parent 9edf912405
commit 071a156527
12 changed files with 531 additions and 44 deletions

View File

@@ -137,10 +137,10 @@ TGauge::Load_mapping( cParser &Input ) {
TSoundsManager::GetFromName( value, true ) :
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 ) ),