Skip to content

Commit 06d28e6

Browse files
author
Chris Jakeman
committed
Removes option to creates an activity evaluation. Now always created.
1 parent c21d628 commit 06d28e6

File tree

7 files changed

+82
-50
lines changed

7 files changed

+82
-50
lines changed

Source/Documentation/Manual/driving.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ within the cabview, see :ref:`here <cabs-odometer>`.
621621
.. _debriefeval:
622622

623623

624-
Debrief Evaluation
624+
Activity Evaluation
625625
------------------
626626

627627
``Description``
@@ -651,7 +651,7 @@ and here an example about the Options/Simulation tab:
651651
.. image:: images/dbfeval-options-simulation.png
652652

653653
Checkboxes shown as unchecked in the two above pictures may be checked or
654-
unchecked, but don't have effect on activity evaluation.
654+
unchecked, but don't have any effect on activity evaluation.
655655

656656
A tab named "Evaluation" is present on the F1 Help Information Monitor.
657657
Once the activity is running it displays dynamic information about the player
@@ -666,7 +666,7 @@ train performance up to that moment.
666666

667667
\newpage
668668

669-
Clicking **Actual status: (**\ |darr| **)**\ expanded real-time display appears.
669+
Clicking **Actual status: (**\ |darr| **)**\ shows an expanded real-time display.
670670

671671

672672
.. image:: images/dbfeval-evaluation-expanded.png
@@ -677,8 +677,6 @@ Clicking **Actual status: (**\ |darr| **)**\ expanded real-time display appears
677677

678678
Clicking **Actual status: (**\ |uarr| **)**\ collapses all items.
679679

680-
Once the activity has ended, the report file is created and a new window displays it.
681-
682680
.. image:: images/dbfeval-evaluation-ended.png
683681
:scale: 100%
684682
:align: center
@@ -688,6 +686,9 @@ Once the activity has ended, the report file is created and a new window display
688686

689687
\newpage
690688

689+
Once the activity has ended, as soon as the player views the Evaluation tab, a report file is
690+
created and shown in an editor window as follows.
691+
691692
This report is made up of several sections.
692693

693694
.. image:: images/dbfeval-report.png
@@ -696,13 +697,12 @@ This report is made up of several sections.
696697

697698
.. raw:: latex
698699

699-
\newpage
700+
The report file OpenRailsEvaluation.txt is saved alongside the log file OpenRailsLog.txt and
701+
the default location for this is the Windows Desktop.
700702

701-
Activity saves (F2) will save also the evaluation data.
703+
The Save Game (F2) command also copies any evaluation report alongside the save files so it can be
704+
kept and reviewed. This copy is deleted when the other files for that save are deleted.
702705

703-
.. image:: images/dbfeval-resume.png
704-
:scale: 100%
705-
:align: center
706706

707707
.. _driving-hud:
708708

Source/Documentation/Manual/start.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,14 @@ by that locomotive will appear.
122122
If you instead select a specific activity, you won't have to perform any
123123
further selections.
124124

125-
Debrief Evaluation
125+
Activity Evaluation
126126
''''''''''''''''''
127127

128-
During the activity session, data about the activity is stored and may be displayed in real time, and at
129-
the end of the activity a report file is generated.
130-
This provides a summary of the player's skills as a train driver.
131-
Debrief evaluation is described :ref:`here <debriefeval>`.
128+
During the activity session, data about performance is stored and may be viewed as the activity progresses.
129+
At the end of the activity a report file is generated which provides a summary of
130+
the player's skills as a train driver.
131+
132+
Activity evaluation is described :ref:`here <debriefeval>`.
132133

133134
If you have selected the related Experimental Option, at runtime you can
134135
switch :ref:`Autopilot mode <driving-autopilot>` on or off, which allows you

Source/Menu/ResumeForm.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ void LoadSaves()
254254
if (!save.IsMultiplayer ^ Multiplayer)
255255
saves.Add(save);
256256
// Save a warning to show later.
257-
warning += catalog.GetStringFmt("Warning: Save {0} found from a route with an unexpected name:\n{1}.\n\n", save.RealTime, save.RouteName);
257+
warning += catalog.GetStringFmt("Warning: Save {0} found from a route with an unexpected name:\n{1}.\n\n", save.File, save.RouteName);
258258
}
259259
}
260260
}
@@ -390,8 +390,11 @@ void buttonDelete_Click(object sender, EventArgs e)
390390
foreach (var fileName in new[]
391391
{ Path.GetFileName(save.File)
392392
, Path.ChangeExtension(Path.GetFileName(save.File), "png")
393-
, Path.ChangeExtension(Path.GetFileName(save.File), "dbfeval.txt")
394-
})
393+
, Path.ChangeExtension(Path.GetFileName(save.File), "replay")
394+
, Path.ChangeExtension(Path.GetFileName(save.File), "txt")
395+
, Path.ChangeExtension(Path.GetFileName(save.File), "evaluation.txt")
396+
}
397+
)
395398
{
396399
try
397400
{
@@ -437,11 +440,12 @@ void buttonDeleteInvalid_Click(object sender, EventArgs e)
437440
var save = new Save(saveFile, Settings.YoungestVersionFailedToRestore);
438441
if (save.Valid == false)
439442
{
440-
foreach (var fileName in new[] {
441-
save.File,
442-
Path.ChangeExtension(save.File, "png"),
443-
Path.ChangeExtension(save.File, "txt"),
444-
Path.ChangeExtension(save.File, "replay")
443+
foreach (var fileName in new[]
444+
{ save.File
445+
, Path.ChangeExtension(Path.GetFileName(save.File), "png")
446+
, Path.ChangeExtension(Path.GetFileName(save.File), "replay")
447+
, Path.ChangeExtension(Path.GetFileName(save.File), "txt")
448+
, Path.ChangeExtension(Path.GetFileName(save.File), "evaluation.txt")
445449
}
446450
)
447451
{

Source/ORTS.Settings/UserSettings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,8 @@ public enum DirectXFeature
338338
public int CarVibratingLevel { get; set; }
339339
[Default("OpenRailsLog.txt")]
340340
public string LoggingFilename { get; set; }
341-
[Default("OR-DebriefEval.txt")]
342-
public string DebriefEvalFilename { get; set; }//
341+
[Default("OpenRailsEvaluation.txt")]
342+
public string EvaluationFilename { get; set; }//
343343
[Default("")] // If left as "", OR will use the user's desktop folder
344344
public string LoggingPath { get; set; }
345345
[Default("")]

Source/RunActivity/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ static class Program
4343
public static DispatchViewer DebugViewer;
4444
public static SoundDebugForm SoundDebugForm;
4545
public static ORTraceListener ORTraceListener;
46-
public static string logFileName = "";
46+
public static string logFileName = ""; // contains path to file
47+
public static string EvaluationFilename = ""; // contains path to file
4748

4849
/// <summary>
4950
/// The main entry point for the application.

Source/RunActivity/Viewer3D/Popups/HelpWindow.cs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ public class HelpWindow : Window
4949
Dictionary<int, string> DbfEvalActDepart = new Dictionary<int, string>();//Debrief eval
5050

5151
Dictionary<string, double> DbfEvalValues = new Dictionary<string, double>();//Debrief eval
52-
53-
public static string logFileName { get { return Program.logFileName; } set { Program.logFileName = value; } }
52+
5453
ControlLayout scrollbox;
5554
ControlLayoutHorizontal line;
5655

@@ -548,9 +547,10 @@ public HelpWindow(WindowManager owner)
548547
ShowEvaluation(locomotive, nmissedstation, dbfstationstopsremaining, playerTrain, colWidth, lcurvespeeddependent, lbreakcouplers, ndbfEvalTaskAccomplished);
549548
}
550549

551-
//if (dbfevaliscompleted | dbfevalisfinished | dbfevalissuccessful)
550+
if (dbfevaliscompleted | dbfevalisfinished | dbfevalissuccessful)
552551
{
553552
ReportEvaluation(owner, cl, locomotive, nmissedstation, labeltext, noverspeedcoupling, dbfstationstopsremaining, playerTrain, colWidth, indicator, lcurvespeeddependent, lbreakcouplers, ndbfEvalTaskAccomplished);
553+
System.Diagnostics.Process.Start("notepad.exe", Program.EvaluationFilename); //Show debrief eval file
554554
}
555555
}
556556
}));
@@ -597,13 +597,9 @@ private void ReportEvaluation(WindowManager owner, ControlLayout cl, TrainCar lo
597597
colWidth = (cl.RemainingWidth - cl.TextHeight) / 14;
598598

599599
var activityname = owner.Viewer.Simulator.Activity.Tr_Activity.Tr_Activity_Header.Name.ToString().Trim();
600-
logFileName = UserSettings.UserDataFolder + "\\" + GameStateRunActivity.FileStem + ".dbfeval.txt";
601-
602-
//Ensure we start with an empty file.
603-
if (File.Exists(logFileName) && !lDebriefEvalFile) File.Delete(logFileName);
604600

605601
//Create file.
606-
if (!lDebriefEvalFile) wDbfEval = new StreamWriter(File.Open(logFileName, FileMode.Create), System.Text.Encoding.UTF8);
602+
if (!lDebriefEvalFile) wDbfEval = new StreamWriter(File.Open(Program.EvaluationFilename, FileMode.Create), System.Text.Encoding.UTF8);
607603

608604
labeltext = "";
609605
//--------------------------------------------------------------------------------
@@ -614,8 +610,8 @@ private void ReportEvaluation(WindowManager owner, ControlLayout cl, TrainCar lo
614610
//--------------------------------------------------------------------------------
615611
consolewltext("Version = " + (VersionInfo.Version.Length > 0 ? VersionInfo.Version : "<none>"));
616612
consolewltext("Build = " + VersionInfo.Build);
617-
if (logFileName.Length > 0)
618-
consolewltext("Debrief file = " + logFileName);
613+
if (Program.EvaluationFilename.Length > 0)
614+
consolewltext("Debrief file = " + Program.EvaluationFilename);
619615

620616
consolewltext("Executable = " + Path.GetFileName(Application.ExecutablePath));
621617
LogSeparator(80);
@@ -627,7 +623,7 @@ private void ReportEvaluation(WindowManager owner, ControlLayout cl, TrainCar lo
627623
indicator.Color = Color.LightGreen;
628624
line = scrollbox.AddLayoutHorizontalLineOfText();
629625
//line.Add(indicator = new Label(colWidth, line.RemainingHeight, Viewer.Catalog.GetString(filename)));
630-
line.Add(indicator = new Label(colWidth, line.RemainingHeight, Viewer.Catalog.GetString(logFileName)));
626+
line.Add(indicator = new Label(colWidth, line.RemainingHeight, Viewer.Catalog.GetString(Program.EvaluationFilename)));
631627
indicator.Color = Color.LightGreen;
632628
line = scrollbox.AddLayoutHorizontalLineOfText();
633629
labeltext = "-------------";
@@ -996,12 +992,10 @@ private void ReportEvaluation(WindowManager owner, ControlLayout cl, TrainCar lo
996992
LogSeparator(80);
997993
writeline();
998994

999-
1000995
if (!lDebriefEvalFile)
1001996
{
1002997
lDebriefEvalFile = true;
1003-
wDbfEval.Close();//Close output file
1004-
System.Diagnostics.Process.Start("notepad.exe", logFileName);//Show debrief eval file
998+
wDbfEval.Close();
1005999
}
10061000
}
10071001

Source/RunActivity/Viewer3D/Processes/GameStateRunActivity.cs

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public class GameStateRunActivity : GameState
5555
static Viewer Viewer { get { return Program.Viewer; } set { Program.Viewer = value; } }
5656
static ORTraceListener ORTraceListener { get { return Program.ORTraceListener; } set { Program.ORTraceListener = value; } }
5757
static string logFileName { get { return Program.logFileName; } set { Program.logFileName = value; } }
58+
static string EvaluationFilename { get { return Program.EvaluationFilename; } set { Program.EvaluationFilename = value; } }
5859

5960
// Prefix with the activity filename so that, when resuming from the Menu.exe, we can quickly find those Saves
6061
// that are likely to match the previously chosen route and activity.
@@ -385,13 +386,6 @@ public static void Save()
385386
outf.Write(argument);
386387
outf.Write(Acttype);
387388

388-
// The Save command is the only command that doesn't take any action. It just serves as a marker.
389-
new SaveCommand(Simulator.Log, FileStem);
390-
Simulator.Log.SaveLog(Path.Combine(UserSettings.UserDataFolder, FileStem + ".replay"));
391-
392-
// Copy the logfile to the save folder
393-
CopyLog(Path.Combine(UserSettings.UserDataFolder, FileStem + ".txt"));
394-
395389
Simulator.Save(outf);
396390
Viewer.Save(outf, FileStem);
397391
// Save multiplayer parameters
@@ -403,6 +397,19 @@ public static void Save()
403397
// Write out position within file so we can check when restoring.
404398
outf.Write(outf.BaseStream.Position);
405399
}
400+
401+
// Having written .save file, write other files: .replay, .txt, .evaluation.txt
402+
403+
// The Save command is the only command that doesn't take any action. It just serves as a marker.
404+
new SaveCommand(Simulator.Log, FileStem);
405+
Simulator.Log.SaveLog(Path.Combine(UserSettings.UserDataFolder, FileStem + ".replay"));
406+
407+
// Copy the logfile to the save folder
408+
CopyLog(Path.Combine(UserSettings.UserDataFolder, FileStem + ".txt"));
409+
410+
// Copy the evaluation file to the save folder
411+
if (File.Exists(Program.EvaluationFilename))
412+
File.Copy(Program.EvaluationFilename, Path.Combine(UserSettings.UserDataFolder, FileStem + ".evaluation.txt"), true);
406413
}
407414

408415
private static void SaveEvaluation(BinaryWriter outf)
@@ -752,10 +759,8 @@ void InitLogging(UserSettings settings, string[] args, bool appendLog)
752759
{
753760
fileName = settings.LoggingFilename;
754761
}
755-
foreach (var ch in Path.GetInvalidFileNameChars())
756-
fileName = fileName.Replace(ch, '.');
762+
logFileName = GetFilePath(settings, fileName);
757763

758-
logFileName = Path.Combine(settings.LoggingPath, fileName);
759764
// Ensure we start with an empty file.
760765
if (!appendLog)
761766
File.Delete(logFileName);
@@ -793,6 +798,33 @@ void InitLogging(UserSettings settings, string[] args, bool appendLog)
793798
Console.WriteLine("Logging is disabled, only fatal errors will appear here.");
794799
LogSeparator();
795800
}
801+
InitEvaluation(settings);
802+
}
803+
804+
/// <summary>
805+
/// Sanitises the user's filename, adds logging path (Windows Desktop by default) and deletes any file already existing.
806+
/// </summary>
807+
/// <param name="settings"></param>
808+
void InitEvaluation(UserSettings settings)
809+
{
810+
EvaluationFilename = GetFilePath(settings, settings.EvaluationFilename);
811+
812+
// Ensure we start with an empty file.
813+
File.Delete(EvaluationFilename);
814+
}
815+
816+
/// <summary>
817+
/// Sanitise user's filename and combine with logging path
818+
/// </summary>
819+
/// <param name="settings"></param>
820+
/// <param name="fileName"></param>
821+
/// <returns></returns>
822+
private string GetFilePath(UserSettings settings, string fileName)
823+
{
824+
foreach (var ch in Path.GetInvalidFileNameChars())
825+
fileName = fileName.Replace(ch, '.');
826+
827+
return Path.Combine(settings.LoggingPath, fileName);
796828
}
797829

798830
#region Loading progress indication calculations

0 commit comments

Comments
 (0)