The International Simutrans Forum

 

Author Topic: [r8460] Auto-names of stops with coordinate > 16384  (Read 274 times)

0 Members and 1 Guest are viewing this topic.

Offline Antarctica

  • *
  • Posts: 27
  • Languages: DE, EN
[r8460] Auto-names of stops with coordinate > 16384
« on: May 25, 2018, 02:43:34 PM »
I have a map of size 20480 x 32.
I have a town hall "Bürstadt" in x = 16371-72, y = 14-15.
I have a town hall "Oestrich-Winkel" in x = 16399-16400, y = 16 -17
A stop built at x = 16403, y = 15 is named after Bürstadt, which is 32 tiles away, not after Oestrich-Winkel, which is 3 tiles away.
Many other stops built at x > 16371, y = 15 are also named after Bürstadt.

Since 16371 is near 16384, which is 2^14, is it possible that there is some overflow error during distance calculation?

« Last Edit: May 25, 2018, 02:54:54 PM by Antarctica »

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4533
  • Languages: EN, DE, AT
Re: [r8460] Auto-names of stops with coordinate > 16384
« Reply #1 on: May 25, 2018, 03:21:21 PM »
Yes, there was an overflow occuring. Coordinates are stored as 16bit signed integer. Adding two coordinates that large gives something negative... Should be fixed in r8461, There might be more such errors occurring on these long thin maps.

Offline Antarctica

  • *
  • Posts: 27
  • Languages: DE, EN
Re: [r8460] Auto-names of stops with coordinate > 16384
« Reply #2 on: May 25, 2018, 03:47:08 PM »
Thank you. I will continue building and report any issues I stumble upon.