Skip to content

Commit

Permalink
Fix issue preventing build when a scene includes a common tileset tha…
Browse files Browse the repository at this point in the history
…t has been deleted
  • Loading branch information
chrismaltby committed Sep 15, 2024
1 parent 39140a8 commit 9d4bfca
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix issue preventing building projects containing a "Play Music" event but no music
- Fix issue where dialogue script events could cause horizontal scroll bars to appear in script editor when column was not wide enough to display all tabs
- Fix issue where errors causing the build process to end early where not being display correctly in the Build Log
- Fix issue preventing build when a scene includes a common tileset that has been deleted

## [4.1.2] - 2024-09-09

Expand Down
17 changes: 16 additions & 1 deletion src/lib/compiler/compileData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -967,11 +967,26 @@ export const precompileScenes = (
}
) => {
const scenesData: PrecompiledScene[] = scenes.map((scene, sceneIndex) => {
const background = usedBackgrounds.find(
const backgroundWithCommonTileset = usedBackgrounds.find(
(background) =>
background.id === scene.backgroundId &&
(!scene.tilesetId || background.commonTilesetId === scene.tilesetId)
);

if (!backgroundWithCommonTileset) {
warnings(
`Scene #${sceneIndex + 1} ${
scene.name ? `'${scene.name}'` : ""
} includes a common tileset that can't be located.`
);
}

const background =
backgroundWithCommonTileset ??
usedBackgrounds.find(
(background) => background.id === scene.backgroundId
);

if (!background) {
throw new Error(
`Scene #${sceneIndex + 1} ${
Expand Down

0 comments on commit 9d4bfca

Please sign in to comment.