diff --git a/apps/opencs/view/render/terrainselection.cpp b/apps/opencs/view/render/terrainselection.cpp index f7db31e1e..45b06e8f6 100644 --- a/apps/opencs/view/render/terrainselection.cpp +++ b/apps/opencs/view/render/terrainselection.cpp @@ -43,17 +43,13 @@ std::vector> CSVRender::TerrainSelection::getTerrainSelectio return mSelection; } -void CSVRender::TerrainSelection::onlySelect(const std::vector> localPositions) +void CSVRender::TerrainSelection::onlySelect(const std::vector> &localPositions) { - mSelection.clear(); - for(auto const& value: localPositions) - { - mSelection.emplace_back(value); - } + mSelection = localPositions; update(); } -void CSVRender::TerrainSelection::addSelect(const std::pair localPos) +void CSVRender::TerrainSelection::addSelect(const std::pair &localPos) { if (std::find(mSelection.begin(), mSelection.end(), localPos) == mSelection.end()) { @@ -62,7 +58,7 @@ void CSVRender::TerrainSelection::addSelect(const std::pair localPos) } } -void CSVRender::TerrainSelection::toggleSelect(const std::vector> localPositions, bool toggleInProgress) +void CSVRender::TerrainSelection::toggleSelect(const std::vector> &localPositions, bool toggleInProgress) { if (toggleInProgress == true) { @@ -146,7 +142,7 @@ void CSVRender::TerrainSelection::drawShapeSelection(const osg::ref_ptr localPos : mSelection) + for (std::pair &localPos : mSelection) { int x (localPos.first); int y (localPos.second); @@ -189,7 +185,7 @@ void CSVRender::TerrainSelection::drawTextureSelection(const osg::ref_ptr localPos : mSelection) + for (std::pair &localPos : mSelection) { int x (localPos.first); int y (localPos.second); diff --git a/apps/opencs/view/render/terrainselection.hpp b/apps/opencs/view/render/terrainselection.hpp index 7a20bd87f..ed4548fa7 100644 --- a/apps/opencs/view/render/terrainselection.hpp +++ b/apps/opencs/view/render/terrainselection.hpp @@ -35,9 +35,9 @@ namespace CSVRender TerrainSelection(osg::Group* parentNode, WorldspaceWidget *worldspaceWidget, TerrainSelectionType type); ~TerrainSelection(); - void onlySelect(const std::vector> localPositions); - void addSelect(const std::pair localPos); - void toggleSelect(const std::vector> localPositions, bool); + void onlySelect(const std::vector> &localPositions); + void addSelect(const std::pair &localPos); + void toggleSelect(const std::vector> &localPositions, bool); void activate(); void deactivate();