News:

SimuTranslator
Make Simutrans speak your language.

River gradient speed limits seem to be broken

Started by jamespetts, January 06, 2023, 10:38:34 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jamespetts

I am posting this as I am away from my IDE and I need a reminder of this issue for when I am able to look into it.

It seems that the maximum speed for gradients for river types (which allowed the creation of unnavigable rapids and slow to navigate locks) is not working. As an example, at 953,1376 on the current Bridgewater-Brunel server game is a river tile that is shown as comprising rapids and should not be navigable (having a maximum speed of 0km/h in the .dat file) but boats in fact navigate it (although I note also that the locks at 932,1392 do appear to restrict speed correctly, so the problem may be confined to tiles with a 0km/h maximum speed - although this was progressing at 2km/h, so this may have been due to the steepness of the gradient rather than the maximum speed feature).
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.

Ranran(retired)

Quote from: jamespetts on January 06, 2023, 10:38:34 PMso the problem may be confined to tiles with a 0km/h maximum speed
in vehicle_t::calc_speed_limit()
const bool slope_specific_speed = w->get_desc()->get_topspeed_gradient_1() < w->get_desc()->get_topspeed() || w->get_desc()->get_topspeed_gradient_2() < w->get_desc()->get_topspeed();

const sint32 base_limit = desc->get_override_way_speed() && !(slope_specific_speed && is_slope) ? SINT32_MAX_VALUE : kmh_to_speed(w->get_max_speed(desc->get_engine_type()==vehicle_desc_t::electric));
I wonder if these are related.
I'm not familiar with this part of the code though.

Is it possible to see such speed constraints in the UI?
ひめしという日本人が開発者達の助言を無視して自分好みの機能をextendedに"強引に"実装し、
コードをぐちゃぐちゃにしてメンテナンスを困難にし(とりわけ道路と建物関連)、
挙句にバグを大量に埋め込み、それを知らんぷりして放置し(隠居するなどと言って)別のところに逃げ隠れて自分のフォーク(OTRP)は開発を続けている
その事実と彼の無責任さに日本人プレイヤーは目を向けるべき。らんらんはそれでやる気をなくした(´・ω・`)
他人の振り見て我が振り直せ。ひめしのようにならないために、らんらんが生み出したバグや問題は自分で修正しなくちゃね(´・ω・`)

jamespetts

Quote from: (N)Ranran (Hibernating) on January 06, 2023, 11:50:52 PMin vehicle_t::calc_speed_limit()
const bool slope_specific_speed = w->get_desc()->get_topspeed_gradient_1() < w->get_desc()->get_topspeed() || w->get_desc()->get_topspeed_gradient_2() < w->get_desc()->get_topspeed();

const sint32 base_limit = desc->get_override_way_speed() && !(slope_specific_speed && is_slope) ? SINT32_MAX_VALUE : kmh_to_speed(w->get_max_speed(desc->get_engine_type()==vehicle_desc_t::electric));
I wonder if these are related.
I'm not familiar with this part of the code though.

Is it possible to see such speed constraints in the UI?
I will have to look at the code in operation with a graphical debugger in some detail to be able to make sense of what is happening here. I know that it did work at one time - I am not sure what has changed. I think that this is probably the relevant part of the code, but I would need to check carefully to be sure.

As to the UI - I do not think that this is currently indicated in the UI. The visual indication is intended to be the appearance of rapids on unnavigable river gradients in otherwise navigable rivers. Ideally, one would have some indication in the information window, too. Currently, "(navigable)" and "(not navigable)" are appended as part of each river type's name, but this is potentially misleading on rapids - having a navigability display in the UI (i.e, whether the speed and weight limits are > 0, including, where the tile is a slope, the slope specific speed limits) would be preferable.
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.

jamespetts

I have now got home and I am having trouble reproducing this on a single player map, which is very odd.

Edit: Re-testing this, the issue seems to be that the feature works correctly on a Visual Studio debug build, but, very bizarrely, does not work on the GCC optimised build.

Edit 2: Further testing shows that the problem occurs in a game that has been loaded from a saved game.
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.

jamespetts

I believe that I have now fixed this - I should be grateful if anyone could confirm with to-morrow's nightly build.
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.