示例#1
0
 public void fillSelected(@Nonnull final Map map) {
   final GroupAction action = new GroupAction();
   for (final MapPosition pos : map.getSelectedTiles()) {
     final MapTile tile = map.getTileAt(pos.getX(), pos.getY());
     if (tile != null) {
       paintSelected(pos.getX(), pos.getY(), map, action);
     }
   }
   if (!action.isEmpty()) {
     getHistory().addEntry(action);
   }
 }
示例#2
0
 public void fillArea(
     final int startX, final int startY, final int endX, final int endY, final Map map) {
   final int fromX = Math.min(startX, endX);
   final int toX = Math.max(startX, endX);
   final int fromY = Math.min(startY, endY);
   final int toY = Math.max(startY, endY);
   final GroupAction action = new GroupAction();
   for (int x = fromX; x <= toX; x++) {
     for (int y = fromY; y <= toY; y++) {
       paintSelected(x, y, map, action);
     }
   }
   if (!action.isEmpty()) {
     getHistory().addEntry(action);
   }
 }