mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 20:29:17 +02:00
Merge branch 'tmj-dev'
This commit is contained in:
@@ -47,7 +47,7 @@ state_manager::deserialize( std::string const &Scenariofile ) {
|
||||
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 );
|
||||
cParser scenarioparser( Scenariofile, cParser::buffer_FILE, Global.asCurrentSceneryPath, Global.bLoadTraction );
|
||||
|
||||
if( false == scenarioparser.ok() ) { return false; }
|
||||
|
||||
@@ -59,7 +59,7 @@ state_manager::deserialize( std::string const &Scenariofile ) {
|
||||
Region->serialize( Scenariofile );
|
||||
}
|
||||
|
||||
Global::iPause &= ~0x10; // koniec pauzy wczytywania
|
||||
Global.iPause &= ~0x10; // koniec pauzy wczytywania
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -157,10 +157,10 @@ state_manager::deserialize_atmo( cParser &Input, scene::scratch_data &Scratchpad
|
||||
// fog range
|
||||
Input.getTokens( 2 );
|
||||
Input
|
||||
>> Global::fFogStart
|
||||
>> Global::fFogEnd;
|
||||
>> Global.fFogStart
|
||||
>> Global.fFogEnd;
|
||||
|
||||
if( Global::fFogEnd > 0.0 ) {
|
||||
if( Global.fFogEnd > 0.0 ) {
|
||||
// fog colour; optional legacy parameter, no longer used
|
||||
Input.getTokens( 3 );
|
||||
}
|
||||
@@ -168,7 +168,10 @@ state_manager::deserialize_atmo( cParser &Input, scene::scratch_data &Scratchpad
|
||||
std::string token { Input.getToken<std::string>() };
|
||||
if( token != "endatmo" ) {
|
||||
// optional overcast parameter
|
||||
Global::Overcast = clamp( std::stof( token ), 0.f, 2.f );
|
||||
Global.Overcast = clamp( std::stof( token ), 0.f, 2.f );
|
||||
// overcast drives weather so do a calculation here
|
||||
// NOTE: ugly, clean it up when we're done with world refactoring
|
||||
Global.pWorld->compute_weather();
|
||||
}
|
||||
while( ( false == token.empty() )
|
||||
&& ( token != "endatmo" ) ) {
|
||||
@@ -198,15 +201,15 @@ state_manager::deserialize_camera( cParser &Input, scene::scratch_data &Scratchp
|
||||
}
|
||||
} while( token.compare( "endcamera" ) != 0 );
|
||||
if( into < 0 )
|
||||
into = ++Global::iCameraLast;
|
||||
into = ++Global.iCameraLast;
|
||||
if( into < 10 ) { // przepisanie do odpowiedniego miejsca w tabelce
|
||||
Global::FreeCameraInit[ into ] = xyz;
|
||||
Global::FreeCameraInitAngle[ into ] =
|
||||
Global.FreeCameraInit[ into ] = xyz;
|
||||
Global.FreeCameraInitAngle[ into ] =
|
||||
Math3D::vector3(
|
||||
glm::radians( abc.x ),
|
||||
glm::radians( abc.y ),
|
||||
glm::radians( abc.z ) );
|
||||
Global::iCameraLast = into; // numer ostatniej
|
||||
Global.iCameraLast = into; // numer ostatniej
|
||||
}
|
||||
/*
|
||||
// cleaned up version of the above.
|
||||
@@ -235,7 +238,7 @@ void
|
||||
state_manager::deserialize_config( cParser &Input, scene::scratch_data &Scratchpad ) {
|
||||
|
||||
// config parameters (re)definition
|
||||
Global::ConfigParse( Input );
|
||||
Global.ConfigParse( Input );
|
||||
}
|
||||
|
||||
void
|
||||
@@ -269,7 +272,7 @@ void state_manager::deserialize_lua( cParser &Input, scene::scratch_data &Scratc
|
||||
Input.getTokens(1, false);
|
||||
std::string file;
|
||||
Input >> file;
|
||||
simulation::Lua.interpret(Global::asCurrentSceneryPath + file);
|
||||
simulation::Lua.interpret(Global.asCurrentSceneryPath + file);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -523,7 +526,7 @@ state_manager::deserialize_sky( cParser &Input, scene::scratch_data &Scratchpad
|
||||
// sky model
|
||||
Input.getTokens( 1 );
|
||||
Input
|
||||
>> Global::asSky;
|
||||
>> Global.asSky;
|
||||
// anything else left in the section has no defined meaning
|
||||
skip_until( Input, "endsky" );
|
||||
}
|
||||
@@ -639,7 +642,7 @@ state_manager::deserialize_path( cParser &Input, scene::scratch_data &Scratchpad
|
||||
TTraction *
|
||||
state_manager::deserialize_traction( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata ) {
|
||||
|
||||
if( false == Global::bLoadTraction ) {
|
||||
if( false == Global.bLoadTraction ) {
|
||||
skip_until( Input, "endtraction" );
|
||||
return nullptr;
|
||||
}
|
||||
@@ -657,7 +660,7 @@ state_manager::deserialize_traction( cParser &Input, scene::scratch_data &Scratc
|
||||
TTractionPowerSource *
|
||||
state_manager::deserialize_tractionpowersource( cParser &Input, scene::scratch_data &Scratchpad, scene::node_data const &Nodedata ) {
|
||||
|
||||
if( false == Global::bLoadTraction ) {
|
||||
if( false == Global.bLoadTraction ) {
|
||||
skip_until( Input, "end" );
|
||||
return nullptr;
|
||||
}
|
||||
@@ -827,6 +830,11 @@ state_manager::deserialize_dynamic( cParser &Input, scene::scratch_data &Scratch
|
||||
}
|
||||
}
|
||||
else {
|
||||
if( vehicle->MyTrack != nullptr ) {
|
||||
// rare failure case where vehicle with length of 0 is added to the track,
|
||||
// treated as error code and consequently deleted, but still remains on the track
|
||||
vehicle->MyTrack->RemoveDynamicObject( vehicle );
|
||||
}
|
||||
delete vehicle;
|
||||
skip_until( Input, "enddynamic" );
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user