diff --git a/mainwindow.ui b/mainwindow.ui
index 936ccaf2..36600ee5 100755
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -115,19 +115,19 @@
- 0
+ 3
- 0
+ 3
- 0
+ 3
- 0
+ 3
- 0
+ 6
-
@@ -379,7 +379,7 @@
0
0
469
- 620
+ 608
@@ -490,16 +490,16 @@
- 0
+ 3
- 0
+ 3
- 0
+ 3
- 0
+ 3
-
@@ -533,19 +533,19 @@
- 0
+ 3
- 0
+ 3
- 0
+ 3
- 0
+ 3
- 0
+ 3
-
@@ -605,100 +605,6 @@
- -
-
-
-
- 0
- 0
-
-
-
- QFrame::NoFrame
-
-
- QFrame::Raised
-
-
-
- 6
-
-
- QLayout::SetDefaultConstraint
-
-
-
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Border
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 48
-
-
-
- <html><head/><body><p>The border is a 2x2 metatile which is repeated outside of the map layout's boundary. Draw on this border area to modify it.</p></body></html>
-
-
- QFrame::StyledPanel
-
-
- QFrame::Sunken
-
-
- Qt::ScrollBarAsNeeded
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Expanding
-
-
-
- 40
- 20
-
-
-
-
-
-
-
-
@@ -727,110 +633,136 @@
- 6
+ 0
QLayout::SetDefaultConstraint
+
+ 0
+
- 2
+ 0
+
+
+ 0
- 2
+ 0
-
-
-
-
- 0
- 0
-
-
-
+
+
Selection
-
-
- -
-
-
- true
-
-
-
-
- 0
- 0
- 275
- 86
-
+
+
+ 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 16777215
- 16777215
-
-
-
- Qt::ScrollBarAlwaysOff
-
-
- Qt::ScrollBarAlwaysOff
-
-
- true
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+ QFrame::NoFrame
+
+
+ QFrame::Plain
+
+
+ true
+
+
+
+
+ 0
+ 0
+ 324
+ 77
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+ Qt::ScrollBarAlwaysOff
+
+
+ Qt::ScrollBarAlwaysOff
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
+
+
+
@@ -867,8 +799,8 @@
0
0
- 325
- 405
+ 307
+ 387
@@ -893,6 +825,9 @@
0
+
+ 0
+
-
@@ -958,6 +893,84 @@
+ -
+
+
+ Border
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 48
+
+
+
+ <html><head/><body><p>The border is a 2x2 metatile which is repeated outside of the map layout's boundary. Draw on this border area to modify it.</p></body></html>
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Sunken
+
+
+ Qt::ScrollBarAsNeeded
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
@@ -1205,6 +1218,18 @@
+
+ 3
+
+
+ 3
+
+
+ 3
+
+
+ 3
+
-
@@ -1269,8 +1294,8 @@
0
0
- 420
- 584
+ 432
+ 596
@@ -1385,6 +1410,12 @@
-
+
+
+ 0
+ 0
+
+
Open Map Scripts
@@ -1393,19 +1424,6 @@
- -
-
-
- Qt::Horizontal
-
-
-
- 20
- 20
-
-
-
-
@@ -1708,7 +1726,7 @@
Qt::Horizontal
- QSizePolicy::Maximum
+ QSizePolicy::Expanding
@@ -1730,26 +1748,13 @@
<html><head/><body><p>If enabled, connections will automatically be updated on the connected map.</p></body></html>
- Mirror
+ Mirror to Connecting Maps
true
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
@@ -1773,9 +1778,9 @@
QFrame::Raised
-
+
- 4
+ 6
4
@@ -1789,49 +1794,6 @@
4
- -
-
-
- <html><head/><body><p>The direction of the connection.</p></body></html>
-
-
-
-
- up
-
-
- -
-
- right
-
-
- -
-
- down
-
-
- -
-
- left
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 20
- 20
-
-
-
-
-
@@ -1869,6 +1831,33 @@
+ -
+
+
+ <html><head/><body><p>The direction of the connection.</p></body></html>
+
+
-
+
+ up
+
+
+ -
+
+ right
+
+
+ -
+
+ down
+
+
+ -
+
+ left
+
+
+
+
-
diff --git a/project.cpp b/project.cpp
index 06190b8b..b3b625ba 100755
--- a/project.cpp
+++ b/project.cpp
@@ -835,7 +835,13 @@ void Project::loadTilesetAssets(Tileset* tileset) {
//qDebug() << metatile_attrs_path;
if (attrs_file.open(QIODevice::ReadOnly)) {
QByteArray data = attrs_file.readAll();
- int num_metatiles = data.length() / 2;
+ int num_metatiles = tileset->metatiles->count();
+ int num_metatileAttrs = data.length() / 2;
+ if (num_metatiles != num_metatileAttrs) {
+ qDebug() << QString("Metatile count %1 does not match metatile attribute count %2").arg(num_metatiles).arg(num_metatileAttrs);
+ if (num_metatiles > num_metatileAttrs)
+ num_metatiles = num_metatileAttrs;
+ }
for (int i = 0; i < num_metatiles; i++) {
uint16_t word = data[i*2] & 0xff;
word += (data[i*2 + 1] & 0xff) << 8;
@@ -1092,7 +1098,7 @@ QMap Project::getTilesets() {
// Advance to command specifying whether or not it is a secondary tileset
i += 2;
if (commands->at(i).at(0) != ".byte") {
- qDebug() << "Unexpected command found for secondary tileset flag. Expected '.byte', but found: " << commands->at(i).at(0);
+ qDebug() << "Unexpected command found for secondary tileset flag in tileset" << tilesetLabel << ". Expected '.byte', but found: " << commands->at(i).at(0);
continue;
}