Skip to content

Commit 0daa2d4

Browse files
committed
Merge branch 'master' into feature/one-true-wind
2 parents dc03850 + 1c55709 commit 0daa2d4

File tree

432 files changed

+32409
-23812
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

432 files changed

+32409
-23812
lines changed

.github/release.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
changelog:
2+
exclude:
3+
labels:
4+
- ignore-for-release
5+
authors:
6+
- appveyor
7+
- dependabot
8+
- github-actions
9+
categories:
10+
- title: New Features
11+
labels:
12+
- enhancement
13+
- title: Documentation and Localization
14+
labels:
15+
- documentation
16+
- locales
17+
- title: Bug Fixes
18+
labels:
19+
- bug
20+
- title: Other Changes
21+
labels:
22+
- "*"

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,4 +365,5 @@ ASALocalRun/
365365
healthchecksdb
366366

367367
# Backup folder for Package Reference Convert tool in Visual Studio 2017
368-
MigrationBackup/
368+
MigrationBackup/
369+
/Source/RunActivity/Properties/launchSettings.json

.readthedocs.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Read the Docs configuration file for Sphinx projects
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
version: 2
5+
6+
build:
7+
os: ubuntu-22.04
8+
tools:
9+
python: "3.12"
10+
11+
python:
12+
install:
13+
- requirements: Source/Documentation/Manual/requirements.txt
14+
15+
sphinx:
16+
configuration: Source/Documentation/Manual/conf.py
17+
18+
formats:
19+
- htmlzip
20+
- pdf
21+
- epub

Build.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ IF "%Mode%" == "Stable" (
163163
REM Create binary and source zips.
164164
CALL :delete "OpenRails-%Mode%*.zip" || GOTO :error
165165
PUSHD "Program" && 7za.exe a -r -tzip -x^^!*.xml "..\OpenRails-%Mode%.zip" . && POPD || GOTO :error
166-
7za.exe a -r -tzip -x^^!.* -x^^!obj -x^^!lib -x^^!_build -x^^!*.bak -x^^!Website "OpenRails-%Mode%-Source.zip" "Source" || GOTO :error
166+
7za.exe a -r -tzip -x^^!.* -x^^!obj -x^^!lib -x^^!_build -x^^!*.bak "OpenRails-%Mode%-Source.zip" "Source" || GOTO :error
167167

168168
ENDLOCAL
169169
GOTO :EOF

Docs/Architecture.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
11
# Open Rails Architecture
22

3-
This document will describe the overall structure of Open Rails and how we expect different areas of the program to work together.
3+
This document describes the overall structure of Open Rails and how we expect different areas of the program to work together.
4+
5+
## Player application model
6+
7+
The player application model describes the desired components and their relationships which make up Open Rails. Each of these will be formed from one or more libraries, as needed, and each library may contain distinct but critically linked subfunctions.
8+
9+
```mermaid
10+
flowchart TB
11+
Formats["Orts.Formats"]
12+
Game["Orts.Game"]
13+
Input["Orts.Input"]
14+
Multiplayer["Orts.Multiplayer"]
15+
Parsers["Orts.Parsers"]
16+
Player["Player"]
17+
Simulation["Orts.Simulation"]
18+
Sound["Orts.Sound"]
19+
UI["Orts.UI"]
20+
Viewer["Orts.Viewer"]
21+
Web["Orts.Web"]
22+
Player --- Game --- UI --- Viewer --- Simulation & Formats
23+
Player --- Input --- UI & Simulation
24+
Sound --- Simulation --- Formats & Multiplayer & Web
25+
Formats --- Parsers
26+
```
427

528
## Threading model
629

@@ -29,6 +52,22 @@ The threading in Open Rails has two key threads working together (Render and Upd
2952
- Web Server process
3053
- Handle all web and API requests
3154

55+
## Projects, assemblies, namespaces
56+
57+
Open Rails is made up of several component projects which are organised into subdirectories with the following naming pattern:
58+
59+
- `Orts.Component\Orts.Component.csproj` (project file)
60+
- `Orts.Component.dll` (assembly name)
61+
- `Orts.Component` (default namespace)
62+
63+
The namespaces used within code files should match the directory structure like this:
64+
65+
| *Filename* | *Namespace*
66+
|---|---|
67+
| `Orts.Component\File.cs` | `Orts.Component` |
68+
| `Orts.Component\Section\File.cs` | `Orts.Component.Section` |
69+
| `Orts.Component\Section\Subsection\File.cs` | `Orts.Component.Section.Subsection` |
70+
3271
## Simulator object relationships
3372

3473
This tree is a summary of the important object relationships (aggregation) inside the simulation. Each entry is a class whose instances can be accessed from the parent item.

Docs/Contributing.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,35 @@ If you've got a feature suggestion for Open Rails, please report it in [our road
1818

1919
You are free to make any modifications to the Open Rails code that you like; that's how open source works. However, if you'd like your feature to be included in the official version, there is a process to ensure that the community agrees and to review the code for potential issues prior to inclusion.
2020

21-
In most cases, you can get started immediately with making the changes and creating a pull request. We do ask for some additional steps to be taken for some bugs and all new features, but they can come before or after the pull request. Please feel free to share ideas and proposals as pull requests!
21+
In most cases, you can get started immediately with making the changes and creating a pull request. We have _additional requirements_ for some bugs and all new features, but they can come before or after the pull request is created. Please feel free to share ideas and proposals as pull requests!
2222

23-
**Note:** You must start your work from the "master" branch and merged pull requests back into the "master" branch, unless we direct you otherwise.
23+
**Note:** You must fork the Open Rails repository before you start working on it. We do not allow you to push branches to the official repository.
24+
25+
**Note:** You should do your work on separate branches; they must be created from the "master" branch and pull requests must merge back into the "master" branch, unless we direct you otherwise.
2426

2527
### Documentation and translations
2628

2729
If you'd like to improve the [documentation](./), [manual](../Source/Documentation/Manual), or [translations](../Source/Locales) you can get started immediately.
2830

29-
There are no requirements for the pull request.
31+
There are no additional requirements for the pull request.
32+
33+
### Contributed projects
34+
35+
If you'd like to improve the [contributed projects](../Source/Contrib) you can get started immediately.
36+
37+
There are no additional requirements for the pull request.
38+
39+
### Refactoring process
40+
41+
If you'd like to refactor the existing code you can get started immediately, but please have a look at our [architecture requirements](#architecture-requirements). We welcome architectural discussions on our [forum](http://www.elvastower.com/forums/index.php?/forum/256-developing-features/).
42+
43+
There are no additional requirements for the pull request.
3044

3145
### Bug process
3246

3347
If you'd like to fix a bug, you can get started immediately. If the fix turns out to be very small, you do not even need a bug report. Otherwise, you will need to make sure it has been reported on [our bug tracker on Launchpad](https://bugs.launchpad.net/or). If it has not, you can report the bug *and* fix it!
3448

35-
There are no requirements for creating the pull request.
49+
There are no additional requirements for _creating_ the pull request.
3650

3751
These things must be done in the required order:
3852

@@ -154,7 +168,7 @@ When we start preparing for a new Stable Version, all code in the Testing Versio
154168

155169
### Submitting your code
156170

157-
When you're done writing code, you should make a pull request on GitHub. The title and description of the requests should concisely indicate what bug or feature you've implemented and you will need to include links to whichever of the following are appropriate:
171+
When you're done writing code, you should make a pull request on GitHub from your fork's branch back to the official repository's "master" branch. The title and description of the requests should concisely indicate what bug or feature you've implemented and you will need to include links to whichever of the following are appropriate:
158172

159173
* Bug report
160174
* Road-map card

Docs/Policies.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Project Policies
2+
3+
This document records the policies currently in place under which the Project Team operates.
4+
5+
## License
6+
7+
The [GNU Public License](http://www.gnu.org/licenses/licenses.html) allows a user to use Open Rails in any way, except that you may not distribute software containing part of Open Rails without respecting the license terms.
8+
9+
## Liability
10+
11+
Open Rails is intended for entertainment purposes only and, to avoid liability, is not suitable for professional applications.
12+
13+
## Code Submissions
14+
15+
[Code contributions](https://github.com/openrails/openrails/blob/master/Docs/Contributing.md) to our repository must be in Microsoft's C# language. An authorised developer may not change content in the official version of Open Rails without approval from another authorised developer.
16+
17+
## Content Compatibility
18+
19+
Open Rails will continue to maintain compatibility with content from previous official versions of Open Rails.
20+
21+
## File Formats
22+
23+
New types of content will use the JavaScript Object Notation (JSON).
24+
Existing types of content from previous official versions of Open Rails will continue to be loaded without change.
25+
26+
## Keyboard Assignments
27+
28+
New key assignments should obey the following rules where that is possible.
29+
30+
* Reserve digit keys for camera operations.
31+
* Reserve Fn keys for pop-up windows.
32+
* Reserve the Alt modifier for debug operations.
33+
* Reserve modifier+space (e.g. Ctrl+space) for future expansion using sequences of keys.
34+
35+
Existing key assignments may not be changed without community discussion and approval of the Open Rails Management Team.
36+
37+
## Crashes and Derailments
38+
39+
Open Rails simulates emergency events which bring a train to a standstill, such as a derailment, and provides both a visual indication and a notification of the problem.
40+
41+
Open Rails does not show rolling stock leaving the track due to crashes or derailments. We have many members from the rail industry who have spent their working lives preventing incidents that cause injuries and loss of life and we respect that point of view.

Docs/Readme.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Open Rails is a free train simulator supporting the world's largest range of dig
1010
## Documentation
1111

1212
* [Read the FAQ](http://www.openrails.org/learn/faq/?utm_campaign=documentation&utm_source=readme&utm_medium=referral)
13-
* [Read the manual online](https://open-rails.readthedocs.io/en/1.3.1/) or the PDF included with the program, found in the main menu under "Documents"
13+
* [Read the manual online](https://open-rails.readthedocs.io/en/latest/) or the PDF included with the program, found in the main menu under "Documents"
1414
* [Get additional materials, including tutorials, from our website](http://www.openrails.org/learn/manual-and-tutorials/?utm_campaign=documentation&utm_source=readme&utm_medium=referral)
1515
* [Read more about the project on our website](http://www.openrails.org/discover/open-rails/?utm_campaign=documentation&utm_source=readme&utm_medium=referral)
1616

@@ -19,9 +19,10 @@ Open Rails is a free train simulator supporting the world's largest range of dig
1919
* [Join the community](http://www.openrails.org/share/community/?utm_campaign=documentation&utm_source=readme&utm_medium=referral)
2020
* [Report bugs or offer suggestions](http://www.openrails.org/contribute/reporting-bugs/?utm_campaign=documentation&utm_source=readme&utm_medium=referral)
2121
* [Create content](http://www.openrails.org/contribute/building-models/?utm_campaign=documentation&utm_source=readme&utm_medium=referral)
22+
* [How to propose and submit work](Contributing.md)
2223
* [Write code](http://www.openrails.org/contribute/developing-code/?utm_campaign=documentation&utm_source=readme&utm_medium=referral)
2324
* [Join the team](http://www.openrails.org/contribute/joining-the-team/?utm_campaign=documentation&utm_source=readme&utm_medium=referral)
24-
* [More details](Contributing.md)
25+
2526

2627
## Build status
2728

Source/Contrib/TrackViewer/Drawing/DrawColors.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ static class DrawColors
4646
public static ColorScheme colorsRoadsHotlight = new ColorScheme(HighlightType.Hotlight);
4747
public static ColorScheme colorsPathMain = new ColorScheme();
4848
public static ColorScheme colorsPathSiding = new ColorScheme();
49+
public static ColorScheme colorsEvent = new ColorScheme();
4950

5051
static ColorsGroupTrack trackGroupFlat = new ColorsGroupTrack();
5152
static ColorsGroupTrack roadTrackGroupFlat = new ColorsGroupTrack();
@@ -212,6 +213,11 @@ private static void SetItemColors(IPreferenceChanger preferenceChanger)
212213
TrackViewer.catalog.GetString("Select speedpost color"));
213214
itemColors.Speedpost = itemColor;
214215

216+
itemColor = new ColorWithHighlights(Color.DarkGray, 40);
217+
itemColor.MakeIntoUserPreference(preferenceChanger, "event",
218+
TrackViewer.catalog.GetString("Select event color"));
219+
itemColors.Event = itemColor;
220+
215221
itemColor = new ColorWithHighlights(Color.Blue, 40);
216222
itemColors.CandidateNode = itemColor;
217223

@@ -321,6 +327,7 @@ class ColorsGroupBasic {
321327
public ColorWithHighlights RoadCrossing { get; set; }
322328
public ColorWithHighlights Speedpost { get; set; }
323329
public ColorWithHighlights Siding { get; set; }
330+
public ColorWithHighlights Event { get; set; }
324331

325332
public ColorWithHighlights Text { get; set; }
326333
public ColorWithHighlights ClearWindowInset { get; set; }
@@ -362,6 +369,7 @@ class ColorScheme
362369
public Color RoadCrossing { get { return TrackItemColors.RoadCrossing.Colors[highlightType]; } }
363370
public Color Speedpost { get { return TrackItemColors.Speedpost.Colors[highlightType]; } }
364371
public Color Siding { get { return TrackItemColors.Siding.Colors[highlightType]; } }
372+
public Color Event { get { return TrackItemColors.Event.Colors[highlightType]; } }
365373

366374
public Color ActiveNode { get { return TrackItemColors.ActiveNode.Colors[highlightType]; } }
367375
public Color CandidateNode { get { return TrackItemColors.CandidateNode.Colors[highlightType]; } }

Source/Contrib/TrackViewer/Drawing/DrawTrackDB.cs

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ public class RouteData
4545
public RoadTrackDB RoadTrackDB { get; set; }
4646
/// <summary>The signal config file containing, for instance, the information to distinguish normal and non-normal signals</summary>
4747
public SignalConfigurationFile SigcfgFile { get; set; }
48+
/// <summary>
49+
/// <summary>Activity names</summary>
50+
/// </summary>
51+
public List<string> ActivityNames = new List<string> { };
4852

4953
private string storedRoutePath;
5054
private Dictionary<uint, string> signalFileNames;
@@ -87,7 +91,7 @@ public RouteData(string routePath, MessageDelegate messageDelegate)
8791
}
8892
catch
8993
{
90-
}
94+
}
9195

9296
string ORfilepath = System.IO.Path.Combine(routePath, "OpenRails");
9397
if (File.Exists(ORfilepath + @"\sigcfg.dat"))
@@ -102,6 +106,72 @@ public RouteData(string routePath, MessageDelegate messageDelegate)
102106
{
103107
//sigcfgFile = null; // default initialization
104108
}
109+
110+
// read the activity location events and store them in the TrackDB.TrItemTable
111+
112+
ActivityNames.Clear();
113+
var directory = System.IO.Path.Combine(routePath, "ACTIVITIES");
114+
if (System.IO.Directory.Exists(directory))
115+
{
116+
// counting
117+
int cnt = 0;
118+
119+
foreach (var file in Directory.GetFiles(directory, "*.act"))
120+
{
121+
try
122+
{
123+
var activityFile = new ActivityFile(file);
124+
Events events = activityFile.Tr_Activity.Tr_Activity_File.Events;
125+
if (events != null)
126+
{
127+
for (int i = 0; i < events.EventList.Count; i++)
128+
{
129+
if (events.EventList[i].GetType() == typeof(EventCategoryLocation))
130+
{
131+
cnt++;
132+
}
133+
}
134+
}
135+
}
136+
catch { }
137+
}
138+
139+
// adding
140+
uint index = 0;
141+
foreach (var file in Directory.GetFiles(directory, "*.act"))
142+
{
143+
try
144+
{
145+
var activityFile = new ActivityFile(file);
146+
Events events = activityFile.Tr_Activity.Tr_Activity_File.Events;
147+
bool found = false;
148+
if (events != null)
149+
{
150+
for (int i = 0; i < events.EventList.Count; i++)
151+
{
152+
if (events.EventList[i].GetType() == typeof(EventCategoryLocation))
153+
{
154+
EventCategoryLocation eventCategoryLocation = (EventCategoryLocation)events.EventList[i];
155+
EventItem eventItem = new EventItem(
156+
activityFile.Tr_Activity.Tr_Activity_Header.Name + ":" + eventCategoryLocation.Name,
157+
eventCategoryLocation.Outcomes.DisplayMessage,
158+
eventCategoryLocation.TileX, eventCategoryLocation.TileZ,
159+
eventCategoryLocation.X, 0, eventCategoryLocation.Z,
160+
index);
161+
TrackDB.TrItemTable[index] = eventItem;
162+
index++;
163+
found = true;
164+
}
165+
}
166+
}
167+
if (found) {
168+
ActivityNames.Add(activityFile.Tr_Activity.Tr_Activity_Header.Name);
169+
}
170+
}
171+
catch { }
172+
}
173+
174+
}
105175
}
106176

107177
/// <summary>
@@ -176,6 +246,32 @@ public string GetSignalFilename(uint signalIndex)
176246
}
177247
}
178248

249+
/// <summary>
250+
/// represents an Activity Location EventItem
251+
/// </summary>
252+
/// defined in this trackviewer file because I want to keep changes localized to the TrackViewer
253+
254+
public class EventItem : TrItem
255+
{
256+
/// <summary>
257+
/// Default constructor, no file parsing used
258+
/// </summary>
259+
public EventItem(string itemName, string briefing, int tileX, int tileZ, float x, float y, float z, uint trItemId)
260+
{
261+
// ItemType is trEMPTY on purpose
262+
// so that Orts.Formats.Msts.TrItem.trItemType does not need a change
263+
ItemType = trItemType.trEMPTY;
264+
ItemName = itemName;
265+
TileX = tileX;
266+
TileZ = tileZ;
267+
X = x;
268+
Y = y;
269+
Z = z;
270+
TrItemId = trItemId;
271+
SData2 = briefing;
272+
}
273+
}
274+
179275
/// <summary>
180276
/// This is a big class where the drawing of everything in the track data base is done.
181277
/// This means tracks themselves (meaning so-called vector nodes that contain a number of sections,

0 commit comments

Comments
 (0)