Skip to content

Commit

Permalink
fix: map json に base がない場合のエラー
Browse files Browse the repository at this point in the history
  • Loading branch information
teramotodaiki committed Aug 18, 2020
1 parent 84dc7b0 commit c4e47a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/hackforplay/create-compatible-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ export default function createCompatibleMap(
}
const fmapIndexes = tileIndexes.slice(0, minLevelOfFmap);
const bmapIndexes = tileIndexes.slice(minLevelOfFmap);
bmapIndexes.push(mapJson.base); // base タイルを一番下に描画する
if (typeof mapJson.base === 'number') {
bmapIndexes.push(mapJson.base); // base タイルを一番下に描画する
}
// 表示順(手前から奥) => 描画順(奥から手前)
fmapIndexes.reverse();
bmapIndexes.reverse();
Expand Down
1 change: 1 addition & 0 deletions test/helpers/create-map-json.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default function createMapJson() {
return {
base: 1000,
tables: [
[
[
Expand Down

0 comments on commit c4e47a7

Please sign in to comment.