mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-24 17:58:45 +00:00
Changed: #1302 Landscape scene works correctly in world editor plugin.
This commit is contained in:
parent
52c4aca5ea
commit
79b9e6d3db
1 changed files with 17 additions and 10 deletions
|
@ -202,13 +202,16 @@ QGraphicsItem *LandscapeSceneBase::createItemEmptyZone(const ZonePosition &zoneP
|
||||||
|
|
||||||
void LandscapeSceneBase::deleteItemZone(const ZonePosition &zonePos)
|
void LandscapeSceneBase::deleteItemZone(const ZonePosition &zonePos)
|
||||||
{
|
{
|
||||||
QGraphicsItem *item = itemAt(zonePos.x * m_cellSize, abs(zonePos.y) * m_cellSize);
|
QList<QGraphicsItem *> listItems = items(QPointF(zonePos.x * m_cellSize + 10, abs(zonePos.y) * m_cellSize + 10),
|
||||||
|
Qt::IntersectsItemBoundingRect, Qt::AscendingOrder);
|
||||||
// TODO: delete LAYER_BLACKOUT_NAME
|
Q_FOREACH(QGraphicsItem *item, listItems)
|
||||||
if ((item != 0) && (item->data(ZONE_NAME).toString() != QString(LAYER_BLACKOUT_NAME)))
|
|
||||||
{
|
{
|
||||||
removeItem(item);
|
if (dynamic_cast<QGraphicsPixmapItem *>(item) != 0)
|
||||||
delete item;
|
{
|
||||||
|
removeItem(item);
|
||||||
|
delete item;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,6 +249,7 @@ void LandscapeSceneBase::delZoneRegion(const NLLIGO::CZoneRegion &zoneRegion)
|
||||||
{
|
{
|
||||||
for (sint32 j = zoneRegion.getMinY(); j <= zoneRegion.getMaxY(); ++j)
|
for (sint32 j = zoneRegion.getMinY(); j <= zoneRegion.getMaxY(); ++j)
|
||||||
{
|
{
|
||||||
|
|
||||||
deleteItemZone(ZonePosition(i, -j, -1));
|
deleteItemZone(ZonePosition(i, -j, -1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -314,10 +318,13 @@ void LandscapeSceneBase::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
|
||||||
|
|
||||||
bool LandscapeSceneBase::checkUnderZone(const int posX, const int posY)
|
bool LandscapeSceneBase::checkUnderZone(const int posX, const int posY)
|
||||||
{
|
{
|
||||||
// TODO: it will not work correctly in world editor
|
QList<QGraphicsItem *> listItems = items(QPointF(posX * m_cellSize + 10, abs(posY) * m_cellSize + 10),
|
||||||
QGraphicsItem *item = itemAt((posX * m_cellSize), abs(posY) * m_cellSize);
|
Qt::IntersectsItemBoundingRect, Qt::AscendingOrder);
|
||||||
if (item != 0)
|
Q_FOREACH(QGraphicsItem *item, listItems)
|
||||||
return true;
|
{
|
||||||
|
if (dynamic_cast<QGraphicsPixmapItem *>(item) != 0)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue