nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
friendz: grid save also non-metal tiles
[nit.git]
/
contrib
/
friendz
/
src
/
grid.nit
diff --git
a/contrib/friendz/src/grid.nit
b/contrib/friendz/src/grid.nit
index
a097ff5
..
3b4fad9
100644
(file)
--- a/
contrib/friendz/src/grid.nit
+++ b/
contrib/friendz/src/grid.nit
@@
-191,14
+191,14
@@
class Grid
fun save: String
do
var res = ""
fun save: String
do
var res = ""
- var str = ".#ABCDEFGHI"
+ var str = ".abcdefghi#ABCDEFGHI"
for y in [0..height[ do
var rle = 0
var last: nullable Int = null
for x in [0..width[ do
var t = self.grid[x][y]
for y in [0..height[ do
var rle = 0
var last: nullable Int = null
for x in [0..width[ do
var t = self.grid[x][y]
- var tk = 0
- if t.fixed then tk = t.kind + 1
+ var tk = t.kind
+ if t.fixed then tk += 10
if tk == last and rle<9 then
rle += 1
else
if tk == last and rle<9 then
rle += 1
else
@@
-243,6
+243,7
@@
class Grid
x += 1
else if c == '#' then
var t = self.get(x,y)
x += 1
else if c == '#' then
var t = self.get(x,y)
+ assert t != null
t.fixed = true
x += 1
else if c >= 'A' and c <= 'I' then
t.fixed = true
x += 1
else if c >= 'A' and c <= 'I' then
@@
-251,6
+252,11
@@
class Grid
t.update(c.ascii-'A'.ascii+1)
t.fixed = true
x += 1
t.update(c.ascii-'A'.ascii+1)
t.fixed = true
x += 1
+ else if c >= 'a' and c <= 'i' then
+ var t = self.get(x,y)
+ assert t != null
+ t.update(c.ascii-'a'.ascii+1)
+ x += 1
else if c >= '1' and c <= '9' then
rle = c.to_i
else
else if c >= '1' and c <= '9' then
rle = c.to_i
else