diff options
-rw-r--r-- | sigmodr/widgets/MapScene.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/sigmodr/widgets/MapScene.cpp b/sigmodr/widgets/MapScene.cpp index 18563a0c..79aed060 100644 --- a/sigmodr/widgets/MapScene.cpp +++ b/sigmodr/widgets/MapScene.cpp @@ -48,13 +48,33 @@ MapScene::MapScene(Map* map, QObject* parent) : { connect(this, SIGNAL(changed(QList<QRectF>)), this, SIGNAL(changed())); for (int i = 0; i < m_map->effectCount(); ++i) - addItem(new EffectItem(m_map->effect(i), this)); + { + MapEffect* effect = m_map->effect(i); + EffectItem* item = new EffectItem(effect, this); + m_effects[effect] = item; + addItem(item); + } for (int i = 0; i < m_map->tileCount(); ++i) - addItem(new TileItem(m_map->tile(i), this)); + { + MapTile* tile = m_map->tile(i); + TileItem* item = new TileItem(tile, this); + m_tiles[tile] = item; + addItem(item); + } for (int i = 0; i < m_map->trainerCount(); ++i) - addItem(new TrainerItem(m_map->trainer(i), this)); + { + MapTrainer* trainer = m_map->trainer(i); + TrainerItem* item = new TrainerItem(trainer, this); + m_trainers[trainer] = item; + addItem(item); + } for (int i = 0; i < m_map->warpCount(); ++i) - addItem(new WarpItem(m_map->warp(i), this)); + { + MapWarp* warp = m_map->warp(i); + WarpItem* item = new WarpItem(warp, this); + m_warps[warp] = item; + addItem(item); + } } void MapScene::addTile() |