From 044e3c921a9e7dfaa3275524329712632e103059 Mon Sep 17 00:00:00 2001 From: tmj-fstate Date: Tue, 2 Oct 2018 22:38:01 +0200 Subject: [PATCH] ai order list size increase, random overcast value, minor bug fixes --- Driver.h | 2 +- PyInt.cpp | 12 ++++++------ simulationstateserializer.cpp | 10 +++++++++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Driver.h b/Driver.h index b86f7fd4..dce4b815 100644 --- a/Driver.h +++ b/Driver.h @@ -167,7 +167,7 @@ static const bool Aggressive = true; static const bool Easyman = false; static const bool AIdriver = true; static const bool Humandriver = false; -static const int maxorders = 32; // ilość rozkazów w tabelce +static const int maxorders = 64; // ilość rozkazów w tabelce static const int maxdriverfails = 4; // ile błędów może zrobić AI zanim zmieni nastawienie extern bool WriteLogFlag; // logowanie parametrów fizycznych static const int BrakeAccTableSize = 20; diff --git a/PyInt.cpp b/PyInt.cpp index ff4ddeb3..95d44486 100644 --- a/PyInt.cpp +++ b/PyInt.cpp @@ -187,14 +187,14 @@ auto python_taskqueue::fetch_renderer( std::string const Renderer ) ->PyObject * auto const path { substr_path( Renderer ) }; auto const file { Renderer.substr( path.size() ) }; PyObject *renderer { nullptr }; - if( m_main == nullptr ) { - ErrorLog( "Python Renderer: __main__ module is missing" ); - goto cache_and_return; - } - + PyObject *rendererarguments { nullptr }; PyEval_AcquireLock(); { - PyObject *rendererarguments{ nullptr }; + if( m_main == nullptr ) { + ErrorLog( "Python Renderer: __main__ module is missing" ); + goto cache_and_return; + } + if( false == run_file( file, path ) ) { goto cache_and_return; } diff --git a/simulationstateserializer.cpp b/simulationstateserializer.cpp index ba327225..0671ba44 100644 --- a/simulationstateserializer.cpp +++ b/simulationstateserializer.cpp @@ -162,7 +162,15 @@ state_serializer::deserialize_atmo( cParser &Input, scene::scratch_data &Scratch std::string token { Input.getToken() }; if( token != "endatmo" ) { // optional overcast parameter - Global.Overcast = clamp( std::stof( token ), 0.f, 2.f ); + Global.Overcast = std::stof( token ); + if( Global.Overcast < 0.f ) { + // negative overcast means random value in range 0-abs(specified range) + Global.Overcast = + Random( + clamp( + std::abs( Global.Overcast ), + 0.f, 2.f ) ); + } // overcast drives weather so do a calculation here // NOTE: ugly, clean it up when we're done with world refactoring simulation::Environment.compute_weather();