diff --git a/isometric-park-fna/CellMap.cs b/isometric-park-fna/CellMap.cs --- a/isometric-park-fna/CellMap.cs +++ b/isometric-park-fna/CellMap.cs @@ -158,7 +158,9 @@ int count = 0; foreach (Cell neighbor in this.iterate_neighbors(x, y)) { - count++; + if (neighbor.hasTree) { + count++; + } } return count; diff --git a/isometric-park-fna/Simulation.cs b/isometric-park-fna/Simulation.cs --- a/isometric-park-fna/Simulation.cs +++ b/isometric-park-fna/Simulation.cs @@ -41,6 +41,9 @@ private const float NEIGHBOR_NEW_TREE_CHANCE = 0.995f; private const float NEIGHBOR_CROWDS_TREE_CHANCE = 0.995f; + public const int TREE_PLANT_COST = 100; + public const int TREE_CLEAR_COST = 50; + public int Tick { get; @@ -212,6 +215,7 @@ int trees_to_clear = this.tree_clearing; IEnumerator neigh = this.map.iterate_cells_with_neighbors(7).GetEnumerator(); + neigh.MoveNext(); while (trees_to_clear > 0 && neigh.Current != null) { @@ -231,8 +235,8 @@ trees = this.map.tree_count, subsidy = 1000, upkeep = this.map.tree_count * 1, - tree_planting = this.tree_planting * 100, - tree_clearing = this.tree_clearing * 100 + tree_planting = this.tree_planting * Simulation.TREE_PLANT_COST, + tree_clearing = this.tree_clearing * Simulation.TREE_CLEAR_COST }; diff --git a/isometric-park-fna/UI/ForestWindow.cs b/isometric-park-fna/UI/ForestWindow.cs --- a/isometric-park-fna/UI/ForestWindow.cs +++ b/isometric-park-fna/UI/ForestWindow.cs @@ -1,6 +1,7 @@ using ImGuiNET; using Num = System.Numerics; +using System.Linq; namespace isometricparkfna.UI { @@ -34,13 +35,15 @@ int new_tree_planting = sim.tree_planting; - ImGui.SliderInt("Tree Planting ($100 ea.)", ref new_tree_planting, 0, 25); + ImGui.SliderInt("Tree Planting ", ref new_tree_planting, 0, 25, string.Format("%d (${0})", new_tree_planting*Simulation.TREE_PLANT_COST)); sim.tree_planting = new_tree_planting; int new_tree_clearing = sim.tree_clearing; - ImGui.SliderInt("Tree Clearing ($100 ea.)", ref new_tree_clearing, 0, 25); + ImGui.SliderInt("Tree Clearing", ref new_tree_clearing, 0, 25, string.Format("%d (${0})", new_tree_clearing*Simulation.TREE_CLEAR_COST)); sim.tree_clearing = new_tree_clearing; + ImGui.Text(string.Format("Crowded Trees: {0}", sim.map.iterate_cells_with_neighbors(7).Count())); //via LINQ + if (ImGui.Button("Okay")) { show = false;