mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-25 11:26:37 +00:00 
			
		
		
		
	declare cellId and cellCoords in smallest possible scope
This commit is contained in:
		
							parent
							
								
									fdcc7fa1d7
								
							
						
					
					
						commit
						6f9f59dd58
					
				
					 1 changed files with 8 additions and 9 deletions
				
			
		|  | @ -402,9 +402,6 @@ void CSVRender::TerrainShapeMode::editTerrainShapeGrid(const std::pair<int, int> | ||||||
|     int r = mBrushSize / 2; |     int r = mBrushSize / 2; | ||||||
|     if (r == 0) r = 1; // Prevent division by zero later, which might happen when mBrushSize == 1
 |     if (r == 0) r = 1; // Prevent division by zero later, which might happen when mBrushSize == 1
 | ||||||
| 
 | 
 | ||||||
|     std::string cellId = CSMWorld::CellCoordinates::vertexGlobalToCellId(vertexCoords); |  | ||||||
|     CSMWorld::CellCoordinates cellCoords = CSMWorld::CellCoordinates::fromId(cellId).first; |  | ||||||
| 
 |  | ||||||
|     if (CSVRender::PagedWorldspaceWidget *paged = |     if (CSVRender::PagedWorldspaceWidget *paged = | ||||||
|         dynamic_cast<CSVRender::PagedWorldspaceWidget *> (&getWorldspaceWidget())) |         dynamic_cast<CSVRender::PagedWorldspaceWidget *> (&getWorldspaceWidget())) | ||||||
|     { |     { | ||||||
|  | @ -413,6 +410,8 @@ void CSVRender::TerrainShapeMode::editTerrainShapeGrid(const std::pair<int, int> | ||||||
| 
 | 
 | ||||||
|     if (mBrushShape == CSVWidget::BrushShape_Point) |     if (mBrushShape == CSVWidget::BrushShape_Point) | ||||||
|     { |     { | ||||||
|  |         std::string cellId = CSMWorld::CellCoordinates::vertexGlobalToCellId(vertexCoords); | ||||||
|  |         CSMWorld::CellCoordinates cellCoords = CSMWorld::CellCoordinates::fromId(cellId).first; | ||||||
|         int x = CSMWorld::CellCoordinates::vertexGlobalToInCellCoords(vertexCoords.first); |         int x = CSMWorld::CellCoordinates::vertexGlobalToInCellCoords(vertexCoords.first); | ||||||
|         int y = CSMWorld::CellCoordinates::vertexGlobalToInCellCoords(vertexCoords.second); |         int y = CSMWorld::CellCoordinates::vertexGlobalToInCellCoords(vertexCoords.second); | ||||||
|         if (mShapeEditTool == ShapeEditTool_Drag) alterHeight(cellCoords, x, y, mTotalDiffY); |         if (mShapeEditTool == ShapeEditTool_Drag) alterHeight(cellCoords, x, y, mTotalDiffY); | ||||||
|  | @ -432,8 +431,8 @@ void CSVRender::TerrainShapeMode::editTerrainShapeGrid(const std::pair<int, int> | ||||||
|         { |         { | ||||||
|             for(int j = vertexCoords.second - r; j <= vertexCoords.second + r; ++j) |             for(int j = vertexCoords.second - r; j <= vertexCoords.second + r; ++j) | ||||||
|             { |             { | ||||||
|                 cellId = CSMWorld::CellCoordinates::vertexGlobalToCellId(std::make_pair(i, j)); |                 std::string cellId = CSMWorld::CellCoordinates::vertexGlobalToCellId(std::make_pair(i, j)); | ||||||
|                 cellCoords = CSMWorld::CellCoordinates::fromId(cellId).first; |                 CSMWorld::CellCoordinates cellCoords = CSMWorld::CellCoordinates::fromId(cellId).first; | ||||||
|                 int x = CSMWorld::CellCoordinates::vertexGlobalToInCellCoords(i); |                 int x = CSMWorld::CellCoordinates::vertexGlobalToInCellCoords(i); | ||||||
|                 int y = CSMWorld::CellCoordinates::vertexGlobalToInCellCoords(j); |                 int y = CSMWorld::CellCoordinates::vertexGlobalToInCellCoords(j); | ||||||
|                 if (mShapeEditTool == ShapeEditTool_Drag) alterHeight(cellCoords, x, y, mTotalDiffY); |                 if (mShapeEditTool == ShapeEditTool_Drag) alterHeight(cellCoords, x, y, mTotalDiffY); | ||||||
|  | @ -455,8 +454,8 @@ void CSVRender::TerrainShapeMode::editTerrainShapeGrid(const std::pair<int, int> | ||||||
|         { |         { | ||||||
|             for(int j = vertexCoords.second - r; j <= vertexCoords.second + r; ++j) |             for(int j = vertexCoords.second - r; j <= vertexCoords.second + r; ++j) | ||||||
|             { |             { | ||||||
|                 cellId = CSMWorld::CellCoordinates::vertexGlobalToCellId(std::make_pair(i, j)); |                 std::string cellId = CSMWorld::CellCoordinates::vertexGlobalToCellId(std::make_pair(i, j)); | ||||||
|                 cellCoords = CSMWorld::CellCoordinates::fromId(cellId).first; |                 CSMWorld::CellCoordinates cellCoords = CSMWorld::CellCoordinates::fromId(cellId).first; | ||||||
|                 int x = CSMWorld::CellCoordinates::vertexGlobalToInCellCoords(i); |                 int x = CSMWorld::CellCoordinates::vertexGlobalToInCellCoords(i); | ||||||
|                 int y = CSMWorld::CellCoordinates::vertexGlobalToInCellCoords(j); |                 int y = CSMWorld::CellCoordinates::vertexGlobalToInCellCoords(j); | ||||||
|                 int distanceX = abs(i - vertexCoords.first); |                 int distanceX = abs(i - vertexCoords.first); | ||||||
|  | @ -486,8 +485,8 @@ void CSVRender::TerrainShapeMode::editTerrainShapeGrid(const std::pair<int, int> | ||||||
|         { |         { | ||||||
|             for(auto const& value: mCustomBrushShape) |             for(auto const& value: mCustomBrushShape) | ||||||
|             { |             { | ||||||
|                 cellId = CSMWorld::CellCoordinates::vertexGlobalToCellId(std::make_pair(vertexCoords.first + value.first, vertexCoords.second + value.second)); |                 std::string cellId = CSMWorld::CellCoordinates::vertexGlobalToCellId(std::make_pair(vertexCoords.first + value.first, vertexCoords.second + value.second)); | ||||||
|                 cellCoords = CSMWorld::CellCoordinates::fromId(cellId).first; |                 CSMWorld::CellCoordinates cellCoords = CSMWorld::CellCoordinates::fromId(cellId).first; | ||||||
|                 int x = CSMWorld::CellCoordinates::vertexGlobalToInCellCoords(vertexCoords.first + value.first); |                 int x = CSMWorld::CellCoordinates::vertexGlobalToInCellCoords(vertexCoords.first + value.first); | ||||||
|                 int y = CSMWorld::CellCoordinates::vertexGlobalToInCellCoords(vertexCoords.second + value.second); |                 int y = CSMWorld::CellCoordinates::vertexGlobalToInCellCoords(vertexCoords.second + value.second); | ||||||
|                 if (mShapeEditTool == ShapeEditTool_Drag) alterHeight(cellCoords, x, y, mTotalDiffY); |                 if (mShapeEditTool == ShapeEditTool_Drag) alterHeight(cellCoords, x, y, mTotalDiffY); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue