News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

Passenger destinations in map

Started by gerw, March 01, 2009, 04:39:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gerw

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?

Dwachs

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?
Parsley, sage, rosemary, and maggikraut.

gerw

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.

prissi

Well the dialoge can cache the map view and update only, when the sparse matrix has changed.

gerw

So call an update of the dialogue, whenever stadt_t::merke_passagier_ziel is called? This sounds reasonable.

prissi

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.

gerw

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.

gerw

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.