fixed sub diving and surrounding cells selection

This commit is contained in:
devZoGok
2026-04-24 19:28:31 +03:00
parent 4b4e0df9f3
commit 6801a9784e
2 changed files with 8 additions and 10 deletions
+2 -2
View File
@@ -383,8 +383,8 @@ namespace battleship{
vector<int> cellIds;
for(int i = vertId - numRings; i <= vertId + numRings; i++)
for(int j = horId - numRings; j <= horId + numRings; j++)
for(int i = max(vertId - numRings, 0); i <= min(vertId + numRings, numVertCells - 1); i++)
for(int j = max(horId - numRings, 0); j <= min(horId + numRings, numHorCells - 1); j++)
cellIds.push_back(numHorCells * i + j);
return cellIds;