diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b1bf52..0171e16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Added `l10n_uk.xml` by Gonimy-Vetrom - Fixed temperature misalignment for widesceen resolutions for [#3](https://github.com/Peppie84/FS25_ExtendedGameInfoDisplay/issues/3) - Added `l10n_tr.xml` by [RuyaSavascisi](https://github.com/RuyaSavascisi) +- Fixed next weather icon glitch for [#11](https://github.com/Peppie84/FS25_ExtendedGameInfoDisplay/issues/11) ## [v1.0.0.0] - 2025-01-09 - Ported from LS22 to LS25 diff --git a/FS25_ExtendedGameInfoDisplay/src/extendedgameinfodisplay.lua b/FS25_ExtendedGameInfoDisplay/src/extendedgameinfodisplay.lua index 8b7ec97..31fe628 100644 --- a/FS25_ExtendedGameInfoDisplay/src/extendedgameinfodisplay.lua +++ b/FS25_ExtendedGameInfoDisplay/src/extendedgameinfodisplay.lua @@ -50,14 +50,11 @@ function ExtendedGameInfoDisplay:gameinfodisplay__draw(overwrittenFunc) overwrittenFunc(self) local weatherType = g_currentMission.environment.weather:getCurrentWeatherType() - local forcastDayTime = math.floor(g_currentMission.environment.dayTime + ExtendedGameInfoDisplay.WEATHER_HOURS_FORECAST ) - local forcastDay = g_currentMission.environment.currentDay - if forcastDayTime > ExtendedGameInfoDisplay.HOURS_A_DAY then - forcastDayTime = forcastDayTime - ExtendedGameInfoDisplay.HOURS_A_DAY - forcastDay = forcastDay + 1 - end + local forcastDayTime = g_currentMission.environment.dayTime + ExtendedGameInfoDisplay.WEATHER_HOURS_FORECAST + local forcastDay = g_currentMission.environment.currentMonotonicDay + forcastDayTime, forcastDay = g_currentMission.environment:getDayAndDayTime(forcastDayTime, forcastDay) + local nextWeatherType = g_currentMission.environment.weather:getNextWeatherType(forcastDay, forcastDayTime) - local nextWeatherType = g_currentMission.environment.weather:getNextWeatherType(forcastDay, forcastDayTime ) -- Strech the background and render new! self.infoBgScale.width = self:scalePixelToScreenWidth(ExtendedGameInfoDisplay.STRECH_GAME_INFO_DISPLAY) @@ -65,9 +62,10 @@ function ExtendedGameInfoDisplay:gameinfodisplay__draw(overwrittenFunc) self.infoBgScale:render() -- ReRender to bring it back to top + if weatherType ~= nextWeatherType then + self.weatherNextIcon:render() + end self.weatherIcon:render() - self.weatherNextIcon:render() - self.weatherNextIcon:setVisible(weatherType ~= nextWeatherType) ExtendedGameInfoDisplay:setTemperaturePosition(self) ExtendedGameInfoDisplay:setTemperatureTrendAndDraw(self) @@ -139,7 +137,6 @@ end --- Initialize the mod local function init() - --HUD.new = Utils.prependedFunction(HUD.new, newHud) HUD.createDisplayComponents = Utils.overwrittenFunction(HUD.createDisplayComponents, ExtendedGameInfoDisplay.hud__createDisplayComponents) GameInfoDisplay.draw = Utils.overwrittenFunction(GameInfoDisplay.draw, ExtendedGameInfoDisplay.gameinfodisplay__draw) end