private void Draw(ScreenDrawingSurface surface, int tile_x, int tile_y)
{
// first track the changes i'm going to make for undo purposes
foreach (TileBrushCell cell in brush.Cells())
{
int tx = cell.x + tile_x;
int ty = cell.y + tile_y;
if (tx < 0 || tx >= surface.Screen.Width || ty < 0 || ty >= surface.Screen.Height) continue;
if (startTiles[tx, ty] == null) // don't overwrite existing data
{
startTiles[tx, ty] = surface.Screen.TileAt(tx, ty).Id;
}
endTiles[tx, ty] = cell.tile.Id;
}
brush.DrawOn(surface.Screen, tile_x, tile_y);
surface.ReDrawTiles();
}