The International Simutrans Forum

 

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

0 Members and 1 Guest are viewing this topic.

Offline THLeaderH jp

  • Coder/patcher
  • Devotee
  • *
  • Posts: 334
  • 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: 5542
  • 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: 9558
  • 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: 5542
  • 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: 9558
  • 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.