The International Simutrans Forum

Simutrans Extended => Simutrans-Extended bug reports => Simutrans-Extended development => Simutrans-Extended closed bug reports => Topic started by: Ranran(Hibernating) on February 01, 2021, 01:04:19 PM

Title: [Bug] Regions do not support camera rotation
Post by: Ranran(Hibernating) on February 01, 2021, 01:04:19 PM
The previously reported bug was a problem that the region information was "lost" when the camera was rotated, but this bug is different. (´・ω・`)

There are four camera angles, but only the default angle can display the correct region information. If you change to another direction, all regions will be replaced with default regions.
The region state is restored when the camera position returns to the initial state after rotating 4 times.

EDIT:
I've investigated this a bit, but the regional rotation algorithm is completely broken.

The coordinates of the regions before the map rotation in demo.sve are as follows.

Albion (0,0)-(256,256)
Northumberland (0,0)-(256,128)
Caledonia (0,0)-(256,64)
Cambria (0,89)-(64,166)
Kernow (0,166)-(51,256)
Erin (0,0)-(64,89)


The coordinates of each region according to the debug output when rotated once are as follows.


Albion (512,0)-(256,256)
Northumberland (512,0)-(384,256)
Caledonia (512,0)-(448,256)
Cambria (423,0)-(346,64)
Kernow (346,0)-(256,51)
Erin (512,0)-(423,64)


It should be noted that these coordinates represent the upper left and lower right.
The demo map is an elongated map with a width of only 31 tiles, but the region area is much wider than that.
32 or more of the x coordinate is outside the map area. That is, all regions are outside the map.
For example, Erin is the upper left area of the map and must contain (0,0)-(31,64) after rotation.
Title: Re: [Bug] Regions do not support camera rotation
Post by: Ranran(Hibernating) on June 23, 2021, 05:28:10 PM
I think I'm fortunate enough to have successfully fixed this bug.
I would appreciate it if you could check it.
https://github.com/Ranran-the-JuicyPork/simutrans-extended/tree/fix-region-rotation

EDIT:
However, if you have already rotated the map and the region information is corrupted, it will not be repaired automatically.
Title: Re: [Bug] Regions do not support camera rotation
Post by: jamespetts on June 26, 2021, 12:55:59 PM
Thank you - now incorporated.