mirror of
https://github.com/vcmi/vcmi.git
synced 2025-09-16 09:26:28 +02:00
Address naming questions
This commit is contained in:
@@ -344,12 +344,12 @@ void MapController::pasteFromClipboard(int level)
|
||||
if(_clipboardShiftIndex == int3::getDirs().size())
|
||||
_clipboardShiftIndex = 0;
|
||||
|
||||
for(auto & objuptr : _clipboard)
|
||||
for(auto & objUniquePtr : _clipboard)
|
||||
{
|
||||
auto * obj = CMemorySerializer::deepCopy(*objuptr).release();
|
||||
auto newpos = objuptr->pos + shift;
|
||||
if(_map->isInTheMap(newpos))
|
||||
obj->pos = newpos;
|
||||
auto * obj = CMemorySerializer::deepCopy(*objUniquePtr).release();
|
||||
auto newPos = objUniquePtr->pos + shift;
|
||||
if(_map->isInTheMap(newPos))
|
||||
obj->pos = newPos;
|
||||
obj->pos.z = level;
|
||||
|
||||
Initializer init(obj, defaultPlayer);
|
||||
|
@@ -269,15 +269,17 @@ void MapView::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if(event->button() == Qt::LeftButton)
|
||||
{
|
||||
auto * obj = sc->selectionObjectsView.selectObjectAt(tileStart.x, tileStart.y);
|
||||
auto * obj2 = sc->selectionObjectsView.selectObjectAt(tileStart.x, tileStart.y, obj);
|
||||
if(obj)
|
||||
//when paste, new object could be beyond initial object so we need to test two objects in order to select new one
|
||||
//if object is pasted at place where is multiple objects then proper selection is not guaranteed
|
||||
auto * firstSelectedObject = sc->selectionObjectsView.selectObjectAt(tileStart.x, tileStart.y);
|
||||
auto * secondSelectedObject = sc->selectionObjectsView.selectObjectAt(tileStart.x, tileStart.y, firstSelectedObject);
|
||||
if(firstSelectedObject)
|
||||
{
|
||||
if(sc->selectionObjectsView.isSelected(obj))
|
||||
if(sc->selectionObjectsView.isSelected(firstSelectedObject))
|
||||
{
|
||||
if(qApp->keyboardModifiers() & Qt::ControlModifier)
|
||||
{
|
||||
sc->selectionObjectsView.deselectObject(obj);
|
||||
sc->selectionObjectsView.deselectObject(firstSelectedObject);
|
||||
sc->selectionObjectsView.selectionMode = SelectionObjectsLayer::SELECTION;
|
||||
}
|
||||
else
|
||||
@@ -285,11 +287,11 @@ void MapView::mousePressEvent(QMouseEvent *event)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!obj2 || !sc->selectionObjectsView.isSelected(obj2))
|
||||
if(!secondSelectedObject || !sc->selectionObjectsView.isSelected(secondSelectedObject))
|
||||
{
|
||||
if(!(qApp->keyboardModifiers() & Qt::ControlModifier))
|
||||
sc->selectionObjectsView.clear();
|
||||
sc->selectionObjectsView.selectObject(obj);
|
||||
sc->selectionObjectsView.selectObject(firstSelectedObject);
|
||||
}
|
||||
sc->selectionObjectsView.selectionMode = SelectionObjectsLayer::MOVEMENT;
|
||||
}
|
||||
|
Reference in New Issue
Block a user