|
@@ -31,7 +31,7 @@ QString Project::getProjectTitle() {
|
31
|
31
|
Map* Project::loadMap(QString map_name) {
|
32
|
32
|
Map *map = new Map;
|
33
|
33
|
|
34
|
|
- map->name = map_name;
|
|
34
|
+ map->setName(map_name);
|
35
|
35
|
readMapHeader(map);
|
36
|
36
|
readMapAttributes(map);
|
37
|
37
|
getTilesets(map);
|
|
@@ -66,8 +66,13 @@ void Project::loadMapConnections(Map *map) {
|
66
|
66
|
Connection *connection = new Connection;
|
67
|
67
|
connection->direction = command.value(1);
|
68
|
68
|
connection->offset = command.value(2);
|
69
|
|
- connection->map_name = command.value(3);
|
70
|
|
- map->connections.append(connection);
|
|
69
|
+ QString mapConstant = command.value(3);
|
|
70
|
+ if (mapConstantsToMapNames.contains(mapConstant)) {
|
|
71
|
+ connection->map_name = mapConstantsToMapNames[mapConstant];
|
|
72
|
+ map->connections.append(connection);
|
|
73
|
+ } else {
|
|
74
|
+ qDebug() << QString("Failed to find connected map for map constant '%1'").arg(mapConstant);
|
|
75
|
+ }
|
71
|
76
|
}
|
72
|
77
|
}
|
73
|
78
|
}
|
|
@@ -515,6 +520,10 @@ void Project::readMapGroups() {
|
515
|
520
|
QStringList *list = groupedMaps->value(group);
|
516
|
521
|
list->append(params.value(j));
|
517
|
522
|
maps->append(params.value(j));
|
|
523
|
+
|
|
524
|
+ // Build the mapping between map constants and map names.
|
|
525
|
+ QString mapConstant = Map::mapConstantFromName(params.value(j));
|
|
526
|
+ mapConstantsToMapNames.insert(mapConstant, params.value(j));
|
518
|
527
|
}
|
519
|
528
|
}
|
520
|
529
|
}
|