The International Simutrans Forum

Development => Scripting Scenarios and AI => Topic started by: Yona-TYT on May 24, 2020, 04:08:48 PM

Title: get_halt_list () in cities
Post by: Yona-TYT on May 24, 2020, 04:08:48 PM

I need to get a list of the stations in a city for a specific player, something like "city_x.get_halt_list (player_x ())", can this be possible?.  ???

Currently he is working on the final chapter of the tutorial concerning aircraft, and do not get a simple way to get the list of stations in a big city.
Title: Re: get_halt_list () in cities
Post by: Andarix on May 24, 2020, 04:40:31 PM
for halts on player see here (https://www.simutrans-forum.de/mybb/showthread.php?tid=9261&pid=117785#pid117785)

for city city_x building_x::get_city() (http://dwachs.github.io/simutrans-sqapi-doc/classbuilding__x.html#a35567180f7d2df577bcde4397863ad46)
Title: Re: get_halt_list () in cities
Post by: Dwachs on May 24, 2020, 06:28:36 PM
There is nothing like this. You have to iterate the tiles within city borders and look for halts with square_x.get_player_halt.
Title: Re: get_halt_list () in cities
Post by: Yona-TYT on May 24, 2020, 08:24:52 PM
Quote from: Dwachs on May 24, 2020, 06:28:36 PMThere is nothing like this. You have to iterate the tiles within city borders and look for halts with square_x.get_player_halt.
This was exactly what he wanted to avoid hehehe.  :P
Title: Re: get_halt_list () in cities
Post by: prissi on May 25, 2020, 01:43:28 PM
You can iterate over the city buildings, there is already a list you can use.
Title: Re: get_halt_list () in cities
Post by: Yona-TYT on May 25, 2020, 04:41:43 PM
Quote from: prissi on May 25, 2020, 01:43:28 PM
You can iterate over the city buildings, there is already a list you can use.
Does that mean that the stops / stations are like city buildings, therefore they are on the same list? ... I would have to try.
Title: Re: get_halt_list () in cities
Post by: Dwachs on May 26, 2020, 06:11:34 AM
No.
Title: Re: get_halt_list () in cities
Post by: prissi on May 26, 2020, 01:08:21 PM
No, but each tile with a citybuilding should hold the list of connected stops.