Small canvas read/write fixes (#10955)

This commit is contained in:
Cardillan
2025-06-21 21:20:43 -04:00
committed by GitHub
parent d6ee68a371
commit 289889a685
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -615,7 +615,7 @@ public class LExecutor{
toVar.isobj = value.isobj; toVar.isobj = value.isobj;
} }
}else if(from instanceof CanvasBuild canvas && (exec.privileged || (from.team == exec.team))){ }else if(from instanceof CanvasBuild canvas && (exec.privileged || (from.team == exec.team))){
canvas.setPixel(address, (int)(value.numval)); canvas.setPixel(address, value.numi());
} }
} }
} }
@@ -167,11 +167,11 @@ public class CanvasBlock extends Block{
} }
} }
public int getPixel(int pos){ public double getPixel(int pos){
if(pos >= 0 && pos < canvasSize * canvasSize){ if(pos >= 0 && pos < canvasSize * canvasSize){
return getByte(data, pos * bitsPerPixel); return getByte(data, pos * bitsPerPixel);
} }
return 0; return Double.NaN;
} }
public int getPixel(int x, int y){ public int getPixel(int x, int y){