Fix new connections not appearing

This commit is contained in:
GriffinR 2023-01-15 23:49:08 -05:00
parent 0556afaf98
commit d5d0d64310
2 changed files with 4 additions and 5 deletions

View file

@ -166,7 +166,7 @@ private:
void setConnectionEditControlValues(MapConnection*); void setConnectionEditControlValues(MapConnection*);
void setConnectionEditControlsEnabled(bool); void setConnectionEditControlsEnabled(bool);
void setConnectionsEditable(bool); void setConnectionsEditable(bool);
void createConnectionItem(MapConnection* connection, bool hide); void createConnectionItem(MapConnection* connection);
void populateConnectionMapPickers(); void populateConnectionMapPickers();
void setDiveEmergeControls(); void setDiveEmergeControls();
void updateDiveEmergeMap(QString mapName, QString direction); void updateDiveEmergeMap(QString mapName, QString direction);

View file

@ -1528,7 +1528,7 @@ void Editor::displayMapConnections() {
if (connection->direction == "dive" || connection->direction == "emerge") { if (connection->direction == "dive" || connection->direction == "emerge") {
continue; continue;
} }
createConnectionItem(connection, false); createConnectionItem(connection);
} }
if (!connection_items.empty()) { if (!connection_items.empty()) {
@ -1538,7 +1538,7 @@ void Editor::displayMapConnections() {
maskNonVisibleConnectionTiles(); maskNonVisibleConnectionTiles();
} }
void Editor::createConnectionItem(MapConnection* connection, bool hide) { void Editor::createConnectionItem(MapConnection* connection) {
Map *connected_map = project->getMap(connection->map_name); Map *connected_map = project->getMap(connection->map_name);
if (!connected_map) { if (!connected_map) {
return; return;
@ -1566,7 +1566,6 @@ void Editor::createConnectionItem(MapConnection* connection, bool hide) {
item->setY(y); item->setY(y);
item->setZValue(-1); item->setZValue(-1);
scene->addItem(item); scene->addItem(item);
item->setVisible(!hide);
connect(item, &ConnectionPixmapItem::connectionMoved, this, &Editor::onConnectionMoved); connect(item, &ConnectionPixmapItem::connectionMoved, this, &Editor::onConnectionMoved);
connect(item, &ConnectionPixmapItem::connectionItemSelected, this, &Editor::onConnectionItemSelected); connect(item, &ConnectionPixmapItem::connectionItemSelected, this, &Editor::onConnectionItemSelected);
connect(item, &ConnectionPixmapItem::connectionItemDoubleClicked, this, &Editor::onConnectionItemDoubleClicked); connect(item, &ConnectionPixmapItem::connectionItemDoubleClicked, this, &Editor::onConnectionItemDoubleClicked);
@ -1758,7 +1757,7 @@ void Editor::addNewConnection() {
newConnection->offset = 0; newConnection->offset = 0;
newConnection->map_name = defaultMapName; newConnection->map_name = defaultMapName;
map->connections.append(newConnection); map->connections.append(newConnection);
createConnectionItem(newConnection, true); createConnectionItem(newConnection);
onConnectionItemSelected(connection_items.last()); onConnectionItemSelected(connection_items.last());
ui->label_NumConnections->setText(QString::number(map->connections.length())); ui->label_NumConnections->setText(QString::number(map->connections.length()));