Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

[BUG] minimap zoom level

Started by Sirius, May 16, 2020, 07:40:20 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


On stephenson-siemens, everything was all right due to the small map.
On bridgewater, however, the maximum zoom is still quite tiny and the minimum zoom will still show very much black around a tiny map.

I would rather expect a constant size of minimap pixels in specific zoom levels, either constant in on-screen pixles or constant in on-screen percents.


This is not a bug - this is how the minimap has always been. That it might benefit from some improvement is not the same as it being an actual bug.

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.


Could this be related with the minimap crash?,19882.0.html

Open small game, open minimap, zoom in, open big game, open minimap, crash because you tried to zoom in to unsupported level



I took a little look at this limitation, but I don't know much about it, so I need someone's perspective.
I found a comment in the code as to why zoom in is limited on large maps.

Is it difficult to mitigate zoom-in? (´・ω・`)
Basically, I only report bugs occasionally, never provide patches for new features.
I may only work on fixing bugs that are caused by Ranran.
Fork of simutrans extended for Jalápagos is here.


I had a look a the code and it's actually correct that your linked line forbids the game to zoom in further, to prevent an overflow in karte_to_screen.

karte_to_screen is quite straight forward: It takes a map koord and multiplies it by zoom_in and divides it by zoom_out. One of these two is always 1.
That will result in an overflow for sure, if koord * zoom_in is greater or equal to 2^15.
Later, that calculated screen koord will be offset according to maps viewport.

I see two possible solutions here:
1. Use an sint32 version of the screen koord.

2. Apply the offset before scaling to screen koord.
Applying an offset to coordinates before passing them karte_to_screen, so the top-left corner of current minimaps viewport is (0,0) will circumvent the overflow entirely.
That, however, requires reorganising the minimap drawing code.