Auto-remove signal, good idea or not?

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Kuhnovic
Engineer
Engineer
Posts: 13
Joined: 06 Jul 2020 19:33

Re: Auto-remove signal, good idea or not?

Post by Kuhnovic »

JGR wrote:
12 Jul 2020 16:18
Yes, you're testing the value of _settings_game.construction.auto_remove_signals in the command execution, and this is run on the server and all clients.

Making it a local setting is a bit more fiddly. You would need to move it to the .gui section (struct GUISettings), and adjust the parameters of the DoCommandP call from the client depending on the value of the setting.
e.g. take a look at _settings_client.gui.drag_signals_density and _settings_client.gui.drag_signals_fixed_distance.
The desyncs indeed went away when everybody in the game had the feature on. I will look into those settings, see if I can make it work. Thanks a lot, this saved me a lot of headache!

User avatar
jfs
Tycoon
Tycoon
Posts: 1245
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Auto-remove signal, good idea or not?

Post by jfs »

Yes either you need to sync the setting between clients, forcing everyone in the game to play with the same setting.
Or you need to find space in the command to send the value of the setting (it'd need just one bit) so the client invoking the command tells everyone else its signal removing preference for that command invocation.
Or you need to make it a client-side-only feature where the mouse action first searches the to-be-built rail for signals that need removal and send signal removal commands for those before sending the rail building command.

Kuhnovic
Engineer
Engineer
Posts: 13
Joined: 06 Jul 2020 19:33

Re: Auto-remove signal, good idea or not?

Post by Kuhnovic »

I added an extra bit to the p2 integer of the build-rail-command and managed to get it working. The feature can now be enabled according to preference, no matter if other players in the game use it or not. I also made it work for depots, since they also create a few bits of rail when constructed next to an existing railway.

I tested it out with a friend for a few hours, and we didn't find any issues. We both really liked the feature (though I'm a bit biased ;) ), and we had no problems with accidental signals removals.

Feel free to try it out if you have time, see if you like it. I'm going to set up a pull request soon, but I've never worked with git before so I need to figure that out first. Shouldn't be too difficult :)

Thanks everyone for the great suggestions, it really helped!

[EDIT] for reference, here's the Pull Request: https://github.com/OpenTTD/OpenTTD/pull/8274
Attachments
Auto_remove_signals_v2.patch
(9.53 KiB) Downloaded 110 times

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 3 guests