1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-29 21:45:32 +00:00

Make less copies

This commit is contained in:
Nelsson Huotari 2019-05-06 12:22:16 +03:00
parent 001ca68cc7
commit dc8de6c6e6
2 changed files with 9 additions and 13 deletions

View file

@ -43,17 +43,13 @@ std::vector<std::pair<int, int>> CSVRender::TerrainSelection::getTerrainSelectio
return mSelection;
}
void CSVRender::TerrainSelection::onlySelect(const std::vector<std::pair<int, int>> localPositions)
void CSVRender::TerrainSelection::onlySelect(const std::vector<std::pair<int, int>> &localPositions)
{
mSelection.clear();
for(auto const& value: localPositions)
{
mSelection.emplace_back(value);
}
mSelection = localPositions;
update();
}
void CSVRender::TerrainSelection::addSelect(const std::pair<int, int> localPos)
void CSVRender::TerrainSelection::addSelect(const std::pair<int, int> &localPos)
{
if (std::find(mSelection.begin(), mSelection.end(), localPos) == mSelection.end())
{
@ -62,7 +58,7 @@ void CSVRender::TerrainSelection::addSelect(const std::pair<int, int> localPos)
}
}
void CSVRender::TerrainSelection::toggleSelect(const std::vector<std::pair<int, int>> localPositions, bool toggleInProgress)
void CSVRender::TerrainSelection::toggleSelect(const std::vector<std::pair<int, int>> &localPositions, bool toggleInProgress)
{
if (toggleInProgress == true)
{
@ -146,7 +142,7 @@ void CSVRender::TerrainSelection::drawShapeSelection(const osg::ref_ptr<osg::Vec
{
if (!mSelection.empty())
{
for (std::pair<int, int> localPos : mSelection)
for (std::pair<int, int> &localPos : mSelection)
{
int x (localPos.first);
int y (localPos.second);
@ -189,7 +185,7 @@ void CSVRender::TerrainSelection::drawTextureSelection(const osg::ref_ptr<osg::V
const int textureSizeToLandSizeModifier = (landSize - 1) / landTextureSize;
for (std::pair<int, int> localPos : mSelection)
for (std::pair<int, int> &localPos : mSelection)
{
int x (localPos.first);
int y (localPos.second);

View file

@ -35,9 +35,9 @@ namespace CSVRender
TerrainSelection(osg::Group* parentNode, WorldspaceWidget *worldspaceWidget, TerrainSelectionType type);
~TerrainSelection();
void onlySelect(const std::vector<std::pair<int, int>> localPositions);
void addSelect(const std::pair<int, int> localPos);
void toggleSelect(const std::vector<std::pair<int, int>> localPositions, bool);
void onlySelect(const std::vector<std::pair<int, int>> &localPositions);
void addSelect(const std::pair<int, int> &localPos);
void toggleSelect(const std::vector<std::pair<int, int>> &localPositions, bool);
void activate();
void deactivate();