18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-29 09:24:03 +01:00

refactor: no side effects in the right operand of && and || (Sonar S912) (#364)

The ogl initialisation, the -resolution/-margin values of the standalone
previews and the submodel lookups of TGauge::Load assign or increment in
the right operand of && or ||. Each becomes plain statements which run
exactly when the operand ran before: init_ogl() only when needs_ogl(),
i advanced only when a value follows (and accepted), and the lookups by
name and then by name + "_off" per model, in the same order, leaving
submodel, submodelon and m_sourcemodel with the same values.
This commit is contained in:
jerrrrycho
2026-11-20 03:42:49 +01:00
committed by GitHub
parent 357ccabd0c
commit c2b034ddcd
3 changed files with 24 additions and 15 deletions

View File

@@ -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)