Fixed derp in gpu.set introduced with wide char checks (aka 'index out of bounds of doom').

This commit is contained in:
Florian Nücke 2014-07-21 20:36:14 +02:00
parent 3916a6a6ae
commit 5683d61435

View File

@ -128,7 +128,7 @@ class TextBuffer(var width: Int, var height: Int, initialFormat: PackedColor.Col
val c = s(x - col)
changed = changed || (line(bx) != c) || (lineColor(bx) != packed)
setChar(line, lineColor, bx, c)
bx += FontUtil.wcwidth(c)
bx += math.max(1, FontUtil.wcwidth(c))
}
changed
}
@ -147,7 +147,7 @@ class TextBuffer(var width: Int, var height: Int, initialFormat: PackedColor.Col
for (x <- bx until math.min(col + w, width) if bx < line.length) {
changed = changed || (line(bx) != c) || (lineColor(bx) != packed)
setChar(line, lineColor, bx, c)
bx += FontUtil.wcwidth(c)
bx += math.max(1, FontUtil.wcwidth(c))
}
}
changed