The International Simutrans Forum

 

Author Topic: [r8803] Station naming issue  (Read 1974 times)

0 Members and 1 Guest are viewing this topic.

Offline THLeaderH jp

  • Coder/patcher
  • Devotee
  • *
  • Posts: 340
  • Languages: JP,EN
[r8803] Station naming issue
« on: August 14, 2019, 04:41:28 AM »
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.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5593
  • Languages: EN, NO
Re: [r8803] Station naming issue
« Reply #1 on: August 14, 2019, 05:21:41 AM »
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.
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.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9709
  • Languages: De,EN,JP
Re: [r8803] Station naming issue
« Reply #2 on: August 17, 2019, 03:22:57 AM »
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.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5593
  • Languages: EN, NO
Re: [r8803] Station naming issue
« Reply #3 on: August 17, 2019, 07:11:46 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.

Offline danivenk

  • *
  • Posts: 96
  • Languages: EN, NL, JP
Re: [r8803] Station naming issue
« Reply #4 on: August 22, 2019, 03:53:40 PM »
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

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9709
  • Languages: De,EN,JP
Re: [r8803] Station naming issue
« Reply #5 on: August 23, 2019, 01:39:55 PM »
I just tested and I can rename stops. Are you sure that the name was not already on the map?

Offline danivenk

  • *
  • Posts: 96
  • Languages: EN, NL, JP
Re: [r8803] Station naming issue
« Reply #6 on: August 23, 2019, 02:58:46 PM »
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.

Offline THLeaderH jp

  • Coder/patcher
  • Devotee
  • *
  • Posts: 340
  • Languages: JP,EN
Re: [r8803] Station naming issue
« Reply #7 on: February 14, 2020, 07:08:18 AM »
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.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9709
  • Languages: De,EN,JP
Re: [r8803] Station naming issue
« Reply #8 on: February 14, 2020, 10:54:32 AM »
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.

Offline Phystam jp

  • *
  • Posts: 380
  • Pak256.Ex developer
    • Pak256 wiki page
  • Languages: JP, EN, EO
Re: [r8803] Station naming issue
« Reply #9 on: February 14, 2020, 03:17:08 PM »
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.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9709
  • Languages: De,EN,JP
Re: [r8803] Station naming issue
« Reply #10 on: February 15, 2020, 03:18:27 AM »
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.

Offline THLeaderH jp

  • Coder/patcher
  • Devotee
  • *
  • Posts: 340
  • Languages: JP,EN
Re: [r8803] Station naming issue
« Reply #11 on: February 15, 2020, 11:04:26 AM »
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.