Description:
Tweak Forest Policy dialog and fix incorrect neighbor calculation.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -158,7 +158,9 | |||||
|
158 | int count = 0; |
|
158 | int count = 0; |
|
159 | foreach (Cell neighbor in this.iterate_neighbors(x, y)) |
|
159 | foreach (Cell neighbor in this.iterate_neighbors(x, y)) |
|
160 | { |
|
160 | { |
|
161 | count++; |
|
161 | if (neighbor.hasTree) { |
|
|
162 | count++; | ||
|
|
163 | } | ||
|
162 | } |
|
164 | } |
|
163 |
|
165 | ||
|
164 | return count; |
|
166 | return count; |
@@ -41,6 +41,9 | |||||
|
41 | private const float NEIGHBOR_NEW_TREE_CHANCE = 0.995f; |
|
41 | private const float NEIGHBOR_NEW_TREE_CHANCE = 0.995f; |
|
42 | private const float NEIGHBOR_CROWDS_TREE_CHANCE = 0.995f; |
|
42 | private const float NEIGHBOR_CROWDS_TREE_CHANCE = 0.995f; |
|
43 |
|
43 | ||
|
|
44 | public const int TREE_PLANT_COST = 100; | ||
|
|
45 | public const int TREE_CLEAR_COST = 50; | ||
|
|
46 | |||
|
44 | public int Tick |
|
47 | public int Tick |
|
45 | { |
|
48 | { |
|
46 | get; |
|
49 | get; |
@@ -212,6 +215,7 | |||||
|
212 | int trees_to_clear = this.tree_clearing; |
|
215 | int trees_to_clear = this.tree_clearing; |
|
213 |
|
216 | ||
|
214 | IEnumerator<Cell> neigh = this.map.iterate_cells_with_neighbors(7).GetEnumerator(); |
|
217 | IEnumerator<Cell> neigh = this.map.iterate_cells_with_neighbors(7).GetEnumerator(); |
|
|
218 | neigh.MoveNext(); | ||
|
215 |
|
219 | ||
|
216 | while (trees_to_clear > 0 && neigh.Current != null) |
|
220 | while (trees_to_clear > 0 && neigh.Current != null) |
|
217 | { |
|
221 | { |
@@ -231,8 +235,8 | |||||
|
231 | trees = this.map.tree_count, |
|
235 | trees = this.map.tree_count, |
|
232 | subsidy = 1000, |
|
236 | subsidy = 1000, |
|
233 | upkeep = this.map.tree_count * 1, |
|
237 | upkeep = this.map.tree_count * 1, |
|
234 |
tree_planting = this.tree_planting * |
|
238 | tree_planting = this.tree_planting * Simulation.TREE_PLANT_COST, |
|
235 |
tree_clearing = this.tree_clearing * |
|
239 | tree_clearing = this.tree_clearing * Simulation.TREE_CLEAR_COST |
|
236 | }; |
|
240 | }; |
|
237 |
|
241 | ||
|
238 |
|
242 |
@@ -1,6 +1,7 | |||||
|
1 | using ImGuiNET; |
|
1 | using ImGuiNET; |
|
2 |
|
2 | ||
|
3 | using Num = System.Numerics; |
|
3 | using Num = System.Numerics; |
|
|
4 | using System.Linq; | ||
|
4 |
|
5 | ||
|
5 | namespace isometricparkfna.UI |
|
6 | namespace isometricparkfna.UI |
|
6 | { |
|
7 | { |
@@ -34,13 +35,15 | |||||
|
34 |
|
35 | ||
|
35 |
|
36 | ||
|
36 | int new_tree_planting = sim.tree_planting; |
|
37 | int new_tree_planting = sim.tree_planting; |
|
37 |
ImGui.SliderInt("Tree Planting |
|
38 | ImGui.SliderInt("Tree Planting ", ref new_tree_planting, 0, 25, string.Format("%d (${0})", new_tree_planting*Simulation.TREE_PLANT_COST)); |
|
38 | sim.tree_planting = new_tree_planting; |
|
39 | sim.tree_planting = new_tree_planting; |
|
39 |
|
40 | ||
|
40 | int new_tree_clearing = sim.tree_clearing; |
|
41 | int new_tree_clearing = sim.tree_clearing; |
|
41 |
ImGui.SliderInt("Tree Clearing |
|
42 | ImGui.SliderInt("Tree Clearing", ref new_tree_clearing, 0, 25, string.Format("%d (${0})", new_tree_clearing*Simulation.TREE_CLEAR_COST)); |
|
42 | sim.tree_clearing = new_tree_clearing; |
|
43 | sim.tree_clearing = new_tree_clearing; |
|
43 |
|
44 | ||
|
|
45 | ImGui.Text(string.Format("Crowded Trees: {0}", sim.map.iterate_cells_with_neighbors(7).Count())); //via LINQ | ||
|
|
46 | |||
|
44 | if (ImGui.Button("Okay")) |
|
47 | if (ImGui.Button("Okay")) |
|
45 | { |
|
48 | { |
|
46 | show = false; |
|
49 | show = false; |
You need to be logged in to leave comments.
Login now