mirror of
https://github.com/kwsch/NHSE.git
synced 2026-04-23 08:57:42 -05:00
Add road tile detail copy
Copies only the road portion of the terrain tile, not the ground detail. Closes #203
This commit is contained in:
parent
5a22c0e58a
commit
6fe7e4e53a
|
|
@ -85,6 +85,28 @@ public void SetAll(TerrainTile tile, in bool interiorOnly)
|
|||
}
|
||||
}
|
||||
|
||||
public void SetAllRoad(TerrainTile tile, in bool interiorOnly)
|
||||
{
|
||||
if (interiorOnly)
|
||||
{
|
||||
// skip outermost ring of tiles
|
||||
int xmin = GridWidth;
|
||||
int ymin = GridHeight;
|
||||
int xmax = MaxWidth - GridWidth;
|
||||
int ymax = MaxHeight - GridHeight;
|
||||
for (int x = xmin; x < xmax; x++)
|
||||
{
|
||||
for (int y = ymin; y < ymax; y++)
|
||||
GetTile(x, y).CopyRoadFrom(tile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var t in Tiles)
|
||||
t.CopyRoadFrom(tile);
|
||||
}
|
||||
}
|
||||
|
||||
public void GetBuildingCoordinate(ushort bx, ushort by, int scale, out int x, out int y)
|
||||
{
|
||||
// Although there is terrain in the Top Row and Left Column, no buildings can be placed there.
|
||||
|
|
|
|||
|
|
@ -57,5 +57,19 @@ public void CopyFrom(TerrainTile source)
|
|||
LandMakingAngleRoad = source.LandMakingAngleRoad;
|
||||
Elevation = source.Elevation;
|
||||
}
|
||||
|
||||
public void CopyGroundFrom(TerrainTile tile)
|
||||
{
|
||||
UnitModel = tile.UnitModel;
|
||||
Variation = tile.Variation;
|
||||
LandMakingAngle = tile.LandMakingAngle;
|
||||
}
|
||||
|
||||
public void CopyRoadFrom(TerrainTile tile)
|
||||
{
|
||||
UnitModelRoad = tile.UnitModelRoad;
|
||||
VariationRoad = tile.VariationRoad;
|
||||
LandMakingAngleRoad = tile.LandMakingAngleRoad;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@ private void InitializeComponent()
|
|||
this.CM_Terrain = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.B_ZeroElevation = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.B_SetAllTerrain = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.B_SetAllRoadTiles = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.RB_Item = new System.Windows.Forms.RadioButton();
|
||||
this.RB_Terrain = new System.Windows.Forms.RadioButton();
|
||||
this.L_TileMode = new System.Windows.Forms.Label();
|
||||
|
|
@ -1215,10 +1216,11 @@ private void InitializeComponent()
|
|||
//
|
||||
this.CM_Terrain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.B_ZeroElevation,
|
||||
this.B_SetAllTerrain});
|
||||
this.B_SetAllTerrain,
|
||||
this.B_SetAllRoadTiles});
|
||||
this.CM_Terrain.Name = "CM_Picture";
|
||||
this.CM_Terrain.ShowImageMargin = false;
|
||||
this.CM_Terrain.Size = new System.Drawing.Size(225, 70);
|
||||
this.CM_Terrain.Size = new System.Drawing.Size(225, 92);
|
||||
//
|
||||
// B_ZeroElevation
|
||||
//
|
||||
|
|
@ -1234,6 +1236,13 @@ private void InitializeComponent()
|
|||
this.B_SetAllTerrain.Text = "Set All Tiles using Tile from Editor";
|
||||
this.B_SetAllTerrain.Click += new System.EventHandler(this.B_SetAllTerrain_Click);
|
||||
//
|
||||
// B_SetAllRoadTiles
|
||||
//
|
||||
this.B_SetAllRoadTiles.Name = "B_SetAllRoadTiles";
|
||||
this.B_SetAllRoadTiles.Size = new System.Drawing.Size(224, 22);
|
||||
this.B_SetAllRoadTiles.Text = "Set All Road Tiles from Editor";
|
||||
this.B_SetAllRoadTiles.Click += new System.EventHandler(this.B_SetAllRoadTiles_Click);
|
||||
//
|
||||
// RB_Item
|
||||
//
|
||||
this.RB_Item.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
|
|
@ -1460,5 +1469,6 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.ToolStripMenuItem Menu_SavePNGItems;
|
||||
private System.Windows.Forms.ToolStripMenuItem Menu_SavePNGTerrain;
|
||||
private System.Windows.Forms.CheckBox CHK_RedirectExtensionLoad;
|
||||
private System.Windows.Forms.ToolStripMenuItem B_SetAllRoadTiles;
|
||||
}
|
||||
}
|
||||
|
|
@ -817,5 +817,18 @@ private void B_SetAllTerrain_Click(object sender, EventArgs e)
|
|||
ReloadBuildingsTerrain();
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
}
|
||||
|
||||
private void B_SetAllRoadTiles_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MessageStrings.MsgTerrainSetAll))
|
||||
return;
|
||||
|
||||
var pgt = (TerrainTile)PG_TerrainTile.SelectedObject;
|
||||
bool interiorOnly = DialogResult.Yes == WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MessageStrings.MsgTerrainSetAllSkipExterior);
|
||||
Map.Terrain.SetAll(pgt, interiorOnly);
|
||||
|
||||
ReloadBuildingsTerrain();
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user