mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-04-02 12:20:53 -07:00
expandSector implementation
This commit is contained in:
parent
fc5a45e113
commit
569afb5535
1 changed files with 17 additions and 0 deletions
|
|
@ -75,6 +75,23 @@ public class Sectors{
|
|||
* @param expandX spaces in X coordinate to expand, can be negative
|
||||
* @param expandY spaces in Y coordinate to expand, can be negative*/
|
||||
public boolean expandSector(Sector sector, int expandX, int expandY){
|
||||
sector.width += expandX;
|
||||
sector.height += expandY;
|
||||
|
||||
for(int x = sector.x; x < sector.x+sector.width; x++){
|
||||
for(int y = sector.y; y < sector.y+sector.height; y++){
|
||||
grid.put(x, y, null);
|
||||
}
|
||||
}
|
||||
|
||||
if(expandX < 0) sector.x += expandX;
|
||||
if(expandY < 0) sector.y += expandY;
|
||||
|
||||
for(int x = sector.x; x < sector.x+sector.width; x++){
|
||||
for(int y = sector.y; y < sector.y+sector.height; y++){
|
||||
grid.put(x, y, sector);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue