Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@twpol
Copy link
Member

@twpol twpol commented Oct 14, 2025

Refactor loading of textures to avoid future issues like #1151

@twpol twpol self-assigned this Oct 14, 2025
@twpol twpol added the refactoring Changes with minimal user-visible effects label Oct 14, 2025
twpol pushed a commit that referenced this pull request Oct 14, 2025
- Pull request #1082 at 8538170: Allow variable water level in glass gauge
- Pull request #1156 at f46d5f2: Fix incorrectly disabled options in train operations window
- Pull request #1091 at 492795a: Automatic speed control
- Pull request #1122 at b9b077b: Wagon Size and Centering Controls
- Pull request #1124 at e241a0d: Built-in PBL2 brake controller
- Pull request #1128 at d116396: Particle Emitter Overhaul
- Pull request #1157 at 39cd994: Dynamic brake authorization by TCS
- Pull request #1159 at 48c9a63: Skip OR warnings about TSRE-specific token Ruler
- Pull request #1163 at 2f9e292: Fix: Crash when using Camera 8 and F9.
- Pull request #1164 at 1ad9889: Fix: F9 crashes with a front coupled single steam locomotive by Csantucci.
- Pull request #1165 at aacd11b: docs: Add code guidelines for logging
- Pull request #1166 at 51e7f7a: Simplify loading of internal and game textures
twpol pushed a commit that referenced this pull request Oct 15, 2025
- Pull request #1082 at 8538170: Allow variable water level in glass gauge
- Pull request #1156 at f46d5f2: Fix incorrectly disabled options in train operations window
- Pull request #1091 at 492795a: Automatic speed control
- Pull request #1122 at b9b077b: Wagon Size and Centering Controls
- Pull request #1124 at e241a0d: Built-in PBL2 brake controller
- Pull request #1128 at d116396: Particle Emitter Overhaul
- Pull request #1157 at 39cd994: Dynamic brake authorization by TCS
- Pull request #1159 at 48c9a63: Skip OR warnings about TSRE-specific token Ruler
- Pull request #1163 at 2f9e292: Fix: Crash when using Camera 8 and F9.
- Pull request #1164 at 1ad9889: Fix: F9 crashes with a front coupled single steam locomotive by Csantucci.
- Pull request #1165 at aacd11b: docs: Add code guidelines for logging
- Pull request #1166 at 51e7f7a: Simplify loading of internal and game textures
- Pull request #1167 at 2c028a4: Fix: RunActivity slow to terminate because of long sleep in Host Process
twpol pushed a commit that referenced this pull request Oct 15, 2025
- Pull request #1082 at 8538170: Allow variable water level in glass gauge
- Pull request #1156 at f46d5f2: Fix incorrectly disabled options in train operations window
- Pull request #1091 at 492795a: Automatic speed control
- Pull request #1122 at a8f3ed2: Wagon Size and Centering Controls
- Pull request #1124 at e241a0d: Built-in PBL2 brake controller
- Pull request #1128 at d116396: Particle Emitter Overhaul
- Pull request #1157 at 39cd994: Dynamic brake authorization by TCS
- Pull request #1159 at 48c9a63: Skip OR warnings about TSRE-specific token Ruler
- Pull request #1163 at 2f9e292: Fix: Crash when using Camera 8 and F9.
- Pull request #1164 at 1ad9889: Fix: F9 crashes with a front coupled single steam locomotive by Csantucci.
- Pull request #1165 at aacd11b: docs: Add code guidelines for logging
- Pull request #1166 at 51e7f7a: Simplify loading of internal and game textures
- Pull request #1167 at 2c028a4: Fix: RunActivity slow to terminate because of long sleep in Host Process
twpol pushed a commit that referenced this pull request Oct 15, 2025
- Pull request #1082 at 8538170: Allow variable water level in glass gauge
- Pull request #1156 at f46d5f2: Fix incorrectly disabled options in train operations window
- Pull request #1091 at 492795a: Automatic speed control
- Pull request #1122 at 73c47b4: Wagon Size and Centering Controls
- Pull request #1124 at e241a0d: Built-in PBL2 brake controller
- Pull request #1128 at d116396: Particle Emitter Overhaul
- Pull request #1157 at 39cd994: Dynamic brake authorization by TCS
- Pull request #1159 at 48c9a63: Skip OR warnings about TSRE-specific token Ruler
- Pull request #1163 at 2f9e292: Fix: Crash when using Camera 8 and F9.
- Pull request #1164 at 1ad9889: Fix: F9 crashes with a front coupled single steam locomotive by Csantucci.
- Pull request #1166 at 51e7f7a: Simplify loading of internal and game textures
- Pull request #1167 at 2c028a4: Fix: RunActivity slow to terminate because of long sleep in Host Process
return Orts.Formats.Msts.AceFile.Texture2DFromFile(graphicsDevice, path);
else if (ext == ".dds" && File.Exists(path))
/// <summary>
/// Loads an internal texture file; DO NOT use with game data, use <see cref="Get(string, bool)"/> instead.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary for LoadInternal() references Get() method.
Perhaps Get() method should reference LoadInternal() in a similar fashion?

twpol pushed a commit that referenced this pull request Oct 16, 2025
- Pull request #1082 at 8538170: Allow variable water level in glass gauge
- Pull request #1156 at f46d5f2: Fix incorrectly disabled options in train operations window
- Pull request #1091 at 492795a: Automatic speed control
- Pull request #1122 at 73c47b4: Wagon Size and Centering Controls
- Pull request #1124 at e241a0d: Built-in PBL2 brake controller
- Pull request #1128 at d116396: Particle Emitter Overhaul
- Pull request #1157 at 39cd994: Dynamic brake authorization by TCS
- Pull request #1159 at 48c9a63: Skip OR warnings about TSRE-specific token Ruler
- Pull request #1163 at 2f9e292: Fix: Crash when using Camera 8 and F9.
- Pull request #1164 at 1ad9889: Fix: F9 crashes with a front coupled single steam locomotive by Csantucci.
- Pull request #1166 at 51e7f7a: Simplify loading of internal and game textures
- Pull request #1167 at 115325f: Fix: RunActivity slow to terminate because of long sleep in Host Process
twpol pushed a commit that referenced this pull request Oct 18, 2025
- Pull request #1082 at 8538170: Allow variable water level in glass gauge
- Pull request #1156 at f46d5f2: Fix incorrectly disabled options in train operations window
- Pull request #1091 at 492795a: Automatic speed control
- Pull request #1122 at 73c47b4: Wagon Size and Centering Controls
- Pull request #1124 at e241a0d: Built-in PBL2 brake controller
- Pull request #1128 at d116396: Particle Emitter Overhaul
- Pull request #1157 at 39cd994: Dynamic brake authorization by TCS
- Pull request #1159 at 48c9a63: Skip OR warnings about TSRE-specific token Ruler
- Pull request #1163 at 2f9e292: Fix: Crash when using Camera 8 and F9.
- Pull request #1164 at 1ad9889: Fix: F9 crashes with a front coupled single steam locomotive by Csantucci.
- Pull request #1166 at 51e7f7a: Simplify loading of internal and game textures
- Pull request #1167 at 115325f: Fix: RunActivity slow to terminate because of long sleep in Host Process
- Pull request #1168 at 6e2942f: Fix exception when exiting with MapForm or SoundDebugForm open.
[CallOnThread("Loader")]
public class SharedTextureManager
{
const int MaxSelectorDirectoryNames = 5;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the value 5? The following set has 7 strings, which would make the max index "6".

readonly HashSet<string> SelectorDirectoryNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase) {
"Autumn",
"AutumnSnow",
"Snow",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should "Snow" be last, so that (eg) "WinterSnow" gets preferred over "Snow"?


public static Texture2D LoadInternal(GraphicsDevice graphicsDevice, string path, Microsoft.Xna.Framework.Rectangle MapRectangle)
{
if (path == null || path == "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Could use "IsNullOrEmpty()", like in other places.

twpol pushed a commit that referenced this pull request Oct 19, 2025
- Pull request #1082 at 8538170: Allow variable water level in glass gauge
- Pull request #1156 at f46d5f2: Fix incorrectly disabled options in train operations window
- Pull request #1091 at 492795a: Automatic speed control
- Pull request #1122 at 73c47b4: Wagon Size and Centering Controls
- Pull request #1124 at e241a0d: Built-in PBL2 brake controller
- Pull request #1128 at d116396: Particle Emitter Overhaul
- Pull request #1157 at 39cd994: Dynamic brake authorization by TCS
- Pull request #1159 at 48c9a63: Skip OR warnings about TSRE-specific token Ruler
- Pull request #1163 at 2f9e292: Fix: Crash when using Camera 8 and F9.
- Pull request #1164 at 1ad9889: Fix: F9 crashes with a front coupled single steam locomotive by Csantucci.
- Pull request #1166 at 51e7f7a: Simplify loading of internal and game textures
- Pull request #1167 at 115325f: Fix: RunActivity slow to terminate because of long sleep in Host Process
- Pull request #1168 at 6e2942f: Fix exception when exiting with MapForm or SoundDebugForm open.
- Pull request #1169 at 8c1d787: Better Handling of Wagons with Invalid Bogie Configuration
twpol pushed a commit that referenced this pull request Oct 19, 2025
- Pull request #1082 at 8538170: Allow variable water level in glass gauge
- Pull request #1156 at f46d5f2: Fix incorrectly disabled options in train operations window
- Pull request #1091 at 492795a: Automatic speed control
- Pull request #1122 at 73c47b4: Wagon Size and Centering Controls
- Pull request #1124 at e241a0d: Built-in PBL2 brake controller
- Pull request #1128 at d116396: Particle Emitter Overhaul
- Pull request #1157 at 39cd994: Dynamic brake authorization by TCS
- Pull request #1163 at 2f9e292: Fix: Crash when using Camera 8 and F9.
- Pull request #1164 at 1ad9889: Fix: F9 crashes with a front coupled single steam locomotive by Csantucci.
- Pull request #1166 at 51e7f7a: Simplify loading of internal and game textures
- Pull request #1167 at 115325f: Fix: RunActivity slow to terminate because of long sleep in Host Process
- Pull request #1168 at 6e2942f: Fix exception when exiting with MapForm or SoundDebugForm open.
- Pull request #1169 at 8fe03b1: Better Handling of Wagons with Invalid Bogie Configuration
twpol pushed a commit that referenced this pull request Oct 19, 2025
- Pull request #1082 at 8538170: Allow variable water level in glass gauge
- Pull request #1156 at f46d5f2: Fix incorrectly disabled options in train operations window
- Pull request #1091 at 492795a: Automatic speed control
- Pull request #1122 at 73c47b4: Wagon Size and Centering Controls
- Pull request #1124 at e241a0d: Built-in PBL2 brake controller
- Pull request #1128 at d116396: Particle Emitter Overhaul
- Pull request #1157 at 39cd994: Dynamic brake authorization by TCS
- Pull request #1163 at 2f9e292: Fix: Crash when using Camera 8 and F9.
- Pull request #1166 at 51e7f7a: Simplify loading of internal and game textures
- Pull request #1167 at 115325f: Fix: RunActivity slow to terminate because of long sleep in Host Process
- Pull request #1168 at 6e2942f: Fix exception when exiting with MapForm or SoundDebugForm open.
- Pull request #1169 at 8fe03b1: Better Handling of Wagons with Invalid Bogie Configuration
twpol pushed a commit that referenced this pull request Oct 21, 2025
- Pull request #1082 at 8538170: Allow variable water level in glass gauge
- Pull request #1156 at f46d5f2: Fix incorrectly disabled options in train operations window
- Pull request #1091 at 492795a: Automatic speed control
- Pull request #1122 at 73c47b4: Wagon Size and Centering Controls
- Pull request #1124 at e241a0d: Built-in PBL2 brake controller
- Pull request #1128 at d116396: Particle Emitter Overhaul
- Pull request #1157 at 39cd994: Dynamic brake authorization by TCS
- Pull request #1166 at 51e7f7a: Simplify loading of internal and game textures
- Pull request #1167 at 115325f: Fix: RunActivity slow to terminate because of long sleep in Host Process
- Pull request #1168 at 6e2942f: Fix exception when exiting with MapForm or SoundDebugForm open.
- Pull request #1169 at 8fe03b1: Better Handling of Wagons with Invalid Bogie Configuration
- Pull request #1171 at 8fd2066: no internet connection is available, not possible to open the Menu Content Form
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Changes with minimal user-visible effects

Development

Successfully merging this pull request may close these issues.

3 participants