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

build 191117. binary terrain subsystem state switch, minor bug fixes

This commit is contained in:
tmj-fstate
2019-11-18 04:18:44 +01:00
parent 14ab3fd3d7
commit e3dbaf9096
10 changed files with 23 additions and 9 deletions

View File

@@ -5557,19 +5557,20 @@ TController::UpdateSituation(double dt) {
VelDesired, VelDesired,
VelforDriver ); VelforDriver );
} }
// recalculate potential load exchange duration
ExchangeTime = 0.f;
if( fStopTime < 0 ) { if( fStopTime < 0 ) {
// czas postoju przed dalszą jazdą (np. na przystanku) // czas postoju przed dalszą jazdą (np. na przystanku)
VelDesired = 0.0; // jak ma czekać, to nie ma jazdy VelDesired = 0.0; // jak ma czekać, to nie ma jazdy
// verify progress of load exchange // verify progress of load exchange
auto exchangetime { 0.f };
auto *vehicle { pVehicles[ 0 ] }; auto *vehicle { pVehicles[ 0 ] };
while( vehicle != nullptr ) { while( vehicle != nullptr ) {
exchangetime = std::max( exchangetime, vehicle->LoadExchangeTime() ); ExchangeTime = std::max( ExchangeTime, vehicle->LoadExchangeTime() );
vehicle = vehicle->Next(); vehicle = vehicle->Next();
} }
if( ( exchangetime > 0 ) if( ( ExchangeTime > 0 )
|| ( mvOccupied->Vel > 2.0 ) ) { // HACK: force timer reset if the load exchange is cancelled due to departure || ( mvOccupied->Vel > 2.0 ) ) { // HACK: force timer reset if the load exchange is cancelled due to departure
WaitingSet( exchangetime ); WaitingSet( ExchangeTime );
} }
} }

View File

@@ -311,6 +311,7 @@ private:
double WaitingExpireTime = 31.0; // tyle ma czekać, zanim się ruszy // maksymlany czas oczekiwania do samoistnego ruszenia double WaitingExpireTime = 31.0; // tyle ma czekać, zanim się ruszy // maksymlany czas oczekiwania do samoistnego ruszenia
double IdleTime {}; // keeps track of time spent at a stop double IdleTime {}; // keeps track of time spent at a stop
double fStopTime = 0.0; // czas postoju przed dalszą jazdą (np. na przystanku) double fStopTime = 0.0; // czas postoju przed dalszą jazdą (np. na przystanku)
float ExchangeTime{ 0.0 }; // time needed to finish current load exchange
double fShuntVelocity = 40.0; // maksymalna prędkość manewrowania, zależy m.in. od składu // domyślna prędkość manewrowa double fShuntVelocity = 40.0; // maksymalna prędkość manewrowania, zależy m.in. od składu // domyślna prędkość manewrowa
int iDrivigFlags = // flagi bitowe ruchu int iDrivigFlags = // flagi bitowe ruchu
moveStopPoint | // podjedź do W4 możliwie blisko moveStopPoint | // podjedź do W4 możliwie blisko

View File

@@ -467,6 +467,11 @@ global_settings::ConfigParse(cParser &Parser) {
iConvertModels - 128 : iConvertModels - 128 :
0 ); 0 );
} }
else if( token == "file.binary.terrain" ) {
// binary terrain (de)serialization
Parser.getTokens( 1, false );
Parser >> file_binary_terrain;
}
else if (token == "inactivepause") else if (token == "inactivepause")
{ {
// automatyczna pauza, gdy okno nieaktywne // automatyczna pauza, gdy okno nieaktywne

View File

@@ -64,6 +64,7 @@ struct global_settings {
std::string SceneryFile{ "td.scn" }; std::string SceneryFile{ "td.scn" };
std::string asHumanCtrlVehicle{ "EU07-424" }; std::string asHumanCtrlVehicle{ "EU07-424" };
int iConvertModels{ 0 }; // tworzenie plików binarnych int iConvertModels{ 0 }; // tworzenie plików binarnych
bool file_binary_terrain{ true }; // enable binary terrain (de)serialization
// logs // logs
int iWriteLogEnabled{ 3 }; // maska bitowa: 1-zapis do pliku, 2-okienko, 4-nazwy torów int iWriteLogEnabled{ 3 }; // maska bitowa: 1-zapis do pliku, 2-okienko, 4-nazwy torów
bool MultipleLogs{ false }; bool MultipleLogs{ false };

View File

@@ -4713,6 +4713,7 @@ void TTrain::OnCommand_doortoggleleft( TTrain *Train, command_data const &Comman
void TTrain::OnCommand_doorpermitleft( TTrain *Train, command_data const &Command ) { void TTrain::OnCommand_doorpermitleft( TTrain *Train, command_data const &Command ) {
if( Command.action == GLFW_REPEAT ) { return; } if( Command.action == GLFW_REPEAT ) { return; }
if( false == Train->mvOccupied->Doors.permit_presets.empty() ) { return; }
if( Command.action == GLFW_PRESS ) { if( Command.action == GLFW_PRESS ) {
@@ -4749,6 +4750,7 @@ void TTrain::OnCommand_doorpermitleft( TTrain *Train, command_data const &Comman
void TTrain::OnCommand_doorpermitright( TTrain *Train, command_data const &Command ) { void TTrain::OnCommand_doorpermitright( TTrain *Train, command_data const &Command ) {
if( Command.action == GLFW_REPEAT ) { return; } if( Command.action == GLFW_REPEAT ) { return; }
if( false == Train->mvOccupied->Doors.permit_presets.empty() ) { return; }
if( Command.action == GLFW_PRESS ) { if( Command.action == GLFW_PRESS ) {

View File

@@ -119,7 +119,7 @@ drivingaid_panel::update() {
{ // alerter, hints { // alerter, hints
std::string expandedtext; std::string expandedtext;
if( is_expanded ) { if( is_expanded ) {
auto const stoptime { static_cast<int>( std::ceil( -1.0 * owner->fStopTime ) ) }; auto const stoptime { static_cast<int>( owner->ExchangeTime ) };
if( stoptime > 0 ) { if( stoptime > 0 ) {
std::snprintf( std::snprintf(
m_buffer.data(), m_buffer.size(), m_buffer.data(), m_buffer.size(),

View File

@@ -3147,7 +3147,8 @@ void opengl33_renderer::Render_Alpha(TAnimModel *Instance)
return; return;
} }
Instance->RaPrepare(); Instance->RaAnimate( m_framestamp ); // jednorazowe przeliczenie animacji
Instance->RaPrepare();
if (Instance->pModel) if (Instance->pModel)
{ {
// renderowanie rekurencyjne submodeli // renderowanie rekurencyjne submodeli

View File

@@ -3194,6 +3194,7 @@ opengl_renderer::Render_Alpha( TAnimModel *Instance ) {
return; return;
} }
Instance->RaAnimate( m_framestamp ); // jednorazowe przeliczenie animacji
Instance->RaPrepare(); Instance->RaPrepare();
if( Instance->pModel ) { if( Instance->pModel ) {
// renderowanie rekurencyjne submodeli // renderowanie rekurencyjne submodeli

View File

@@ -42,7 +42,8 @@ state_serializer::deserialize( std::string const &Scenariofile ) {
// if this fails, fall back on the legacy text format // if this fails, fall back on the legacy text format
scene::scratch_data importscratchpad; scene::scratch_data importscratchpad;
importscratchpad.name = Scenariofile; importscratchpad.name = Scenariofile;
if( Scenariofile != "$.scn" ) { if( ( true == Global.file_binary_terrain )
&& ( Scenariofile != "$.scn" ) ) {
// compilation to binary file isn't supported for rainsted-created overrides // compilation to binary file isn't supported for rainsted-created overrides
// NOTE: we postpone actual loading of the scene until we process time, season and weather data // NOTE: we postpone actual loading of the scene until we process time, season and weather data
importscratchpad.binary.terrain = Region->is_scene( Scenariofile ) ; importscratchpad.binary.terrain = Region->is_scene( Scenariofile ) ;
@@ -53,7 +54,8 @@ state_serializer::deserialize( std::string const &Scenariofile ) {
if( false == scenarioparser.ok() ) { return false; } if( false == scenarioparser.ok() ) { return false; }
deserialize( scenarioparser, importscratchpad ); deserialize( scenarioparser, importscratchpad );
if( ( false == importscratchpad.binary.terrain ) if( ( true == Global.file_binary_terrain )
&& ( false == importscratchpad.binary.terrain )
&& ( Scenariofile != "$.scn" ) ) { && ( Scenariofile != "$.scn" ) ) {
// if we didn't find usable binary version of the scenario files, create them now for future use // 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 // as long as the scenario file wasn't rainsted-created base file override

View File

@@ -1,5 +1,5 @@
#pragma once #pragma once
#define VERSION_MAJOR 19 #define VERSION_MAJOR 19
#define VERSION_MINOR 1115 #define VERSION_MINOR 1117
#define VERSION_REVISION 0 #define VERSION_REVISION 0