The International Simutrans Forum

 

Author Topic: Artifacts in deleted fields  (Read 1995 times)

0 Members and 1 Guest are viewing this topic.

Offline Leartin at

  • Devotee
  • *
  • Posts: 1269
  • PAK-DEV P192C
  • Languages: DE, EN
Artifacts in deleted fields
« on: August 16, 2017, 10:44:03 PM »
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:

Offline DrSuperGood

  • Dev Team
  • Devotee
  • *
  • Posts: 2727
  • Languages: EN
Re: Artifacts in deleted fields
« Reply #1 on: August 16, 2017, 11:12:23 PM »
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.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5543
  • Languages: EN, NO
Re: Artifacts in deleted fields
« Reply #2 on: August 17, 2017, 07:23:45 AM »
Unless this has changed recently, forest plantations don't have images with multiple heights.

Offline Leartin at

  • Devotee
  • *
  • Posts: 1269
  • PAK-DEV P192C
  • Languages: DE, EN
Re: Artifacts in deleted fields
« Reply #3 on: August 17, 2017, 08:46:48 AM »
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.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5543
  • Languages: EN, NO
Re: Artifacts in deleted fields
« Reply #4 on: August 17, 2017, 10:38:44 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.

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.

Offline DrSuperGood

  • Dev Team
  • Devotee
  • *
  • Posts: 2727
  • Languages: EN
Re: Artifacts in deleted fields
« Reply #5 on: August 18, 2017, 02:39:39 AM »
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.