Fix crash when importing AdvanceMap metatiles

This commit is contained in:
GriffinR 2023-01-06 11:33:10 -05:00
parent 600af6dc72
commit 00a430d208
2 changed files with 9 additions and 0 deletions

View file

@ -17,6 +17,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
### Fixed
- Fix New Map settings being preserved when switching projects.
- Fix scripting API callback `onMapResized` not triggering.
- Fix crash when importing AdvanceMap metatiles while `enable_triple_layer_metatiles` is enabled.
## [5.0.0] - 2022-10-30
### Breaking Changes

View file

@ -78,6 +78,14 @@ QList<Metatile*> MetatileParser::parse(QString filepath, bool *error, bool prima
tiles.append(tile);
}
// AdvanceMap .bvd files only contain 8 tiles of data per metatile.
// If the user has triple-layer metatiles enabled we need to fill the remaining 4 tiles ourselves.
if (projectConfig.getTripleLayerMetatilesEnabled()) {
Tile tile = Tile();
for (int j = 0; j < 4; j++)
tiles.append(tile);
}
int attrOffset = 4 + (numMetatiles * metatileSize) + (i * attrSize);
uint32_t attributes = 0;
for (int j = 0; j < attrSize; j++)