News:

SimuTranslator
Make Simutrans speak your language.

get_halt_list () in cities

Started by Yona-TYT, May 24, 2020, 04:08:48 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yona-TYT


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.


Dwachs

There is nothing like this. You have to iterate the tiles within city borders and look for halts with square_x.get_player_halt.
Parsley, sage, rosemary, and maggikraut.

Yona-TYT

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

prissi

You can iterate over the city buildings, there is already a list you can use.

Yona-TYT

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.

Dwachs

Parsley, sage, rosemary, and maggikraut.

prissi

No, but each tile with a citybuilding should hold the list of connected stops.