New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initail build of duplex steam #877
Initail build of duplex steam #877
Conversation
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #857 at 9afc8c3: Adding Air Flow Meters - Pull request #865 at 776d6df: Dispatcher window improvements - Pull request #874 at 86d58ff: Dynamic brake controller refactoring - Pull request #875 at 43bf33e: Bug fix for https://bugs.launchpad.net/or/+bug/2036346 Player train switching doesn't work with 3D cabs - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #877 at c567eba: Initail build of duplex steam
Source/Orts.Simulation/Simulation/RollingStocks/MSTSSteamLocomotive.cs
Outdated
Show resolved
Hide resolved
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #857 at 9afc8c3: Adding Air Flow Meters - Pull request #865 at 776d6df: Dispatcher window improvements - Pull request #874 at 86d58ff: Dynamic brake controller refactoring - Pull request #875 at 43bf33e: Bug fix for https://bugs.launchpad.net/or/+bug/2036346 Player train switching doesn't work with 3D cabs - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #877 at ce3490b: Initail build of duplex steam
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just two style fixes, sorry for not having spotted them before
Source/Orts.Simulation/Simulation/RollingStocks/MSTSSteamLocomotive.cs
Outdated
Show resolved
Hide resolved
if (Receiver == null) return; | ||
{ | ||
Receiver.SteamBoosterChangeTo(ToState, Target); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (Receiver == null) return; | |
{ | |
Receiver.SteamBoosterChangeTo(ToState, Target); | |
} | |
Receiver?.SteamBoosterChangeTo(ToState, Target); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not as comfortable with this change.
Firstly I think that long hand code is sometimes more "readable" then short hand code.
Secondly there are a number of other similar entries in the other controllers. Hence for consistency these should be changed as well.
So I would prefer to leave this as it is, and somebody else can refactor all the code to be similar at a later date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry but I won't approve it as is. It looks confusing to me. In particular, at first glance your code seems to do
if (Receiver == null)
{
Receiver.SteamBoosterChangeTo(ToState, Target);
}
until you notice the "return" statement. The curly braces are completely misleading.
The ?. operator is my preferred choice in this case, and is also recommended by ORMT (see http://www.elvastower.com/forums/index.php?/topic/35509-cs-null-conditional-operator/). It is also used elsewhere in Commands.cs, so your argument about consistency is not really valid. In my opinion, new code should use it whenever possible.
However, my intention is not to force you to use that syntax. It was just my suggestion. I have no problem if you prefer to use "standard" syntax, as long as the misleading braces are removed. Other acceptable solutions for me are:
if (Receiver == null) return;
Receiver.SteamBoosterChangeTo(ToState, Target);
or
if (Receiver != null)
{
Receiver.SteamBoosterChangeTo(ToState, Target);
}
or
if (Receiver != null) Receiver.SteamBoosterChangeTo(ToState, Target);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I have adopted one of your suggested solutions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry for being so nitpicking, but the indentation of Receiver.SteamBoosterChangeTo(ToState, Target);
is still incorrect. I think it is important that we follow the coding guidelines to make code more readable for others. I could have corrected it myself, but you disabled "allow edits from maintainers".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have moved it across now. Thanks for checking.
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #857 at 9afc8c3: Adding Air Flow Meters - Pull request #865 at 776d6df: Dispatcher window improvements - Pull request #874 at 86d58ff: Dynamic brake controller refactoring - Pull request #875 at 43bf33e: Bug fix for https://bugs.launchpad.net/or/+bug/2036346 Player train switching doesn't work with 3D cabs - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #877 at a0bd9ec: Initail build of duplex steam
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #865 at 776d6df: Dispatcher window improvements - Pull request #874 at 86d58ff: Dynamic brake controller refactoring - Pull request #875 at 43bf33e: Bug fix for https://bugs.launchpad.net/or/+bug/2036346 Player train switching doesn't work with 3D cabs - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #877 at a0bd9ec: Initail build of duplex steam
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #865 at 776d6df: Dispatcher window improvements - Pull request #874 at 86d58ff: Dynamic brake controller refactoring - Pull request #875 at 43bf33e: Bug fix for https://bugs.launchpad.net/or/+bug/2036346 Player train switching doesn't work with 3D cabs - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #877 at a76c45b: Initail build of duplex steam
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #865 at 776d6df: Dispatcher window improvements - Pull request #874 at 86d58ff: Dynamic brake controller refactoring - Pull request #875 at 43bf33e: Bug fix for https://bugs.launchpad.net/or/+bug/2036346 Player train switching doesn't work with 3D cabs - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #877 at 55f9ddd: Initail build of duplex steam
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, and sorry for the inconvenience of the multiple style suggestions.
Thanks Cesar. |
Initial build of duplex steam - addition of control commands only
https://blueprints.launchpad.net/or/+spec/duplex-steam-locomotives
It is desired to merge this so that control keys are "reserved".
Additional functionality supporting this will be added later under a separate PR