Description:
Add another tree type.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -187,8 +187,11 | |||||
|
187 | } |
|
187 | } |
|
188 |
|
188 | ||
|
189 | public enum TreeType { |
|
189 | public enum TreeType { |
|
|
190 | Oak, | ||
|
|
191 | GenericEvergreen, | ||
|
190 | GenericDeciduous, |
|
192 | GenericDeciduous, |
|
191 |
Generic |
|
193 | GenericShrub |
|
|
194 | |||
|
192 | } |
|
195 | } |
|
193 |
|
196 | ||
|
194 | public class Cell |
|
197 | public class Cell |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -172,7 +172,7 | |||||
|
172 | } |
|
172 | } |
|
173 | else if (delta.deltaTrees.Value > 0) |
|
173 | else if (delta.deltaTrees.Value > 0) |
|
174 | { |
|
174 | { |
|
175 |
var random_type = random_generator.Next(0, |
|
175 | var random_type = random_generator.Next(0, 3); |
|
176 | cell.AddTree(this.simulation.DateTime, (CellMap.TreeType)random_type); |
|
176 | cell.AddTree(this.simulation.DateTime, (CellMap.TreeType)random_type); |
|
177 | added++; |
|
177 | added++; |
|
178 | } |
|
178 | } |
@@ -53,7 +53,7 | |||||
|
53 | int random_month = random_generator.Next(1, 13); |
|
53 | int random_month = random_generator.Next(1, 13); |
|
54 | DateTime random_date = new DateTime(random_year, random_month, 1); |
|
54 | DateTime random_date = new DateTime(random_year, random_month, 1); |
|
55 |
|
55 | ||
|
56 |
int random_type = random_generator.Next(0, |
|
56 | int random_type = random_generator.Next(0, 4); |
|
57 |
|
57 | ||
|
58 | cell.AddTree(random_date, (TreeType)random_type); |
|
58 | cell.AddTree(random_date, (TreeType)random_type); |
|
59 | } |
|
59 | } |
@@ -742,7 +742,13 | |||||
|
742 | if (this.simulation.map.cells[i][j].HasTree) |
|
742 | if (this.simulation.map.cells[i][j].HasTree) |
|
743 | { //until we actually simulate: |
|
743 | { //until we actually simulate: |
|
744 | if (this.simulation.map.cells[i][j].Type == TreeType.GenericDeciduous) { |
|
744 | if (this.simulation.map.cells[i][j].Type == TreeType.GenericDeciduous) { |
|
745 | drawTileAt(i, j, 252, 2); // 142, , 262 |
|
745 | drawTileAt(i, j, 252, 2); // 142, , 262 |
|
|
746 | } | ||
|
|
747 | else if (this.simulation.map.cells[i][j].Type == TreeType.Oak) { | ||
|
|
748 | drawTileAt(i, j, 142, 2); | ||
|
|
749 | } | ||
|
|
750 | else if (this.simulation.map.cells[i][j].Type == TreeType.GenericShrub) { | ||
|
|
751 | drawTileAt(i, j, 210, 2); | ||
|
746 | } |
|
752 | } |
|
747 | else { |
|
753 | else { |
|
748 | drawTileAt(i, j, 122, 2); //122, 203, 221 |
|
754 | drawTileAt(i, j, 122, 2); //122, 203, 221 |
@@ -270,7 +270,7 | |||||
|
270 | { |
|
270 | { |
|
271 | if (random.NextDouble() > SPONTANEOUS_NEW_TREE_CHANCE) |
|
271 | if (random.NextDouble() > SPONTANEOUS_NEW_TREE_CHANCE) |
|
272 | { |
|
272 | { |
|
273 |
var random_type = random.Next(0, |
|
273 | var random_type = random.Next(0, 4); |
|
274 | cell.AddTree(this.DateTime, (TreeType)random_type); |
|
274 | cell.AddTree(this.DateTime, (TreeType)random_type); |
|
275 | } |
|
275 | } |
|
276 | } |
|
276 | } |
@@ -280,7 +280,7 | |||||
|
280 | { |
|
280 | { |
|
281 | if (random.NextDouble() > NEIGHBOR_NEW_TREE_CHANCE) |
|
281 | if (random.NextDouble() > NEIGHBOR_NEW_TREE_CHANCE) |
|
282 | { |
|
282 | { |
|
283 |
var random_type = random.Next(0, |
|
283 | var random_type = random.Next(0, 4); |
|
284 | cell.AddTree(this.DateTime, (TreeType)random_type); |
|
284 | cell.AddTree(this.DateTime, (TreeType)random_type); |
|
285 | new_planted += 1; |
|
285 | new_planted += 1; |
|
286 | } |
|
286 | } |
@@ -304,7 +304,7 | |||||
|
304 | Cell chosen_cell = this.map.cells[x][y]; |
|
304 | Cell chosen_cell = this.map.cells[x][y]; |
|
305 |
|
305 | ||
|
306 | if (!chosen_cell.HasTree) { |
|
306 | if (!chosen_cell.HasTree) { |
|
307 |
var random_type = random.Next(0, |
|
307 | var random_type = random.Next(0, 4); |
|
308 | chosen_cell.AddTree(this.DateTime, (TreeType)random_type); |
|
308 | chosen_cell.AddTree(this.DateTime, (TreeType)random_type); |
|
309 | trees_to_plant -= 1; |
|
309 | trees_to_plant -= 1; |
|
310 | } |
|
310 | } |
You need to be logged in to leave comments.
Login now