News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

configuration to make trains stop at the designated position of halt

Started by THLeaderH, October 24, 2021, 06:01:31 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

THLeaderH

This is a request for a new feature in simutrans.

SUMMARY
I want to add a configuration parameter that enables trains to stop at the designated position of the halt.
When the map is configured to do so, trains stop at the position designated in the schedule as long as the platform covers the entire convoy.

MOTIVATION
Sometimes, we have a situation that a short train stops at a platform with a long length like the image below.
In this situation, I want to make the train stop at the middle of the platform, instead of making the train proceed to the end of the platform, which is the current simutrans behavior.


Also, I want to make two short trains stop at a very long platform like the image below. If trains are allowed to stop at the position designated in the schedule, these two trains with proper schedule can stop at one platform at the same time.


cf) My fork version implemented this feature three years ago and the most users of my fork enables this option.
https://github.com/teamhimeh/simutrans/commit/c407a6a4c85d8a26655355fef6cf6a34b188b2ef

EXPECTED BEHAVIOR
When a player disables `advance_to_end` enables `stop_halt_as_scheduled`, which is a map settings parameter, trains stop at the point where the convoy's head is the desginated position in the schedule as long as the entire convoy is covered by the platform. If the platform cannot cover the entire convoy with the convoy's head position designated in the schedule, the convoy proceeds until the entire convoy is covered by the platform.
The default value of `advance_to_end` is on `stop_halt_as_scheduled` is off, thus with the default settings, a train proceeds to the end of the platform which the current simutrans does.

SIDE EFFECTS
With the default settings, there should be no behavioral change.
The save data consumes 1 byte to save the setting value of `advance_to_end` `stop_halt_as_scheduled`.



I attached the patch file based on nightly r10190.

Also, I submitted a PR to aburch/simutrans, which is only for code review and is not intended to be merged. For code review, I'll have a discussion as another topic.
https://github.com/aburch/simutrans/pull/16

prissi

This is not really the middle since it depends on the player. And for choose signals the train will always advance to the end. Maybe a better name is "station_halt_as_scheduled" or so (with inverted logic).

SInce the default is like the current system, I think this is not a big issue to have.

THLeaderH

#2
How about "stop_halt_as_scheduled" for the parameter name?

QuoteThis is not really the middle since it depends on the player. And for choose signals the train will always advance to the end.
Yes, this is what I intended. I will fix the first post of this topic.


EDIT:
I attached the patch file based on nightly r10190 to the first post.
Also, I submitted a PR to aburch/simutrans, which is only for code review and is not intended to be merged. For code review, I'll have a discussion as another topic.
https://github.com/aburch/simutrans/pull/16

prissi

SInce nobody has access to aburch, this pull request will stay there forever. If pssible, a patch file is preferred.

Well, the most important part is still missing, but the existing part is fine.

THLeaderH

Sorry, I could not figure out the important missing part you indicated. Could you tell me about it?

For choose signal, I think the current behavior is enough. IMO, since the length is different for the platforms, assuming a specific stopping point for all platforms is not so reasonable. It is enough for convoys to advance to the end of the platform if the specified platform by the choose signal is different from the platform designated in the schedule.

prissi

The convoi are not affected by this patch, unless I missed something. It just adds a parameter, so there is nothing I can comment on the logic.

Dwachs

The change is in rail-Vechilce.cc: instead of the magic number 8888 it uses the convoi length as parameter for some route search.
Parsley, sage, rosemary, and maggikraut.

prissi

Oh, I looked for longer logic for centering first. Sorry.

Incorporated in r10194

THLeaderH

Thank you for merging, and writing history.txt and simuconf.tab. I should have written history.txt and simuconf.tab in the patch.