The International Simutrans Forum

Development => Patches & Projects => Topic started by: Nazalassa on May 23, 2026, 11:42:04 AM

Title: Let other players stop at private halts (in a controlled way)
Post by: Nazalassa on May 23, 2026, 11:42:04 AM
When several players play together they may need to exchange goods and passengers. For this, public stops can be used. However, public stops are not always practical, especially on servers. e.g if several players serve different parts of a city they may need interchanges, thus many public stops, which they cannot delete or rearrange if the public service is locked.

With this patch other players can be allowed to stop at a halt, without having to make it public. Permissions can be set player-wise and halt-wise from the "connections" tab of halt info windows:
permission-window.png
Title: Re: Let other players stop at private halts (in a controlled way)
Post by: prissi on May 23, 2026, 01:43:57 PM
A good idea, but some points need more though:

How to discover such stops then? Make them still another special colour? Blinking seems a bad idea ...

Public stops are unchangeable to avoid someone removing a tile where some other convoi stops. I think now such halt tiles need protection against deletion.

And for servers, it strongly depends that players are in the same time zone or interaction is much more limited to one stop per day ...
Title: Re: Let other players stop at private halts (in a controlled way)
Post by: Nazalassa on May 23, 2026, 04:51:42 PM
Like this? (Patch attached) The color bits are only displayed when extra players are allowed stopping.

permission-display.png


As for protecting shared stop tiles from removal, I think it is not necessary; in my opinion public stops are intended for large, really "public" interchanges, while the permissions system is more fit for "local" interchanges between individual players, so avoiding deleting platforms in use is the owner's responsability, not the game's.



However, I found a problem: suppose there is a stretch of public track. Player 1 sets a waypoint there for one of their convoys. Player 2 then builds a stop on top of the waypoint, and makes it public. Now player 1's convoy should (and does) stop at the station. However, it is not registered within the station, so the routing algorithm doesn't "see it" until its schedule is manually changed.
This also happens e.g when removing access to a halt to player X, and then re-enabling it again.

The only way I could think of to fix this is to renew registrations of all lines and lineless convoys whenever a halt's owner or permissions change. That might be long, but stop owner/permissions rarely change.
Title: Re: Let other players stop at private halts (in a controlled way)
Post by: isidoro on May 24, 2026, 01:16:48 AM
I agree with Prissi that those stations shouldn't be deletable, at least while there are others' schedules stopping there.  Once you give permission, the station should stay there for the players you give permission to.

Following the reasoning:
  * You can open your stations to other players
  * While no other player is using the station you can revert those permissions
  * You can only delete the station when all permissions are reverted

Additionally, I would split benefits for that leg between the owner of the station and the owner of the line, unless negative.
Title: Re: Let other players stop at private halts (in a controlled way)
Post by: prissi on May 24, 2026, 02:18:01 AM
Adding a tile (no matter on what kind of ground) always calls welt->set_schedule_counter(); that is the most time consuming calculation (and why it is dragged over a steps). The iterating over all lines and lineless convois can be fast, especially, since with your patch, it will not affect all players.

And the display bar below is some help, indeed.

NB: Patching the translation is useless, since those will be overwritten on next release by the texts from the translator ...

Since public service cannot own convois, so it can never stop anywhere in game new enough. (It could run convois until 101 or so, I have one ancient test game with this). And finally, why an extra popup and not putting it to the top of cennection tab?

Finally, on the implementation, I think I would also incorporate the old public stop system into it. I will see how it works.
Title: Re: Let other players stop at private halts (in a controlled way)
Post by: poppo on May 24, 2026, 04:30:52 AM
in OTRPatch, "allow other players to connect" button exist. We can allow all players to connect the private stop (but we cannot choose to allow or prohibit individual players).
I think "allow/prohibit each player to connect" is better.

I want to share something:
Please check tool_stop_mover work well on the other player's halt.
Title: Re: Let other players stop at private halts (in a controlled way)
Post by: Nazalassa on May 24, 2026, 07:19:32 AM
New patch with:
- permissions
- colored indicators on halts with additional permissions
- a fix for the bug I mentioned
- a fix for tool_stop_mover so that it works on the player's convoys, even on other players' halts

Quote from: prissi on Today at 02:18:01 AMwhy an extra popup and not putting it to the top of cennection tab?

I felt it would take a lot of vertical space, and the connections tab is already tall enough.
Title: Re: Let other players stop at private halts (in a controlled way)
Post by: prissi on May 24, 2026, 08:14:52 AM
Thank you all. And sorry Nazalassa, I just submitted an extended version also fixing the stop mover.

I have checked so many things, the patch has become quite big ...
I have integrated the buttons in the connection tab of the halt info.
The old public stops and the new system will use the same permissions, no extra logic for public stops any more.

Please test, servers can use the new system, but local saves will loose the information.

At the current speed of development, one should think about another release soon ...
Title: Re: Let other players stop at private halts (in a controlled way)
Post by: Andarix on May 24, 2026, 08:41:50 AM
Quote from: prissi on Today at 08:14:52 AM...

At the current speed of development, one should think about another release soon ...

I have now advanced the sqai_koa for pak64 to the point where it is generating its first operating profits. It could be included in a future release—though the AI's strategy might not win over many fans, given that it tends to take over a large portion of the map in a relatively short time.
Title: Re: Let other players stop at private halts (in a controlled way)
Post by: Nazalassa on May 24, 2026, 09:21:13 AM
No problem.

Here are some tweaks on the current version:
- in simhalt.h, "inline bool haltestelle_t::can_use_halt" causes compiler errors
- don't display the permission bits above stop name for public halts
- don't display permission buttons in info window for public halts (everyone can stop there anyway)
    -> maybe display "public halt" instead?
- display one permission button per line instead of 2, as 2 buttons per line causes this to happen
alignment.png
- (use pl->is_public_service() instead of i == 1, remove two unused variables)

also, since it seems src/simutrans/gui/permission is still in the source file list (even though it is not used), it removes it.

Title: Re: Let other players stop at private halts (in a controlled way)
Post by: Andarix on May 24, 2026, 09:24:28 AM
Quote from: prissi on Today at 08:14:52 AMThank you all. And sorry Nazalassa, I just submitted an extended version also fixing the stop mover.
 ...

permission_frame.cc is missing
Title: Re: Let other players stop at private halts (in a controlled way)
Post by: prissi on May 24, 2026, 10:11:27 AM
The public player can also exclude players from exchange. Because public stops are not really needed much more unless as protection for bankrupsy. (But then, way removal is anyway an issue.)

But this should be indeed two tables. Check r11976

Quote from: Andarix on Today at 09:24:28 AMpermission_frame.cc is missing
Not needed, I had integrated it in my version.
Title: Re: Let other players stop at private halts (in a controlled way)
Post by: Andarix on May 24, 2026, 10:48:21 AM
Quote from: prissi on Today at 10:11:27 AM...
Not needed, I had integrated it in my version.


Then I don't understand the addition to SimutransSourceList.cmake.

[EDIT]

MSVC

QuoteSchweregrad    Code    Beschreibung    Projekt    Datei    Zeile    Unterdrückungszustand
Fehler (aktiv)    E0427    Ein qualifizierter Name ist in einer Memberdeklaration nicht zulässig.    Simutrans GDI    ...\svn\simutrans_git\src\simutrans\simhalt.h    722   

Quote...\svn\simutrans_git\src\simutrans\simhalt.h(722,41): error C4596: "can_use_halt": Unzulässiger vollständig angegebener Name in Elementdeklaration

linux

Quotesrc/simutrans/builder/../simhalt.h:722:29: error: extra qualification on member 'can_use_halt'
  722 |         inline bool haltestelle_t::can_use_halt(const player_t* player) const
      |                     ~~~~~~~~~~~~~~~^
1 error generated.
Title: Re: Let other players stop at private halts (in a controlled way)
Post by: prissi on May 24, 2026, 12:21:54 PM
Sorry, benutzte nie cmake, tested only make and MSVC ... Thank you, fixed
Title: Re: Let other players stop at private halts (in a controlled way)
Post by: Nazalassa on May 24, 2026, 04:36:02 PM
When removing a halt tile, all connections are removed. Or rather, all connections that still stop at the halt are removed, and those that no longer do remain. Here's a fix.