Wrong Environment File selected
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Open Rails |
Fix Released
|
Medium
|
Carlo Santucci |
Bug Description
This may be related to bug 1292913.
Whilst trying to alter some water levels in a Summer/Rain environment I became aware that nothing I changed made any difference at all. After a lot of futile attempts to find what I was doing wrong, I tried removing all the environment files except the SummerRain file I thought I was working on. OR then crashed because it wanted the SummerSnow file. I then re-instated the SummerSnow file and removed the SummerRain file and OR started up without error. I could then alter parameters in the SummerSnow file and could immediately see the results in OR. After a bit more testing, I found that if an activity/explore asked for a Rain file, OR loaded the Snow and vice versa. I tracked this to the weather type being referenced by the following activity file codes:
public enum WeatherType { Clear = 0, Snow, Rain }
Thus Snow = 1 and Rain = 2
The environment file was being picked by simple indexing in method ENVFileName in RouteFile.cs. This method requires that the files are in the order Clear, Snow, Rain as per the WeatherType definition. In my .trk file, however, all the environment files are in the order Clear, Rain, Snow as follows:
Environment (
SpringClear ( SpringClear.env )
SpringRain ( SpringRain.env )
SpringSnow ( SpringSnow.env )
SummerClear ( SummerClear.env )
SummerRain ( SummerRain.env )
SummerSnow ( SummerSnow.env )
AutumnClear ( AutumnClear.env )
AutumnRain ( AutumnRain.env )
AutumnSnow ( AutumnSnow.env )
WinterClear ( WinterClear.env )
WinterRain ( WinterRain.env )
WinterSnow ( WinterSnow.env )
)
In fact, every route I have has the files in the above order including the default routes.
It is not obvious that the wrong file is being picked because the environment files only seem to directly affect water and sky, not terrain and shapes.
I attach a patch that selects the correct environment file no matter what order they are specified in the .trk file.
Changed in or: | |
importance: | Undecided → Medium |
milestone: | none → 1.3 |
Changed in or: | |
status: | Fix Committed → Fix Released |
Dennis, thanks for the patch. I have committed it in x.4156 after having commented out the trace lines, that I don't consider important once the bug has been discovered and solved.