void WeatherInfo::Update() { // There will be a 66% the weather density decreases. If Sunny, use as currentDensity as countdown if (m_currentEffect == 0 || RandomUInt(100) < 66) { m_currentDensity -= WEATHER_DENSITY_UPDATE; if (m_currentDensity < 0.30f) //0.20 is considered fog, lower values are annoying { m_currentDensity = 0.0f; m_currentEffect = 0; sEventMgr.RemoveEvents(this, EVENT_WEATHER_UPDATE); _GenerateWeather(); return; } } else { m_currentDensity += WEATHER_DENSITY_UPDATE; if (m_currentDensity >= m_maxDensity) { m_currentDensity = m_maxDensity; return; } } SendUpdate(); // LOG_DEBUG("Weather Updated,zoneId:%d type:%d density:%f", m_zoneId, m_currentEffect, m_currentDensity); }
void WeatherInfo::Update() { if (m_increase) { m_currentDensity += WEATHER_DENSITY_UPDATE; if (m_currentDensity >= m_maxDensity) { m_currentDensity = m_maxDensity; m_increase = false; } } else { m_currentDensity -= WEATHER_DENSITY_UPDATE; if (m_currentDensity <= 0) { m_currentDensity = 0; sEventMgr.RemoveEvents(this, EVENT_WEATHER_UPDATE); _GenerateWeather(); return; } } SendUpdate(); }