aboutsummaryrefslogtreecommitdiff
path: root/src/field.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/field.zig')
-rw-r--r--src/field.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/field.zig b/src/field.zig
index 0130848..03f9da3 100644
--- a/src/field.zig
+++ b/src/field.zig
@@ -69,6 +69,12 @@ const Line = struct {
if (x >= l.x and x < l.x + @intCast(i64, l.len())) return l.data.items[@intCast(usize, x - @intCast(i64, l.x))];
return ' ';
}
+ pub inline fn getData(l: *Line) std.ArrayList(i64) {
+ return l.data;
+ }
+ pub inline fn getX(l: *Line) i64 {
+ return l.x;
+ }
fn init(allocator: std.mem.Allocator) !*Line {
var l = try allocator.create(Line);
l.allocator = allocator;
@@ -244,6 +250,9 @@ pub const Field = struct {
if (y >= f.y and y < f.y + @intCast(i64, f.lines.items.len)) return f.lines.items[@intCast(usize, y - @intCast(i64, f.y))].get(x);
return ' ';
}
+ pub fn getLine(f: *Field, y: usize) *Line {
+ return f.lines.items[y];
+ }
pub fn getSize(f: Field) [4]i64 {
return [4]i64{ f.x, f.y, @intCast(i64, f.lx), @intCast(i64, f.lines.items.len) };
}