mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-26 06:40:22 +00:00
Make less copies
This commit is contained in:
parent
001ca68cc7
commit
dc8de6c6e6
@ -43,17 +43,13 @@ std::vector<std::pair<int, int>> CSVRender::TerrainSelection::getTerrainSelectio
|
|||||||
return mSelection;
|
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();
|
mSelection = localPositions;
|
||||||
for(auto const& value: localPositions)
|
|
||||||
{
|
|
||||||
mSelection.emplace_back(value);
|
|
||||||
}
|
|
||||||
update();
|
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())
|
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)
|
if (toggleInProgress == true)
|
||||||
{
|
{
|
||||||
@ -146,7 +142,7 @@ void CSVRender::TerrainSelection::drawShapeSelection(const osg::ref_ptr<osg::Vec
|
|||||||
{
|
{
|
||||||
if (!mSelection.empty())
|
if (!mSelection.empty())
|
||||||
{
|
{
|
||||||
for (std::pair<int, int> localPos : mSelection)
|
for (std::pair<int, int> &localPos : mSelection)
|
||||||
{
|
{
|
||||||
int x (localPos.first);
|
int x (localPos.first);
|
||||||
int y (localPos.second);
|
int y (localPos.second);
|
||||||
@ -189,7 +185,7 @@ void CSVRender::TerrainSelection::drawTextureSelection(const osg::ref_ptr<osg::V
|
|||||||
|
|
||||||
const int textureSizeToLandSizeModifier = (landSize - 1) / landTextureSize;
|
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 x (localPos.first);
|
||||||
int y (localPos.second);
|
int y (localPos.second);
|
||||||
|
@ -35,9 +35,9 @@ namespace CSVRender
|
|||||||
TerrainSelection(osg::Group* parentNode, WorldspaceWidget *worldspaceWidget, TerrainSelectionType type);
|
TerrainSelection(osg::Group* parentNode, WorldspaceWidget *worldspaceWidget, TerrainSelectionType type);
|
||||||
~TerrainSelection();
|
~TerrainSelection();
|
||||||
|
|
||||||
void onlySelect(const std::vector<std::pair<int, int>> localPositions);
|
void onlySelect(const std::vector<std::pair<int, int>> &localPositions);
|
||||||
void addSelect(const std::pair<int, int> localPos);
|
void addSelect(const std::pair<int, int> &localPos);
|
||||||
void toggleSelect(const std::vector<std::pair<int, int>> localPositions, bool);
|
void toggleSelect(const std::vector<std::pair<int, int>> &localPositions, bool);
|
||||||
|
|
||||||
void activate();
|
void activate();
|
||||||
void deactivate();
|
void deactivate();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user