News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

[BUG] Signalbox range view does not take account of meters_per_tile

Started by Matthew, January 19, 2020, 10:12:53 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Matthew

Ves kindly added a feature to display the range of signalboxes (using the $ key in pak128.Britain-Ex).

However, it appears to assume that meters_per_tile = 125. This is true for the Bridgewater-Brunel and Stephenson-Siemens games, but mpt is intended to be adjustable by players.

Steps to reproduce:
1. Copy your simuconf.tab to simutrans/addons/yourdesiredpakset/config/simuconf.tab
2. Change meters_per_tile to 235.
3. Start Sim-Ex with your desired pakset and addons loaded.
4. Start a new game in a year where there are signalboxes (1900+?).
5. Build a railway track and a signalbox.
6. Press $.
7. Try to build a stop signal just inside of the circle of black-and-yellow boxes. You will get an error message saying "Cannot build signal this far beyond any signalbox."
(Signature being tested) If you enjoy playing Simutrans, then you might also enjoy watching Japan Railway Journal
Available in English and simplified Chinese
如果您喜欢玩Simutrans的话,那么说不定就想看《日本铁路之旅》(英语也有简体中文字幕)。

Phystam

It seems working correctly. I checked it using pak256, which has meters_per_tile=25, but I cannot reproduce the problem.

Matthew

Quote from: Phystam on January 19, 2020, 10:37:07 AM
It seems working correctly. I checked it using pak256, which has meters_per_tile=25, but I cannot reproduce the problem.

Hmm. I have seen it on 156, 235, and 625m. So maybe it's only noticeable if mpt > 125 ??

EDIT:
I believe that I have found the bug and how to fix it, thanks to Phystam's comment. It appears to be simple enough that it would be a good learning exercise in C++ for Simutrans. However, I am wary of the Dunning-Kruger effect (ja), so I will try to post the relevant code here as a gobbet in the next few days.
(Signature being tested) If you enjoy playing Simutrans, then you might also enjoy watching Japan Railway Journal
Available in English and simplified Chinese
如果您喜欢玩Simutrans的话,那么说不定就想看《日本铁路之旅》(英语也有简体中文字幕)。

Ranran(retired)

I also tested it with pak128.britain-EX, but it seems to be working properly ...
Did the range display change after changing meters_per_tile? In my case it seems to be changing properly. That is, when meters_per_tile = 250, the size of the circle is halved.
ひめしという日本人が開発者達の助言を無視して自分好みの機能をextendedに"強引に"実装し、
コードをぐちゃぐちゃにしてメンテナンスを困難にし(とりわけ道路と建物関連)、
挙句にバグを大量に埋め込み、それを知らんぷりして放置し(隠居するなどと言って)別のところに逃げ隠れて自分のフォーク(OTRP)は開発を続けている
その事実と彼の無責任さに日本人プレイヤーは目を向けるべき。らんらんはそれでやる気をなくした(´・ω・`)
他人の振り見て我が振り直せ。ひめしのようにならないために、らんらんが生み出したバグや問題は自分で修正しなくちゃね(´・ω・`)

jamespetts

Thank you for the report. I should be grateful for the offered more information and suggestion on how this might be fixed. I should note that I generally recommend against meters per tile settings that do not translate to a integral number of tiles for 1km.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

The way I made the circle is in simplan.cc from line 673:

(gb = gebaeude = building, AKA the signalbox)


uint32 const radius = gb->get_tile()->get_desc()->get_radius();
uint16 const cov = radius / welt->get_settings().get_meters_per_tile();
if (shortest_distance(gb->get_pos().get_2d(), gr->get_pos().get_2d()) <= cov)
{
// Code that draws the cross and circle
}


Could it be an overflow from some of the uint's? Actually, I dont remember why those specific was used...