From 011713cd25e975be4e73b9f03b1ca414831c7c8d Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 28 Dec 2025 20:46:17 -0500 Subject: [PATCH] Minor fixes for markers and empty floor edges --- core/src/mindustry/game/MapObjectives.java | 18 +++++++----------- .../world/blocks/environment/EmptyFloor.java | 1 + .../world/blocks/logic/CanvasBlock.java | 15 +++++++++------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/core/src/mindustry/game/MapObjectives.java b/core/src/mindustry/game/MapObjectives.java index 7cbd9612de..0dfcc8ddb8 100644 --- a/core/src/mindustry/game/MapObjectives.java +++ b/core/src/mindustry/game/MapObjectives.java @@ -10,7 +10,6 @@ import arc.math.geom.*; import arc.scene.ui.layout.*; import arc.struct.*; import arc.util.*; -import arc.util.io.*; import arc.util.serialization.*; import arc.util.serialization.Json.*; import mindustry.*; @@ -27,9 +26,7 @@ import mindustry.world.*; import mindustry.world.blocks.logic.CanvasBlock.*; import mindustry.world.blocks.logic.LogicDisplay.*; -import java.io.*; import java.lang.annotation.*; -import java.nio.*; import java.util.*; import static java.lang.annotation.ElementType.*; @@ -1333,29 +1330,28 @@ public class MapObjectives implements Iterable, Eachable { if(build.data.length == bytes.length){ System.arraycopy(bytes, 0, build.data, 0, bytes.length); + build.invalidated = true; build.updateTexture(); } }); @@ -149,19 +150,19 @@ public class CanvasBlock extends Block{ public @Nullable Texture texture; public byte[] data = new byte[Mathf.ceil(canvasSize * canvasSize * bitsPerPixel / 8f)]; public int blending; - public boolean updated = false; + protected boolean invalidated = false; public void setPixel(int pos, int index){ if(pos < canvasSize * canvasSize && pos >= 0 && index >= 0 && index < palette.length){ setByte(data, pos * bitsPerPixel, index); - updated = true; + invalidated = true; } } public void setPixel(int x, int y, int index){ if(x >= 0 && y >= 0 && x < canvasSize && y < canvasSize && index >= 0 && index < palette.length){ setByte(data, (y * canvasSize + x) * bitsPerPixel, index); - updated = true; + invalidated = true; } } @@ -180,7 +181,7 @@ public class CanvasBlock extends Block{ } public void updateTexture(){ - if(headless) return; + if(headless || (texture != null && !invalidated)) return; Pixmap pix = makePixmap(data, previewPixmap); if(texture != null){ @@ -188,6 +189,8 @@ public class CanvasBlock extends Block{ }else{ texture = new Texture(pix); } + + invalidated = false; } public byte[] packPixmap(Pixmap pixmap){ @@ -260,10 +263,10 @@ public class CanvasBlock extends Block{ super.draw(); } - if(texture == null || updated){ - updated = false; + if(texture == null || invalidated){ updateTexture(); } + Tmp.tr1.set(texture); float pad = blending == 0 ? padding : 0f;