News:

Simutrans Chat Room
Where cool people of Simutrans can meet up.

How to check all tiles of an attraction?

Started by jamespetts, February 03, 2013, 09:31:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jamespetts

I am currently working on private car routing for Experimental. I have it working for cities and factories, but not yet for tourist attractions. What I have found that I need to do to get acceptable performance is store nearby cities or connected factories in planquadrat_t or strasse_t tiles so that the program does not need to check iteratively for cities, industries and attractions at each step of the routing algorithm (this reduces execution speed by a factor of more than 10).

I am not quite sure how to do this for attractions, however, as they do not seem to store any co-ordinate/tile information in the way that cities and factories do. This must be accessible somewhere for the shape of attractions to be shown in outline on the minimap. May I ask - how might I go about iterating through all the tiles of an attraction to check whether there are any connected roads?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.


jamespetts

Igor - thank you for organising the topics! I should be interested in any replies to the original post...
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Dwachs

I am afraid that you have to loop over all adjacent tiles to find any roads.
Parsley, sage, rosemary, and maggikraut.

prissi

You could add a way list to planquadrat, like the halt list. But that will waste too much memory.

Make a subclass to building only for attractions, which contains a list of ways in their private parts.

jamespetts

It is not immediately obvious how I find a list of all an attraction's tiles in order to identify which roads are next to them in the first place (how to store that information being a separate issue). How would I go about identifying an attraction's tiles?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ters

Try looking at the remove tool. It would need to find all tiles in order to remove all parts of a building. There is also gebaeude_t::get_first_tile()

jamespetts

Thank you very much - have now managed to get this to work on my private-cars branch on Github. Much appreciated.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.