This patch will give a way how to limit a railroad speed for more reality.
It is useful to make a railroad track which both slower and faster train passes.
for example, in Korea, express train whose max speed is 300km/h and normal train whose max speed is 150km/h meet some common tracks.
but the track limits all trains under 150km/h. It is unrealistic that any express train passes a major station over 200km/h.
Furthermore, because of using waypoint, it has NO SIDE EFFECTS.
that is, it is like a feature in a old patch pack, Chill's patch pack ( http://www.tt-forums.net/viewtopic.php?t=47622 )
However, it used a signal, so it has some side effects when I use both the speed limit signal and PBS signal.
USAGE:
You should change a waypoint's name to "[SpeedLimit(km/h)][Underbar][Any Name]"
for example: "60_mywaypoint" is 60km/h limit.
I attached a diff patch file based stable 1.5.2 version and Win64 binary file.
(Savefile will be compatible because of save format is not changed.)
Any bugs or any suggestion will be welcome !
Patch: Railroad Track Limit by Using Named Waypoint
Moderator: OpenTTD Developers
Patch: Railroad Track Limit by Using Named Waypoint
- Attachments
-
- TrainSpeedPatch.patch
- Patch File
- (2.31 KiB) Downloaded 162 times
-
- 1.5.2-KHJR.zip
- Win64 Binary
- (9.09 MiB) Downloaded 118 times
Re: Patch: Railroad Track Limit by Using Named Waypoint
It is great to see you here, coala lol, Nice job.
여기서 뵈니 기쁘네요 알라 님ㅋ 훌륭하네요.
여기서 뵈니 기쁘네요 알라 님ㅋ 훌륭하네요.
- OpenTTD/OpenRCT2/Parkitect Korean Translator
- TELKLAND site manager, the korean website of OpenRCT2/OpenTTD (https://telk.kr)
- HackaLittleBit
- Director
- Posts: 550
- Joined: 10 Dec 2008 16:08
- Location: tile 0x0000
Re: Patch: Railroad Track Limit by Using Named Waypoint
Nice!
I hope you don't mind but I could not resist rewriting some of your code.
There are very strict rules for writing code in OTTD.
see coding style
Also I advise you to check your patch file for errors before you send it.(white space etc.)
The location of this code should most probably be in the end part of the TrainController function.
See AffectSpeedByZChange
P.S Code was not really tested.
I have no time at the moment.
Success
I hope you don't mind but I could not resist rewriting some of your code.
There are very strict rules for writing code in OTTD.
see coding style
Code: Select all
if (prev == NULL && gp.new_tile != gp.old_tile && IsRailWaypointTile(gp.new_tile)) {
int speed = 0;
Waypoint *wp = Waypoint::GetByTile(gp.new_tile);
if (wp->name != NULL) {
for (uint32 i = 0; i < strlen(wp->name); i++) {
if (wp->name[i] == '_' && speed > 0) {
v->current_order.SetMaxSpeed((uint16)speed);
break;
}
if (wp->name[i] < '0' || wp->name[i] > '9') {
break;
}
speed *= 10;
speed += (wp->name[i] - '0');
}
}
if (speed == 0) v->current_order.SetMaxSpeed(UINT16_MAX);
}
The location of this code should most probably be in the end part of the TrainController function.
See AffectSpeedByZChange
P.S Code was not really tested.
I have no time at the moment.
Success
Re: Patch: Railroad Track Limit by Using Named Waypoint
I´ve tested your code and it seems to work properly.
So it´s a nice addition to NuTracks and the game is way more realistic now.
So it´s a nice addition to NuTracks and the game is way more realistic now.
Re: Patch: Railroad Track Limit by Using Named Waypoint
I've always limited my trains using waypoints and speed limits in the timetableing feature which is easy enough but does require a bit of time, particularly if i want to chance the speed limit on a particular section of track that already has a number of trains running.
Looking forward to trying this out at some point.
My suggestion for improvement is to remove the need for waypoints at all. The user could activate a visualisation of speed limits using a button in the rail construction menu, to apply a speed limit the user can select the speed then click and drag over a section of track. For the visualisation a color can be calculated based on the logic that the highest speed limit in the network is deep red and the slowest is deep green, the generated color would be selected appropriately from the spectum in between and this color will be overlayed over the track when the speed limits data view is on, clicking on a section of track while in the speed limit view will bring up a window that will allow the user to fine tune the limit asigned to the particular section.
Looking forward to trying this out at some point.
My suggestion for improvement is to remove the need for waypoints at all. The user could activate a visualisation of speed limits using a button in the rail construction menu, to apply a speed limit the user can select the speed then click and drag over a section of track. For the visualisation a color can be calculated based on the logic that the highest speed limit in the network is deep red and the slowest is deep green, the generated color would be selected appropriately from the spectum in between and this color will be overlayed over the track when the speed limits data view is on, clicking on a section of track while in the speed limit view will bring up a window that will allow the user to fine tune the limit asigned to the particular section.
Re: Patch: Railroad Track Limit by Using Named Waypoint
You can use NuTracks for speed limits, if you do not want to use waypoints.
Who is online
Users browsing this forum: No registered users and 30 guests