diff options
author | Alexander Levin <al.le@rockbox.org> | 2009-04-03 20:35:24 +0000 |
---|---|---|
committer | Alexander Levin <al.le@rockbox.org> | 2009-04-03 20:35:24 +0000 |
commit | ed0ac675b04373a1d46426b2636c5ac584e471e7 (patch) | |
tree | b3a96f35bdfc28dd34a5160bb6135f77a4bb7438 /apps/plugins | |
parent | b549ce9193b6baead786d1a7b9bec9b9ac70ccc2 (diff) |
Rocklife: allow the cells file to have comment (everything on a line starting with a '!' is a comment). FS#10081, thanks to Justin Hannigan.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20611 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/rocklife.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/apps/plugins/rocklife.c b/apps/plugins/rocklife.c index 2905ab53e2..d67fc470a9 100644 --- a/apps/plugins/rocklife.c +++ b/apps/plugins/rocklife.c @@ -136,10 +136,12 @@ static bool load_cellfile(const char *file, char *pgrid){ char c; int nc, x, y, xmid, ymid; + bool comment; x=0; y=0; xmid = (GRID_W>>1) - 2; ymid = (GRID_H>>1) - 2; + comment = false; while (true) { nc = read(fd, &c, 1); @@ -147,17 +149,23 @@ static bool load_cellfile(const char *file, char *pgrid){ break; switch(c) { + case '!': + comment = true; case '.': - x++; + if (!comment) + x++; break; case 'O': - if (is_valid_cell(xmid + x, ymid + y)) - set_cell(xmid + x, ymid + y, pgrid); - x++; + if (!comment) { + if (is_valid_cell(xmid + x, ymid + y)) + set_cell(xmid + x, ymid + y, pgrid); + x++; + } break; case '\n': y++; x=0; + comment = false; break; default: break; |