News:

Do you need help?
Simutrans Wiki Manual can help you to play and extend Simutrans. In 9 languages.

r12233 (Sqirrel Script) - airport build

Started by Andarix, August 30, 2026, 07:43:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andarix

r12233, but even earlier
pak64

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





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())
          }


victor_18993

I'll check it and let you know as soon as I've got it sorted, thanks for reporting it Andarix.
En la vida todo son vivencias y cada una de ellas nos hace mas grandes,¿Como de grande eres tu? :)

victor_18993

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.
En la vida todo son vivencias y cada una de ellas nos hace mas grandes,¿Como de grande eres tu? :)