News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

[r8803] Station naming issue

Started by THLeaderH, August 14, 2019, 04:41:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

THLeaderH

I built these three stations subsequently and found that the given names were same like the image below.

Then, I saved the game and reloaded. And the name of the stations are changed though I didn't do that.


I briefly did printf debug to inspect what happend inside. When the station was built, haltestelle_t::create_name() returned the name "CITY branch station" for all these three stations. And, haltestelle_t::finish_rd() modified station names since other stations had the same name.

So, we have a two discussion here.

  • Why may haltestelle_t::create_name() return a name that already exists? Further investigations are needed to make it clear.
  • Why does haltestelle_t::finish_rd() change station names without notifying players? In my opinion, simutrans should warn players if they named a station an already existing name, and should not change station names when it loads a game.

Ters

Quote from: THLeaderH on August 14, 2019, 04:41:28 AMWhy does haltestelle_t::finish_rd() change station names without notifying players? In my opinion, simutrans should warn players if they named a station an already existing name, and should not change station names when it loads a game.
Maybe it was thought when implementing that function that duplicate stations names were illegal. Maybe it even was illegal at the time, but the requirement has been relaxed elsewhere later. Therefore, Simutrans thinks it must change the name. The lack of warning might be because the developer didn't really expect the code to actually be run, but just a last line of defense against crashing.

prissi

char* haltestelle_t::create_name should not return identical names. The routine really tries a lot of more stuff, including numbered stations before giving a similar name. Especially since finish_rd uses create_name if it encounter identical names which was a big issue before the current system was introduced. (And when optimisation finally allowed for large maps and people wanted to know which "Oil well station" is actually overcrowded.) Unless you extend an old game, or did something deliberately to confuse players (in networkgames) the case shoudl simply not occur, since the original names was made from create_name anyway.

The only thing that could happen that "%s lang %d %s" is translated to "%s branch %*d %s", i.e. ignoring the number. Then create_name can indeed make identical names, when all other options are exhausted before. But I get "land stop 1 station" and "land stop 2 station" and so on.

Ters

Quote from: prissi on August 17, 2019, 03:22:57 AM"%s branch %*d %s"
I think that needs to be "%s branch %*s", or it would consume more arguments than given. Otherwise a quite creative way to get create_name to return identical names.

danivenk

As a bug I've found has to do with the naming of stations/stops I will post it here.

For some stops on my map I've found out that if the world is closed and reopened, name rollbacks to the name it was first given when placed...
I think this has something to do with what is talked about here...

video proof: https://www.dropbox.com/s/qbsbx3whyujbq4l/Simutrans%20120.4.1%20Nightly%20-%20r8803%20%20OTRP%20v22.3%202019_08_22%2017_41_34.mp4?dl=0

In this video: I renamed all stops, saved and reopened the map... After which the renaming was not successful...
I hope this can be fixed

prissi

I just tested and I can rename stops. Are you sure that the name was not already on the map?

danivenk

Excuse me, I see now that they indeed already existed...
Sorry for that, but I do think (just as @THLeaderH) that there should be a warning if the stop name already existed and maybe show the coordinates of the already existing one...

Sorry for the inconvenience.

THLeaderH

Sorry for digging up this old topic.

Still I have not made it clear why even a unique station name was sometimes renamed to another name when Simutrans loads the game. I found that there are no code to reset the state of haltestelle_t::all_names in simhalt.cc.

Anyway, is there any practical reason to preserve the renaming process in haltestelle_t::finish_rd()?
The current simutrans code should work fine with duplicated station names. IMO, renaming station names without any alert results confusion of players and makes no benefit.

I commented out simhalt.cc:L2917-2939 in my repository and had some Japanese players test this. They reported that this modification seemed to suppress unexpected station renaming which happens in a game loading. Furthermore, they said that this reduced disconnection of a network game.

Therefore, I think the station renaming process is obsolete and should be removed. Removing simhalt.cc:L2917-2939 would be enough.

prissi

The station should not get identical names in the first places. The renaming was put there following various complaints about network games. For network games it caused a lot of confusion when a message said station xzy is public-overcrowded etc. and it involved a long search which of those were to blame.

Phystam

But there's no reason to rename a unique station name. I changed the default station name which is named by create_name() to a unique name. When reloading, however, it was accidentally re-renamed by that routine, although the name is already unique. I felt a lot of confusion about that and I had to re-re-rename again. And I fought against re-re-re-...-rename issues for a long time.

prissi

Unique names are not renamed. If that would happen, then it would be an error. But the routine would be only triggered on identical names. I cannot see how it would be triggered otherwise.

THLeaderH

The possible cause of the renaming of unique names is that there is no code to reset the state of haltestelle_t::all_names, although it is not easy to confirm it because the phenomenon sometimes happens, not always.