From c571fbb20a0fd84ccc47e191656fa39c28828039 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 31 May 2020 15:24:59 -0700 Subject: [PATCH] Add remove trees option Closes #273 --- .../Structures/Map/Layers/FieldItemLayer.cs | 1 + .../Subforms/Map/FieldItemEditor.Designer.cs | 24 +++++++++++++------ NHSE.WinForms/Subforms/Map/FieldItemEditor.cs | 1 + 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/NHSE.Core/Structures/Map/Layers/FieldItemLayer.cs b/NHSE.Core/Structures/Map/Layers/FieldItemLayer.cs index 4db7cf5..1f05492 100644 --- a/NHSE.Core/Structures/Map/Layers/FieldItemLayer.cs +++ b/NHSE.Core/Structures/Map/Layers/FieldItemLayer.cs @@ -87,6 +87,7 @@ public int ModifyAll(int xmin, int ymin, int width, int height, Func public int RemoveAllHoles(int xmin, int ymin, int width, int height) => ClearFieldPlanted(xmin, ymin, width, height, z => z == FieldItemKind.UnitIconHole); public int RemoveAllWeeds(int xmin, int ymin, int width, int height) => ClearFieldPlanted(xmin, ymin, width, height, z => z.IsWeed()); + public int RemoveAllTrees(int xmin, int ymin, int width, int height) => ClearFieldPlanted(xmin, ymin, width, height, z => z.IsTree()); public int RemoveAllPlants(int xmin, int ymin, int width, int height) => ClearFieldPlanted(xmin, ymin, width, height, z => z.IsPlant()); public int RemoveAllFences(int xmin, int ymin, int width, int height) => ClearFieldPlanted(xmin, ymin, width, height, z => z.IsFence()); public int RemoveAllFlowers(int xmin, int ymin, int width, int height) => ClearFieldPlanted(xmin, ymin, width, height, z => z.IsFlower()); diff --git a/NHSE.WinForms/Subforms/Map/FieldItemEditor.Designer.cs b/NHSE.WinForms/Subforms/Map/FieldItemEditor.Designer.cs index 7023ee5..14cb510 100644 --- a/NHSE.WinForms/Subforms/Map/FieldItemEditor.Designer.cs +++ b/NHSE.WinForms/Subforms/Map/FieldItemEditor.Designer.cs @@ -70,6 +70,7 @@ private void InitializeComponent() this.B_RemoveAll = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.B_WaterFlowers = new System.Windows.Forms.ToolStripMenuItem(); + this.Menu_Spawn = new System.Windows.Forms.ToolStripMenuItem(); this.GB_Remove = new System.Windows.Forms.Label(); this.TC_Editor = new System.Windows.Forms.TabControl(); this.Tab_Item = new System.Windows.Forms.TabPage(); @@ -143,7 +144,7 @@ private void InitializeComponent() this.L_TileMode = new System.Windows.Forms.Label(); this.CHK_RedirectExtensionLoad = new System.Windows.Forms.CheckBox(); this.CHK_FieldItemSnap = new System.Windows.Forms.CheckBox(); - this.Menu_Spawn = new System.Windows.Forms.ToolStripMenuItem(); + this.B_RemoveAllTrees = new System.Windows.Forms.ToolStripMenuItem(); this.CM_Click.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PB_Map)).BeginInit(); this.CM_Picture.SuspendLayout(); @@ -457,6 +458,7 @@ private void InitializeComponent() // this.CM_Remove.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.B_RemoveAllWeeds, + this.B_RemoveAllTrees, this.B_RemovePlants, this.B_RemoveObjects, this.B_RemovePlacedItems, @@ -471,7 +473,7 @@ private void InitializeComponent() this.Menu_Spawn}); this.CM_Remove.Name = "CM_Picture"; this.CM_Remove.ShowImageMargin = false; - this.CM_Remove.Size = new System.Drawing.Size(156, 296); + this.CM_Remove.Size = new System.Drawing.Size(156, 318); // // B_RemoveAllWeeds // @@ -555,6 +557,13 @@ private void InitializeComponent() this.B_WaterFlowers.Text = "Water Flowers"; this.B_WaterFlowers.Click += new System.EventHandler(this.B_WaterFlowers_Click); // + // Menu_Spawn + // + this.Menu_Spawn.Name = "Menu_Spawn"; + this.Menu_Spawn.Size = new System.Drawing.Size(155, 22); + this.Menu_Spawn.Text = "Spawn..."; + this.Menu_Spawn.Click += new System.EventHandler(this.Menu_Spawn_Click); + // // GB_Remove // this.GB_Remove.AutoSize = true; @@ -1329,12 +1338,12 @@ private void InitializeComponent() this.CHK_FieldItemSnap.Text = "Snap Field Items to Grid on Set"; this.CHK_FieldItemSnap.UseVisualStyleBackColor = true; // - // Menu_Spawn + // B_RemoveAllTrees // - this.Menu_Spawn.Name = "Menu_Spawn"; - this.Menu_Spawn.Size = new System.Drawing.Size(155, 22); - this.Menu_Spawn.Text = "Spawn..."; - this.Menu_Spawn.Click += new System.EventHandler(this.Menu_Spawn_Click); + this.B_RemoveAllTrees.Name = "B_RemoveAllTrees"; + this.B_RemoveAllTrees.Size = new System.Drawing.Size(155, 22); + this.B_RemoveAllTrees.Text = "Trees"; + this.B_RemoveAllTrees.Click += new System.EventHandler(this.B_RemoveAllTrees_Click); // // FieldItemEditor // @@ -1524,5 +1533,6 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem B_WaterFlowers; private System.Windows.Forms.CheckBox CHK_FieldItemSnap; private System.Windows.Forms.ToolStripMenuItem Menu_Spawn; + private System.Windows.Forms.ToolStripMenuItem B_RemoveAllTrees; } } \ No newline at end of file diff --git a/NHSE.WinForms/Subforms/Map/FieldItemEditor.cs b/NHSE.WinForms/Subforms/Map/FieldItemEditor.cs index 350e0e2..de71aac 100644 --- a/NHSE.WinForms/Subforms/Map/FieldItemEditor.cs +++ b/NHSE.WinForms/Subforms/Map/FieldItemEditor.cs @@ -703,6 +703,7 @@ private void Modify(ToolStripItem sender, Func action) } private void B_RemoveAllWeeds_Click(object sender, EventArgs e) => Remove(B_RemoveAllWeeds, Map.CurrentLayer.RemoveAllWeeds); + private void B_RemoveAllTrees_Click(object sender, EventArgs e) => Remove(B_RemoveAllWeeds, Map.CurrentLayer.RemoveAllTrees); private void B_FillHoles_Click(object sender, EventArgs e) => Remove(B_FillHoles, Map.CurrentLayer.RemoveAllHoles); private void B_RemovePlants_Click(object sender, EventArgs e) => Remove(B_RemovePlants, Map.CurrentLayer.RemoveAllPlants); private void B_RemoveFences_Click(object sender, EventArgs e) => Remove(B_RemoveFences, Map.CurrentLayer.RemoveAllFences);