|
@@ -517,13 +517,15 @@ void Project::readMapGroups() {
|
517
|
517
|
} else if (macro == ".4byte") {
|
518
|
518
|
if (group != -1) {
|
519
|
519
|
for (int j = 1; j < params.length(); j++) {
|
|
520
|
+ QString mapName = params.value(j);
|
520
|
521
|
QStringList *list = groupedMaps->value(group);
|
521
|
|
- list->append(params.value(j));
|
522
|
|
- maps->append(params.value(j));
|
|
522
|
+ list->append(mapName);
|
|
523
|
+ maps->append(mapName);
|
523
|
524
|
|
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));
|
|
525
|
+ // Build the mapping and reverse mapping between map constants and map names.
|
|
526
|
+ QString mapConstant = Map::mapConstantFromName(mapName);
|
|
527
|
+ mapConstantsToMapNames.insert(mapConstant, mapName);
|
|
528
|
+ mapNamesToMapConstants.insert(mapName, mapConstant);
|
527
|
529
|
}
|
528
|
530
|
}
|
529
|
531
|
}
|
|
@@ -855,10 +857,16 @@ void Project::readMapEvents(Map *map) {
|
855
|
857
|
warp->put("y", command.value(i++));
|
856
|
858
|
warp->put("elevation", command.value(i++));
|
857
|
859
|
warp->put("destination_warp", command.value(i++));
|
858
|
|
- warp->put("destination_map", command.value(i++));
|
859
|
860
|
|
860
|
|
- warp->put("event_type", "warp");
|
861
|
|
- map->events["warp"].append(warp);
|
|
861
|
+ // Ensure the warp destination map constant is valid before adding it to the warps.
|
|
862
|
+ QString mapConstant = command.value(i++);
|
|
863
|
+ if (mapConstantsToMapNames.contains(mapConstant)) {
|
|
864
|
+ warp->put("destination_map_name", mapConstantsToMapNames[mapConstant]);
|
|
865
|
+ warp->put("event_type", "warp");
|
|
866
|
+ map->events["warp"].append(warp);
|
|
867
|
+ } else {
|
|
868
|
+ qDebug() << QString("Destination map constant '%1' is invalid for warp").arg(mapConstant);
|
|
869
|
+ }
|
862
|
870
|
}
|
863
|
871
|
}
|
864
|
872
|
|