mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-11 19:35:38 -05:00
Take advantage of MapConnection as QObject
This commit is contained in:
@@ -218,6 +218,9 @@ QPixmap Map::renderBorder(bool ignoreCache) {
|
||||
}
|
||||
|
||||
QPixmap Map::renderConnection(const QString &direction, MapLayout * fromLayout) {
|
||||
if (direction == "dive" || direction == "emerge")
|
||||
return render();
|
||||
|
||||
if (!MapConnection::isCardinal(direction))
|
||||
return QPixmap();
|
||||
|
||||
@@ -510,6 +513,22 @@ void Map::addEvent(Event *event) {
|
||||
if (!ownedEvents.contains(event)) ownedEvents.append(event);
|
||||
}
|
||||
|
||||
bool Map::removeConnection(MapConnection *connection) {
|
||||
if (connections.removeOne(connection)) {
|
||||
modify();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Map::addConnection(MapConnection *connection) {
|
||||
if (!connection || connections.contains(connection))
|
||||
return;
|
||||
connections.append(connection);
|
||||
modify();
|
||||
emit connectionAdded(connection);
|
||||
}
|
||||
|
||||
void Map::modify() {
|
||||
emit modified();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user