don't throw an error if no tile data is found
This commit is contained in:
parent
6c0e705005
commit
2134e4fe35
|
@ -124,17 +124,19 @@ $(document).ready(function() {
|
|||
|
||||
var tiles = input.match(/TIL (.*)\n([01]{8}\n){8}/g);
|
||||
|
||||
for (var i = 0; i < tiles.length; i++) {
|
||||
var name = tiles[i].match(/TIL .*/)[0].replace('TIL ', '');
|
||||
|
||||
tiles[i] = tiles[i].replace(/TIL .*\n/, '');
|
||||
if (tiles.length > 0) {
|
||||
for (var i = 0; i < tiles.length; i++) {
|
||||
var name = tiles[i].match(/TIL .*/)[0].replace('TIL ', '');
|
||||
|
||||
tiles[i] = tiles[i].replace(/TIL .*\n/, '');
|
||||
|
||||
var bitmap = tiles[i].match(/[01]/g);
|
||||
var bitmap = tiles[i].match(/[01]/g);
|
||||
|
||||
bitsyData.tiles[name] = {
|
||||
name: name,
|
||||
bitmap: _.chunk(bitmap, 8)
|
||||
};
|
||||
bitsyData.tiles[name] = {
|
||||
name: name,
|
||||
bitmap: _.chunk(bitmap, 8)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// set palette to first imported palette and redraw
|
||||
|
@ -282,6 +284,7 @@ $(document).ready(function() {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById('room-output').getContext('2d').putImageData(imageData, 0, 0);
|
||||
});
|
||||
}, 30);
|
||||
|
|
Loading…
Reference in New Issue