News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

Artifacts in deleted fields

Started by Leartin, August 16, 2017, 10:44:03 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Leartin

Minor issue: When a factory with fields is deleted, the fields disappear. Fields that are not flat in the ground will reliably leave artifacts behind, I suppose only the tile height is marked dirty, not the graphic height.
Most easily seen in p128 forest plantation:

DrSuperGood

Looks like it is not marking the area of the second level Z image (as far as I understand it, it might have a different term) as dirty.

Ters

Unless this has changed recently, forest plantations don't have images with multiple heights.

Leartin

I don't think multiple heights for fields are even possible. It's just that in p128, a rectangle of 128x64 px is marked as dirty, rather than the full 128x128 px square. In p192c, it's 192x96px rather than 192x192px.
Since it occurs so rarely, not via 'normal' gameplay, and is fixed so easily by moving the map, it probably has the lowest possible priority to fix it.

Ters

Quote from: Leartin on August 17, 2017, 08:46:48 AM
I don't think multiple heights for fields are even possible.

I noticed the same thing after I posted. The data format/structure seems not to support it.

Quote from: Leartin on August 17, 2017, 08:46:48 AM
Since it occurs so rarely, not via 'normal' gameplay, and is fixed so easily by moving the map, it probably has the lowest possible priority to fix it.

On the other hand, it probably so trivial to fix that someone familiar with the code can fix it in ten seconds. So even if it has a low priority, it might have a high probability.

DrSuperGood

Fields are a type of ground. When they are removed, the ground is restored to normal. The bug is that fields do not mark their images as dirty before their destruction. The new ground is correctly marked as dirty, however that might not have the same dirty area as the field image, resulting in the pixel difference being retained.

The solution used is to mark the field image area as dirty on field destruction, assuring the entire field image area is redrawn. This must be done on top of marking the new ground image area as dirty as that might not be completely a subset of the field image area.

I am not sure if my solution is appropriate, but it does appear to work when testing. Check R8291 or later if it is fixed.