The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: gerw on March 01, 2009, 04:39:22 PM

Title: Passenger destinations in map
Post by: gerw on March 01, 2009, 04:39:22 PM
With this patch pax_ziele_neu/alt is saved as sparse array and you can display it in the map.

There is one problem remaining: Since the array is saved as sparse, everytime stadt_info_t::zeichnen is called, simutrans have to recalculate the color of the minimap. Maybe one should calc this colors and save it (as static?) is stadt_info_t (and update it every new month)? Any other suggestions?
Title: Re: Passenger destinations in map
Post by: Dwachs on March 01, 2009, 07:31:11 PM
Maybe you can use a the static instance

reliefkarte_t * reliefkarte_t::get_karte()

to obtain the colors of the pixels that are not stored in the sparse matrix?
Title: Re: Passenger destinations in map
Post by: gerw on March 02, 2009, 08:08:12 AM
But then you have to extract a 128x128 submatrix every time zeichnen() is called. Maybe saving this submatrix will be better?

Todo (just for me): Add access to the non-zero elements.
Title: Re: Passenger destinations in map
Post by: prissi on March 02, 2009, 09:56:37 AM
Well the dialoge can cache the map view and update only, when the sparse matrix has changed.
Title: Re: Passenger destinations in map
Post by: gerw on March 02, 2009, 10:20:08 AM
So call an update of the dialogue, whenever stadt_t::merke_passagier_ziel is called? This sounds reasonable.
Title: Re: Passenger destinations in map
Post by: prissi on March 02, 2009, 11:03:03 AM
Rather the dialoge will update its map whenever the sparse matrix has changed. SInce the old one never changes, this means already half work only ... Maybe even a flag resetted by the dialogue.
Title: Re: Passenger destinations in map
Post by: gerw on March 02, 2009, 04:21:58 PM
Then I would use a flag in the dialogue, which is set by merke_passagier_ziel. In my opinion, the matrix isn't the right place to save it.
Title: Re: Passenger destinations in map
Post by: gerw on March 02, 2009, 09:43:34 PM
New version. Now, the minimap in the city info will be recalculated only when a new month starts. In the map convois aren't draw in the passenger destinations mode, otherwise it is too confusing.

Also access to the nonzero elements is supported in the sparse template.