diff --git a/application/application.cpp b/application/application.cpp index 140475b60..2a024bfd6 100644 --- a/application/application.cpp +++ b/application/application.cpp @@ -393,10 +393,14 @@ int eu07_application::init(int Argc, char *Argv[]) ErrorLog("Failed to initialize glfw!"); return result; } - if (needs_ogl() && (result = init_ogl()) != 0) + if (needs_ogl()) { - ErrorLog("Failed to initialize ogl!"); - return result; + result = init_ogl(); + if (result != 0) + { + ErrorLog("Failed to initialize ogl!"); + return result; + } } if (crashreport_is_pending() && false == Global.test.enabled) diff --git a/nodebank_previews_standalone.cpp b/nodebank_previews_standalone.cpp index d94eb13ed..65c5e07f3 100644 --- a/nodebank_previews_standalone.cpp +++ b/nodebank_previews_standalone.cpp @@ -76,19 +76,21 @@ bool parse_arguments(int const Argc, char *Argv[], preview_settings &Settings) } else if (token == "-resolution") { - if ((i + 1 >= Argc) || (false == parse_number(Argv[++i], Settings.resolution)) || (Settings.resolution < 16)) + if ((i + 1 >= Argc) || (false == parse_number(Argv[i + 1], Settings.resolution)) || (Settings.resolution < 16)) { report("-resolution needs a number of pixels, 16 or more", true); return false; } + ++i; } else if (token == "-margin") { - if ((i + 1 >= Argc) || (false == parse_number(Argv[++i], Settings.margin)) || (Settings.margin < 0)) + if ((i + 1 >= Argc) || (false == parse_number(Argv[i + 1], Settings.margin)) || (Settings.margin < 0)) { report("-margin needs a number of pixels, 0 or more", true); return false; } + ++i; } else if (token == "-no-shadows") { diff --git a/vehicle/Gauge.cpp b/vehicle/Gauge.cpp index 6289fe5a2..c99448eed 100644 --- a/vehicle/Gauge.cpp +++ b/vehicle/Gauge.cpp @@ -211,15 +211,15 @@ void TGauge::Load( cParser &Parser, TDynamicObject const *Owner, double const mu m_sourcemodel = nullptr; std::array sources { Owner->mdKabina, Owner->mdLowPolyInt }; for( auto const *source : sources ) { - if( source != nullptr - && ( submodel = source->GetFromName( submodelname ) ) != nullptr ) { - // got what we wanted, bail out - m_sourcemodel = source; - break; + if( source == nullptr ) { + continue; } - // there's a possibility the default submodel was named with _off suffix - if( source != nullptr - && ( submodel = source->GetFromName( submodelname + "_off" ) ) != nullptr ) { + submodel = source->GetFromName( submodelname ); + if( submodel == nullptr ) { + // there's a possibility the default submodel was named with _off suffix + submodel = source->GetFromName( submodelname + "_off" ); + } + if( submodel != nullptr ) { // got what we wanted, bail out m_sourcemodel = source; break; @@ -231,8 +231,11 @@ void TGauge::Load( cParser &Parser, TDynamicObject const *Owner, double const mu // see if we can locate optional submodel for active state, with _on suffix TSubModel *submodelon { nullptr }; for( auto const *source : sources ) { - if( source != nullptr - && ( submodelon = source->GetFromName( submodelname + "_on" ) ) != nullptr ) { + if( source == nullptr ) { + continue; + } + submodelon = source->GetFromName( submodelname + "_on" ); + if( submodelon != nullptr ) { // got what we wanted, bail out break; }