mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-14 09:46:53 -04:00
Well that certainly was a fascinating derp to track down.
This commit is contained in:
parent
5964911a80
commit
7ab37217b0
@ -113,16 +113,21 @@ class TextBuffer(val host: EnvironmentHost) extends prefab.ManagedEnvironment wi
|
|||||||
// origin.
|
// origin.
|
||||||
val w = getViewportWidth
|
val w = getViewportWidth
|
||||||
val h = getViewportHeight
|
val h = getViewportHeight
|
||||||
relativeLitArea = (data.buffer, data.color).zipped.foldLeft(0) {
|
var acc = 0f
|
||||||
case (acc, (line, colors)) => acc + (line, colors).zipped.foldLeft(0) {
|
for (y <- 0 until h) {
|
||||||
case (acc2, (char, color)) =>
|
val line = data.buffer(y)
|
||||||
|
val colors = data.color(y)
|
||||||
|
for (x <- 0 until w) {
|
||||||
|
val char = line(x)
|
||||||
|
val color = colors(x)
|
||||||
val bg = PackedColor.unpackBackground(color, data.format)
|
val bg = PackedColor.unpackBackground(color, data.format)
|
||||||
val fg = PackedColor.unpackForeground(color, data.format)
|
val fg = PackedColor.unpackForeground(color, data.format)
|
||||||
acc2 + (if (char == ' ') if (bg == 0) 0 else 1
|
acc += (if (char == ' ') if (bg == 0) 0 else 1
|
||||||
else if (char == 0x2588) if (fg == 0) 0 else 1
|
else if (char == 0x2588) if (fg == 0) 0 else 1
|
||||||
else if (fg == 0 && bg == 0) 0 else 1)
|
else if (fg == 0 && bg == 0) 0 else 1)
|
||||||
}
|
}
|
||||||
} / (w * h).toDouble
|
}
|
||||||
|
relativeLitArea = acc / (w * h).toDouble
|
||||||
}
|
}
|
||||||
if (node != null) {
|
if (node != null) {
|
||||||
val hadPower = hasPower
|
val hadPower = hasPower
|
||||||
|
Loading…
x
Reference in New Issue
Block a user