mirror of
https://github.com/kwsch/NHSE.git
synced 2026-09-29 21:36:36 -05:00
Add skip exterior for terrain set all
https://github.com/kwsch/NHSE/issues/122#issuecomment-619472394
This commit is contained in:
@@ -60,5 +60,27 @@ public void ImportAcre(int acre, byte[] data)
|
||||
tile.CopyFrom(tiles[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetAll(TerrainTile tile, in bool interiorOnly)
|
||||
{
|
||||
if (interiorOnly)
|
||||
{
|
||||
// skip outermost ring of tiles
|
||||
int xmin = GridWidth;
|
||||
int ymin = GridHeight;
|
||||
int xmax = MapWidth - GridWidth;
|
||||
int ymax = MapHeight - GridHeight;
|
||||
for (int x = xmin; x < xmax; x++)
|
||||
{
|
||||
for (int y = ymin; y < ymax; y++)
|
||||
GetTile(x, y).CopyFrom(tile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var t in Tiles)
|
||||
t.CopyFrom(tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,9 +216,10 @@ private void B_SetAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MessageStrings.MsgTerrainSetAll))
|
||||
return;
|
||||
|
||||
var pgt = (TerrainTile)PG_Tile.SelectedObject;
|
||||
foreach (var t in Terrain.Tiles)
|
||||
t.CopyFrom(pgt);
|
||||
bool interiorOnly = DialogResult.Yes == WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MessageStrings.MsgTerrainSetAllSkipExterior);
|
||||
Terrain.SetAll(pgt, interiorOnly);
|
||||
LoadGrid(X, Y);
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
}
|
||||
|
||||
@@ -38,5 +38,6 @@ public static class MessageStrings
|
||||
|
||||
public static string MsgTerrainSetElevation0 { get; set; } = "Set the elevation of all tiles on the map to 0?";
|
||||
public static string MsgTerrainSetAll { get; set; } = "Set the tile from the Tile Editor to all tiles on the map?";
|
||||
public static string MsgTerrainSetAllSkipExterior { get; set; } = "Do you want to skip the tiles in exterior acres (beach/rocks)?";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user