The International Simutrans Forum

Development => Scripting Scenarios and AI => Topic started by: Dwachs on November 22, 2025, 07:38:48 PM

Title: Please revert r11480
Post by: Dwachs on November 22, 2025, 07:38:48 PM
Please revert this change to api_command.cc:

https://github.com/simutrans/simutrans/commit/05e43dc342a290ef7f0bcc7daf07be335847b8a5

Reason: it will break scripts after map rotation. Scripts work internally with all coordinates as if the map was never rotated. Thats why I introduced special functions to transfer ribi and coord between squirrel and c++. The rotation parameter of build_station_rotation supplied by script will only be correct if current rotation of map == 0, the original implementation used ribi's, which were safe.

(Ok, I could do that myself, but then this hm_library needs to be fixed, which I would not like to do.)
Title: Re: Please revert r11480
Post by: Yona-TYT on November 23, 2025, 01:01:18 AM
@Dwachs Wow, it's been a long time! It's a pleasure to read you here again, greetings 👋  8)
Title: Re: Please revert r11480
Post by: Dwachs on November 23, 2025, 08:14:44 AM
To see that the current implementation does not work: generate a new map with many flat beaches and oil rigs, rotate once, let the AI run. There will be failure to build flat harbours.
Title: Re: Please revert r11480
Post by: prissi on November 23, 2025, 01:40:01 PM
Nice to read from you too.

And I see, this is a problem.

However, when constructing an asymmetric large extension building (or headquarter), a script would need to specify the orientation (which will be influenced by the current map orientation for a space site check). Thus, I think an layout should be able to be specified; however it must be rotated again in reverse according to the current map rotation.

Would that be acceptable to you too?
Title: Re: Please revert r11480
Post by: Dwachs on November 23, 2025, 07:28:07 PM
yes, something like this needs to be implemented. Will try next week. It needs an artificial datatype to get the conversion done correctly (similar to my_ribi_t).
Title: Re: Please revert r11480
Post by: prissi on November 24, 2025, 12:22:29 AM
Since you knew this better than me, I will happily wait for you then.