|
@@ -210,6 +210,30 @@ void Project::saveMapHeader(Map *map) {
|
210
|
210
|
saveTextFile(header_path, text);
|
211
|
211
|
}
|
212
|
212
|
|
|
213
|
+void Project::saveMapConnections(Map *map) {
|
|
214
|
+ QString connections_path = root + "/data/maps/" + map->name + "/connections.inc";
|
|
215
|
+ QString connectionsListLabel = QString("%1_MapConnectionsList").arg(map->name);
|
|
216
|
+ int numValidConnections = 0;
|
|
217
|
+ QString text = "";
|
|
218
|
+ text += QString("%1::\n").arg(connectionsListLabel);
|
|
219
|
+ for (Connection* connection : map->connections) {
|
|
220
|
+ if (mapNamesToMapConstants->contains(connection->map_name)) {
|
|
221
|
+ text += QString("\tconnection %1, %2, %3\n")
|
|
222
|
+ .arg(connection->direction)
|
|
223
|
+ .arg(connection->offset)
|
|
224
|
+ .arg(mapNamesToMapConstants->value(connection->map_name));
|
|
225
|
+ numValidConnections++;
|
|
226
|
+ } else {
|
|
227
|
+ qDebug() << QString("Failed to write map connection. %1 not a valid map name").arg(connection->map_name);
|
|
228
|
+ }
|
|
229
|
+ }
|
|
230
|
+ text += QString("\n");
|
|
231
|
+ text += QString("%1::\n").arg(map->connections_label);
|
|
232
|
+ text += QString("\t.4byte %1\n").arg(numValidConnections);
|
|
233
|
+ text += QString("\t.4byte %1\n").arg(connectionsListLabel);
|
|
234
|
+ saveTextFile(connections_path, text);
|
|
235
|
+}
|
|
236
|
+
|
213
|
237
|
void Project::readMapAttributesTable() {
|
214
|
238
|
int curMapIndex = 1;
|
215
|
239
|
QString attributesText = readTextFile(getMapAttributesTableFilepath());
|
|
@@ -680,6 +704,7 @@ void Project::saveMap(Map *map) {
|
680
|
704
|
|
681
|
705
|
saveMapBorder(map);
|
682
|
706
|
saveMapHeader(map);
|
|
707
|
+ saveMapConnections(map);
|
683
|
708
|
saveBlockdata(map);
|
684
|
709
|
saveMapEvents(map);
|
685
|
710
|
|