yairm210/Unciv

Air units no longer show attack and move range

jahodovykolac opened this issue · 10 comments

Is there an existing issue for this?

  • I have searched the existing issues

Game Version

4.11.9

Describe the bug

When selecting an air unit, tiles in attack and move range are no longer coloured, only the target marks are still present

Steps to Reproduce

See above

Screenshots

No response

Link to save file

No response

Operating System

Android

Additional Information

No response

Come on, help out... Screenshot (even better if you could dig up a before-after, but just the one would already be a help) and info on active mods if any would save time.

Already tried all of that... active mods none, even tried deleting a recent one (and yes, it happens on all tilesets), nothing, and about the screenshot...
Screenshot_20240501_141526_Unciv

It just isn't there, the red and blue covering. The description seems vague, but that's because there just isn't anything. If you didn't look in the bottom left corner, you wouldn't even notice I have a stealth bomber selected.

Also happening for me. Only mods I have are Community Maps and Vanilla Music Pack

Took me 20 minutes to get a test game to the point I could by air units. That's what attaching saved games is for.

But yes - the click handler does not trigger any overlays - question is, how did that work before??? A: because the overlays aren't handled there but in the next WorldScreen.update()... had to go back to PR3101 to see how it was done back then, then fulltext search for common elements as that code is completely gone. So it must be WorldMapHolder.updateTilesForSelectedUnit... Yup, they are painted, then at the end of updateTiles, zoom on the holder is called, which removes them right away. Well, the zoom call goes back to the year 2019. But the hideTerrainOverlay call is new: "Color lands by owner on max zoom out, for better overview"

So - not sure what that code is meant to achieve - I mean the title is clear but the "how" is not nor is the reason for the 'else' branch existing at all - and so I can't really fix that, because a partial revert opens "why" questions which I can't answer.

I can confirm, however, that...

Index: core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt b/core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt
--- a/core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt	(revision 5291c5b79a8df683d7be2acb12424fc57706eae9)
+++ b/core/src/com/unciv/ui/screens/worldscreen/WorldMapHolder.kt	(date 1714576821228)
@@ -917,9 +917,9 @@
                     tileGroup.layerMisc.overlayTerrain(color, 0.7f)
                 }
             }
-        else
-            for (tileGroup in tileGroups.values)
-                tileGroup.layerMisc.hideTerrainOverlay()
+//         else
+//             for (tileGroup in tileGroups.values)
+//                 tileGroup.layerMisc.hideTerrainOverlay()
 
         clampCityButtonSize()
     }
Index: core/src/com/unciv/ui/components/tilegroups/layers/TileLayerMisc.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/core/src/com/unciv/ui/components/tilegroups/layers/TileLayerMisc.kt b/core/src/com/unciv/ui/components/tilegroups/layers/TileLayerMisc.kt
--- a/core/src/com/unciv/ui/components/tilegroups/layers/TileLayerMisc.kt	(revision 5291c5b79a8df683d7be2acb12424fc57706eae9)
+++ b/core/src/com/unciv/ui/components/tilegroups/layers/TileLayerMisc.kt	(date 1714576177525)
@@ -14,6 +14,7 @@
 import com.unciv.ui.components.MiscArrowTypes
 import com.unciv.ui.components.TintedMapArrow
 import com.unciv.ui.components.UnitMovementMemoryType
+import com.unciv.ui.components.extensions.brighten
 import com.unciv.ui.components.extensions.center
 import com.unciv.ui.components.extensions.centerX
 import com.unciv.ui.components.extensions.toLabel
@@ -333,7 +334,7 @@
 
     /** Activates a colored semitransparent overlay. [color] is cloned, brightened by 0.3f and an alpha of 0.4f applied. */
     fun overlayTerrain(color: Color) {
-        terrainOverlay.color = color.cpy().lerp(Color.WHITE, 0.3f).apply { a = 0.4f }
+        terrainOverlay.color = color.brighten(0.3f).apply { a = 0.4f }
         terrainOverlay.isVisible = true
         determineVisibility()
     }

...brings the overlays back.

and about the screenshot

Yes, thanks, was meant in a pretty general way - you confirming that you tested with various mods or none and also changed tilesets already helped exclude more texture-side things. As in, idea, the Gdx elements are on the stage but not visible due to some quirk - which is something else entirely than 'they were painted and then some gremlin stole them microseconds later'...

Took me 20 minutes to get a test game to the point I could by air units. That's what attaching saved games is for.

I'm sorry, I was on mobile and would have to figure out how to create .txt file there (why, it's literally the simplest type of file, why can't they create one), or find something like pastebin which wouldn't require login for one paste... you can see why I try to avoid it, but I'll try to find a way for next time (good old times when you could just paste it here...)

'they were painted and then some gremlin stole them microseconds later'

Noooooo, not the paint stealing gremlins!

This change was to make the entire screen color according to borders, when on Mac zoom out
If it's causing problems you can just revert the entire PR and we'll rethink it

revert the entire PR

Well, the if (scaleX == minZoom) part seems fine, but only you know what intended effect might break if we remove the else part..

The colors will remain forever and that's not what we want on zoom in

The colors will remain forever

Would need to try and see - and where did I put that test save now??? Not here...