The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: Andarix on August 30, 2026, 07:43:22 PM

Title: r12233 (Sqirrel Script) - airport build
Post by: Andarix on August 30, 2026, 07:43:22 PM
r12233, but even earlier
pak64

When the script AI builds an airport, a graphical glitch occurs. It disappears after loading.

(https://files.simutrans-germany.com/upload/Screenshot_2026-08-30_213528.png)

(https://files.simutrans-germany.com/upload/Screenshot_2026-08-30_213606.png)

air_connector.nut#L153 (https://github.com/Andarix/simutrans-scenarios/blob/a7c7dc3702822379264219e6fb1ceac3feab0845/ai/sqai/air_connector.nut#L153)
          // build airport ways
          local taxiway = find_object("way", wt_air, 100, st_flat)
          local runway  = find_object("way", wt_air, 100, st_runway)
          // build airport c_start
          local err = command_x.build_way(our_player, start_airport[0], start_airport[5], taxiway, true)
          if ( err != null ) { return error_handler() }
          err = command_x.build_way(our_player, start_airport[1], start_airport[3], taxiway, true)
          if ( err != null ) { return error_handler() }
          err = command_x.build_way(our_player, start_airport[4], start_airport[6], runway, true)
          if ( err != null ) { return error_handler() }

          if ( print_message_box > 0 && print_message_box != 4 ) {
            gui.add_message_at(our_player, "build f_src", start_airport[0])
            //gui.add_message_at(our_player, "err " + err, world.get_time())
          }

          // build airport c_end
          err = command_x.build_way(our_player, end_airport[0], end_airport[5], taxiway, true)
          if ( err != null ) { return error_handler() }
          err = command_x.build_way(our_player, end_airport[2], end_airport[3], taxiway, true)
          if ( err != null ) { return error_handler() }
          err = command_x.build_way(our_player, end_airport[4], end_airport[6], runway, true)
          if ( err != null ) { return error_handler() }

          if ( print_message_box > 0 && print_message_box != 4 ) {
            gui.add_message_at(our_player, "build airport f_desc ", end_airport[0])
            //gui.add_message_at(our_player, "err " + err, world.get_time())
          }

Title: Re: r12233 (Sqirrel Script) - airport build
Post by: victor_18993 on August 30, 2026, 08:45:46 PM
I'll check it and let you know as soon as I've got it sorted, thanks for reporting it Andarix.
Title: Re: r12233 (Sqirrel Script) - airport build
Post by: victor_18993 on August 31, 2026, 10:03:07 AM
Thanks for the report, Andarix.

I was able to reproduce it and trace the cause. It was not specific to the AI script or to airports: the problem was in the generic
way_builder_t::build_track() overbuild path.

When an existing way was replaced with another descriptor, the graphic could still be calculated using the old descriptor and was not recalculated afterwards. This is why the affected tile looked wrong immediately after construction, while saving and reloading made it correct again.

I reproduced the same underlying issue with rail as well. Roads were already protected against the equivalent problem by an earlier fix.

The missing recalculation has now been added in r12240. I also reproduced the original visual symptom before the fix and confirmed that the same construction is rendered correctly immediately with r12240, without requiring a save/reload.

Thanks again — this report helped uncover an old generic issue in the way-building code.