Wrong Environment File selected

Bug #1777916 reported by Dennis A T
6
This bug affects 1 person
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.

Revision history for this message
Dennis A T (dennisat) wrote :
Revision history for this message
Carlo Santucci (carlosanit1) wrote :

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.

Changed in or:
assignee: nobody → Carlo Santucci (carlosanit1)
status: New → In Progress
status: In Progress → Fix Committed
James Ross (twpol)
Changed in or:
importance: Undecided → Medium
milestone: none → 1.3
James Ross (twpol)
Changed in or:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.