The International Simutrans Forum


Author Topic: Vehicles in the depot seem to ignore "is_in_depot ()"  (Read 502 times)

0 Members and 1 Guest are viewing this topic.

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1822
    • Simutrans-BLOG
  • Languages: ES
Vehicles in the depot seem to ignore "is_in_depot ()"
« on: January 30, 2021, 01:48:24 AM »
In the tutorial scenario I found a problem when counting vehicles outside the depot, something seems to have broken when the schedule window was updated.,20444.msg194610/topicseen.html#msg194610

It seems to be related to "is_work_allowed_here (pl, tool_id, pos)", since this happens when said function returns a message while editing the schedule.

This is how I count the vehicles:
Code: [Select]
function checks_all_convoys()
    local cov_list = world.get_convoy_list()
    local cov_nr = 0
    foreach(cov in cov_list) {
        if (!cov.is_in_depot())
    return cov_nr
To recreate use my attached test script and follow the steps below:
  • Build a depot and route a vehicle, make an intentional click on something that is not "way / track" to display the text "Message test".
  • Close the vehicle window and you will see that the vehicle is counted as if it left from the depot.
Note: I have left a vehicle counter in the scenario window right in the results.
« Last Edit: January 30, 2021, 02:11:37 AM by Yona-TYT »

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4944
  • Languages: EN, DE, AT
Re: Vehicles in the depot seem to ignore "is_in_depot ()"
« Reply #2 on: January 31, 2021, 10:10:48 AM »
This has nothing to do with the script. Thanks for your report.