mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-13 01:10:19 -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.
|
||||
val w = getViewportWidth
|
||||
val h = getViewportHeight
|
||||
relativeLitArea = (data.buffer, data.color).zipped.foldLeft(0) {
|
||||
case (acc, (line, colors)) => acc + (line, colors).zipped.foldLeft(0) {
|
||||
case (acc2, (char, color)) =>
|
||||
var acc = 0f
|
||||
for (y <- 0 until h) {
|
||||
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 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 (fg == 0 && bg == 0) 0 else 1)
|
||||
}
|
||||
} / (w * h).toDouble
|
||||
}
|
||||
relativeLitArea = acc / (w * h).toDouble
|
||||
}
|
||||
if (node != null) {
|
||||
val hadPower = hasPower
|
||||
|
Loading…
x
Reference in New Issue
Block a user