The International Simutrans Forum

Development => Technical Documentation => Topic started by: jamespetts on February 03, 2013, 09:31:25 PM

Title: How to check all tiles of an attraction?
Post by: jamespetts on February 03, 2013, 09:31:25 PM
I am currently working on private car routing (http://forum.simutrans.com/index.php?topic=9595.msg111562#msg111562) 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?
Title: Re: How to check all tiles of an attraction?
Post by: IgorEliezer on February 04, 2013, 11:08:31 PM
Post about "monuments being listed on attraction list" was split: http://forum.simutrans.com/index.php?topic=11420.0
Title: Re: How to check all tiles of an attraction?
Post by: jamespetts on February 05, 2013, 12:08:55 AM
Igor - thank you for organising the topics! I should be interested in any replies to the original post...
Title: Re: How to check all tiles of an attraction?
Post by: Dwachs on February 05, 2013, 07:02:12 AM
I am afraid that you have to loop over all adjacent tiles to find any roads.
Title: Re: How to check all tiles of an attraction?
Post by: prissi on February 05, 2013, 09:39:34 AM
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.
Title: Re: How to check all tiles of an attraction?
Post by: jamespetts on February 06, 2013, 12:09:28 AM
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?
Title: Re: How to check all tiles of an attraction?
Post by: Ters on February 06, 2013, 05:42:43 AM
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()
Title: Re: How to check all tiles of an attraction?
Post by: jamespetts on February 16, 2013, 12:33:02 AM
Thank you very much - have now managed to get this to work on my private-cars branch on Github. Much appreciated.