MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / reset

Function reset

src/openrct2/world/Weather.cpp:108–137  ·  view source on GitHub ↗

* Set climate and determine start weather. */

Source from the content-addressed store, hash-verified

106 * Set climate and determine start weather.
107 */
108 void reset()
109 {
110 auto& objManager = GetContext()->GetObjectManager();
111 auto* climateObj = objManager.GetLoadedObject<ClimateObject>(0);
112 if (climateObj == nullptr)
113 return;
114
115 int32_t month = GetDate().GetMonth();
116 const Weather::Pattern& pattern = climateObj->getPatternForMonth(month);
117
118 auto weather = Weather::Type::PartiallyCloudy;
119 const Weather::Trait& trait = kWeatherTraits[EnumValue(weather)];
120
121 auto& gameState = getGameState();
122 gameState.weatherCurrent.weatherType = weather;
123 gameState.weatherCurrent.temperature = pattern.baseTemperature + trait.temperatureDelta;
124 gameState.weatherCurrent.weatherEffect = trait.effectLevel;
125 gameState.weatherCurrent.weatherGloom = trait.gloomLevel;
126 gameState.weatherCurrent.level = trait.level;
127
128 _lightningTimer = 0;
129 _thunderTimer = 0;
130 if (_weatherVolume != 1)
131 {
132 stopWeatherSound();
133 _weatherVolume = 1;
134 }
135
136 determineFutureWeather(ScenarioRand());
137 }
138
139 /**
140 * Weather & climate update iteration.

Callers 2

ClearMapForEditingFunction · 0.85
gameStateInitAllFunction · 0.85

Calls 6

GetContextFunction · 0.85
EnumValueFunction · 0.85
stopWeatherSoundFunction · 0.85
determineFutureWeatherFunction · 0.85
ScenarioRandFunction · 0.85
GetMonthMethod · 0.80

Tested by

no test coverage detected