The International Simutrans Forum

Development => Bug Reports => Topic started by: Andarix on March 11, 2026, 09:36:43 PM

Title: r11892 (Sqirrel Script) - bridge build
Post by: Andarix on March 11, 2026, 09:36:43 PM
Quote from: Andarix on March 09, 2026, 03:50:52 PMI consider all this code unnecessary. It's perfectly sufficient to simply align the two bridge ends with the click positions.

I believe the current behavior is a bug. When I drag the bridge with the mouse, the coordinate doesn't jump to the mouse pointer (field 3) but back to field 1 (the river) one level higher.

bridge_drag.png

Quote from: Andarix on March 08, 2026, 06:07:35 PMThis seems suspicious to me.

If I click on the level field as a second click, then position 104,158,-1 is displayed, which is correct.

However, if I click on the slope field 103,158,-1, then position 105,158,0 is displayed. This is the field with the river one level higher. And that doesn't match the clicked field.

(https://forum.simutrans.com/index.php?action=dlattach;attach=35299)
Title: Re: r11892 (Sqirrel Script) - bridge build
Post by: prissi on March 11, 2026, 11:36:53 PM
A bug in simutrans? The coordinates for the mouse pointer should be the same as the ones in the lower right corner as these are the only ones the code uses. (When dragging a bridge there is a temporary bridge ground existing though.)
Title: Re: r11892 (Sqirrel Script) - bridge build
Post by: Andarix on March 12, 2026, 08:24:05 AM
If I move the mouse from the other side, the field above the river is returned for the slope field.


is_work_allowed_here() (https://doc.simutrans-germany.com/Simutrans-Squirrel-API/group__quick__return__func.html#ga4e79ca4788f47895ceedbd72d518bd0e)

The function description includes a note. It's possible that this behavior is what's meant by that note.
Quote...
Attention
Does not work with waybuilding and all tools that need path-finding, use the functions provided in rules in this case.
...

It's possible that the function `is_valid_pos() (https://doc.simutrans-germany.com/Simutrans-Squirrel-API/group__quick__return__func.html#gab439c7cd0533a77204c49910ec50851d)` can be used. However, I don't yet know how to use it.
Title: Re: r11892 (Sqirrel Script) - bridge build
Post by: prissi on March 12, 2026, 11:45:47 AM
During pathfinding, is_work_allowd_here() is called for all tiles of the path. So of course also for the bottom of the river and all tiles in between. (And for way building even more tiles.)

Excatly for this reason there is forbid_way_tool_rect()/allow_way_tool_rect() ...