diff options
author | Julien Dessaux | 2021-10-03 23:53:14 +0200 |
---|---|---|
committer | Julien Dessaux | 2021-10-03 23:53:14 +0200 |
commit | e80fe2790045cd25b6003888ddeb558ab4658b90 (patch) | |
tree | cf8dfc268295103240fa4d54704e73f7d11b86d6 /src | |
parent | Refactoring (diff) | |
download | nimfunge98-e80fe2790045cd25b6003888ddeb558ab4658b90.tar.gz nimfunge98-e80fe2790045cd25b6003888ddeb558ab4658b90.tar.bz2 nimfunge98-e80fe2790045cd25b6003888ddeb558ab4658b90.zip |
Refactoring
Diffstat (limited to '')
-rw-r--r-- | src/field.nim | 12 |
1 files changed, 6 insertions, 6 deletions
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.ly] return true -func set*(f: var Field, x, y, v: int) = +func Set*(f: var Field, x, y, v: int) = if v == int(' '): - f.blank(x, y) + f.Blank(x, y) elif y >= f.y: if y < f.y+f.ly: # the line exists var l = addr f.lines[y-f.y] |