This is the only non-stylistic auto-fixable ESLint violation in gui/gamesetup.
From what I can tell, it is impossible for g_IsNetworked to change.
Because:
- This variable is only ever assigned to from two places: gui/gamesetup.js and gui/session.js. Both of them declare it towards the top of their file as global constant, which means even if gui/gamesetup's handleNetMessages() function where to somehow cause gui/session.js to execute mid-way, it would result in an run-time exception because the variable cannot be redeclared.
- This variable is declared as 'const' which means it cannot be re-assigned even from within gui/gamesetup.js code.
- Nowhere in the Cpp/ScriptInterface/JSContext code is this variable overridden, delete, proxied, or otherwise messed with.
It looks like this while-loop is effectively just using the condition as a clever proxy to decide between an early return statement or while (true). Convert it to that explicitly instead. The loop can only be broken by the break statement after the PollNetworkClient() check.
This code was introduced by rP19504 (D322). At the time g_IsNetworked was an implicitly global variable, populated by a an init function. This was phased out in rP21650, at which point the constant nature was codified, and the theoretical re-assignment by calling init() twice no longer possible.
(Edit: rP19504 changed the while (true) from rP7653 to while (g_IsNetworked).)