HomeWildfire Games

Remove default CGame constructor values to make the code less error-prone, use…

Description

Remove default CGame constructor values to make the code less error-prone, use CRenderer::IsInitialised() to test if the CGame should be rendered to remove indirection/proxies, making the code easier to read.

rP7653 introduced a disableGraphics bool with a default value and relied on the default being reasonable except for the few needed cases.
rP16727 introduced the replayLog argument with a default value and relied on the default being reasonable except for the few needed cases.
rP17689 fixed a bug in that commit because the default value hadn't actually been considered to be correct for all CGame constructor calls and was wrong for two.

By requiring callers to specify the value, authors are forced to establish thought which value is the correct one, as opposed to hoping that a default value will be good by default.
As you can see in the diff, it also makes it easier to compare what values changed if they are always defined in the caller.

Use CRenderer::IsInitialised() to determine if this is a non-visual CGame,
for the purpose of removing less transparent proxy functions that are unneeded as long as there are about 30 other calls testing for CRenderer::IsInitialised() to determine if the Game should be rendered.

Supersedes:

  • CGame constructor argument bool disableGraphics from rP7653.
  • CGame::IsGraphicsDisabled() proxy from rP19645 to the proxy from rP7653 and two local nonVisual = args.Has("autostart-nonvisual") variables in GameSetup.cpp from rP19645.

Call the Renderer destructor instead of calling delete on the non-pointer (SAFE_DELETE would not be supported for instance).

Started as a preparation for D2197, but actually independent.

Differential Revision: https://code.wildfiregames.com/D2211