AGS: Fix undefined behavior in initialization of AGSSnowRain

Due to the declaration order of the member variables, the _screenWidth
and _screenHeight where used before being initialized to initialize
the _snow and _rain variables. This could then lead to a division by
zero.

This fixes bug #12771: AGS King's Quest 3 VGA from IA crashes on startup
This commit is contained in:
Thierry Crozat
2021-08-05 12:55:04 +01:00
parent 2be3f87a49
commit 5fa3232bcf
@@ -37,11 +37,11 @@ namespace AGSSnowRain {
class AGSSnowRain : public PluginBase {
SCRIPT_HASH(AGSSnowRain)
private:
Weather _rain;
Weather _snow;
int32 _screenWidth = 320;
int32 _screenHeight = 200;
int32 _screenColorDepth = 32;
Weather _rain;
Weather _snow;
private:
void srSetWindSpeed(ScriptMethodParams &params);