Skip to content

Commit

Permalink
Merge pull request #13 from Peppie84/#11__fix-next-weather-icon-glitch
Browse files Browse the repository at this point in the history
#11 Fixes next weather icon glitch
  • Loading branch information
Peppie84 authored Jan 23, 2025
2 parents bb7c973 + cad9995 commit 39d23b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 7 additions & 10 deletions FS25_ExtendedGameInfoDisplay/src/extendedgameinfodisplay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,22 @@ 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)
self.infoBgScale.offsetX = -self:scalePixelToScreenWidth(ExtendedGameInfoDisplay.STRECH_GAME_INFO_DISPLAY)
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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 39d23b6

Please sign in to comment.