Permalink
Browse files

Fix: [Weather/News] Avoid "sun wins against clouds" texts during nigh…

…t-dawn-phases. Report: Gast2
  • Loading branch information...
GWRon committed Oct 24, 2017
1 parent 84ebf71 commit 07ec53691ff9e97108a6532bcc9591dea0be7658
Showing with 33 additions and 3 deletions.
  1. +21 −0 source/game.newsagency.bmx
  2. +11 −2 source/game.world.bmx
  3. +1 −1 source/main.bmx
View
@@ -351,6 +351,7 @@ Type TNewsAgencyNewsProvider_Weather extends TNewsAgencyNewsProvider
local isPartiallyCloudy:int = 0
local isNight:int = 0
local isDay:int = 0
local isNotDay:int = 0
local becameNight:int = False
local becameDay:int = False
local sunHours:int = 0
@@ -367,13 +368,33 @@ Type TNewsAgencyNewsProvider_Weather extends TNewsAgencyNewsProvider
'check for specific states
For weather = eachin upcomingWeather
rem
old variant - leading to "sun wins" news during dusk times
if GetWorldTime().IsNight(weather._time)
if isDay then becameNight = True
isNight = True
else
if isNight then becameDay = True
isDay = True
endif
endrem
if not GetWorldTime().IsDay(weather._time)
isNotDay = true
endif
if GetWorldTime().IsNight(weather._time)
if isDay then becameNight = True
isNight = True
isDay = False
'ignore DUSK/DAWN times! so check for IsDay() too
elseif GetWorldTime().IsDay(weather._time)
if isNotDay then becameDay = True
isDay = True
isNotDay = False
isNight = False
endif
tempMin = Min(tempMin, weather.GetTemperature())
tempMax = Max(tempMax, weather.GetTemperature())
View
@@ -500,7 +500,7 @@ Type TWorld
End Method
Method RenderDebug:Int(x:Float = 0, y:Float = 0, width:Int=200, height:Int=160)
Method RenderDebug:Int(x:Float = 0, y:Float = 0, width:Int=200, height:Int=180)
SetColor 0,0,0
SetAlpha GetAlpha()*0.5
DrawRect(x,y,width,height)
@@ -529,7 +529,7 @@ Type TWorld
dy :+ 12
DrawText("speed: "+Int(GetWorldTime().GetTimeFactor()), x + 10, y + dy)
dy :+ 12
rem
Local sunrise:Int = GetWorldTime().GetSunRise()
Local sunset:Int = GetWorldTime().GetSunSet()
Local sunRiseString:String = ""
@@ -545,8 +545,17 @@ Type TWorld
sunSetString:+":"
If (sunset Mod 3600)/60 < 10 Then sunSetString :+ "0"
sunSetString:+(sunset Mod 3600)/60
endrem
Local sunRiseString:String = GetWorldTime().GetFormattedDate(GetWorldTime().GetSunRise(), "h:i")
Local sunSetString:String = GetWorldTime().GetFormattedDate(GetWorldTime().GetsunSet(), "h:i")
DrawText("rise: "+sunRiseString+" set: "+sunSetString, x + 10, y+ dy)
dy :+ 12
Local dawnString:String = GetWorldTime().GetFormattedDate(GetWorldTime().GetDawnPhaseBegin(), "h:i")
Local duskString:String = GetWorldTime().GetFormattedDate(GetWorldTime().GetDuskPhaseBegin(), "h:i")
DrawText("dawn: "+dawnString+" dusk: "+duskString, x + 10, y+ dy)
End Method
End Type
View
@@ -1416,7 +1416,7 @@ endrem
Next
GetWorld().RenderDebug(660,0, 140, 160)
GetWorld().RenderDebug(660,0, 140, 180)
'GetPlayer().GetFigure().RenderDebug(new TVec2D.Init(660, 150))
End Function

0 comments on commit 07ec536

Please sign in to comment.