Fix _export

This commit is contained in:
oc 2018-09-01 00:39:15 +08:00
parent ef816bce1f
commit 06a28348f9
2 changed files with 5 additions and 2 deletions

View File

@ -214,6 +214,9 @@ maps.prototype.load = function (data, floorId) {
////// 将当前地图重新变成二维数组形式 //////
maps.prototype.getMapArray = function (blockArray,width,height){
width=width||13;
height=height||13;
var blocks = [];
for (var x=0;x<height;x++) {
blocks[x]=[];
@ -222,7 +225,7 @@ maps.prototype.getMapArray = function (blockArray,width,height){
}
}
blockArray.forEach(function (block) {
if (!block.disable)
if (!block.disable && block.x<width && block.y<height)
blocks[block.y][block.x] = block.id;
});
return blocks;

View File

@ -693,7 +693,7 @@ utils.prototype._export = function (floorIds) {
// map
var content = floorIds.length+"\n13 13\n\n";
floorIds.forEach(function (floorId) {
var arr = core.maps.getMapArray(core.status.maps[floorId].blocks);
var arr = core.maps.getMapArray(core.status.maps[floorId].blocks, 13, 13);
content += arr.map(function (x) {
// check monster
x.forEach(function (t) {