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

build 171031: reduced footprint for binary region terrain file

This commit is contained in:
tmj-fstate
2017-10-31 21:43:31 +01:00
parent 071a156527
commit ffbaacdb0e
6 changed files with 86 additions and 24 deletions

View File

@@ -39,15 +39,22 @@ state_manager::deserialize( std::string const &Scenariofile ) {
// TODO: check first for presence of serialized binary files
// if this fails, fall back on the legacy text format
scene::scratch_data importscratchpad;
importscratchpad.binary.terrain = Region->deserialize( Scenariofile );
if( Scenariofile != "$.scn" ) {
// compilation to binary file isn't supported for rainsted-created overrides
importscratchpad.binary.terrain = Region->deserialize( Scenariofile );
}
// NOTE: for the time being import from text format is a given, since we don't have full binary serialization
cParser scenarioparser( Scenariofile, cParser::buffer_FILE, Global::asCurrentSceneryPath, Global::bLoadTraction );
if( false == scenarioparser.ok() ) { return false; }
deserialize( scenarioparser, importscratchpad );
// if we didn't find usable binary version of the scenario files, create them now for future use
if( false == importscratchpad.binary.terrain ) { Region->serialize( Scenariofile ); }
if( ( false == importscratchpad.binary.terrain )
&& ( Scenariofile != "$.scn" ) ) {
// if we didn't find usable binary version of the scenario files, create them now for future use
// as long as the scenario file wasn't rainsted-created base file override
Region->serialize( Scenariofile );
}
Global::iPause &= ~0x10; // koniec pauzy wczytywania
return true;