From e80fe2790045cd25b6003888ddeb558ab4658b90 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sun, 3 Oct 2021 23:53:14 +0200 Subject: Refactoring --- src/field.nim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/field.nim b/src/field.nim index 1cd1874..e7280f8 100644 --- a/src/field.nim +++ b/src/field.nim @@ -8,7 +8,7 @@ type lx, ly: int lines: seq[Line] -func blank*(f: var Field, x, y: int) = +func Blank*(f: var Field, x, y: int) = if y < f.y or y >= f.y+f.ly: # outside the field return var l = addr f.lines[y-f.y] @@ -59,17 +59,17 @@ func blank*(f: var Field, x, y: int) = x2 = f.lines[i].x + f.lines[i].l f.lx = x2-f.x -func get*(f: Field, x, y: int): int = +func Get*(f: Field, x, y: int): int = if y >= f.y and y < f.y+f.ly: let l = f.lines[y-f.y] if x >= l.x and x < l.x+l.l: return l.columns[x-l.x] return int(' ') -func isIn*(f: Field, x, y: int): bool = +func IsIn*(f: Field, x, y: int): bool = return x >= f.x and y >= f.y and x < f.x+f.lx and y < f.y+f.ly -proc load*(f: var Field, filename: string): bool = +proc Load*(f: var Field, filename: string): bool = var file: File if not open(file, filename): return false @@ -132,9 +132,9 @@ proc load*(f: var Field, filename: string): bool = f.lines = f.lines[0..= f.y: if y < f.y+f.ly: # the line exists var l = addr f.lines[y-f.y] -- cgit v1.2.3