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
This commit is contained in:
Alexander Levin 2009-04-03 20:35:24 +00:00
parent b549ce9193
commit ed0ac675b0

View file

@ -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;