Description:
Add tree states.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r81:cb11766b9925 -

@@ -184,27 +184,40
184 184
185 185 }
186 186
187 public enum CellStatus{
188 Clear,
189 LivingTree,
190 DeadTree
191 }
192
187 193 public class Cell
188 194 {
189 public Boolean _hasTree = false;
195 // public Boolean _hasTree = false;
196 public CellStatus status {
197 get;
198 private set;
199 }
190 200
191 201 public Boolean hasTree {
192 202 get {
193 return _hasTree;
203 return this.status == CellStatus.LivingTree;
194 204 }
195 205 }
196 206
197 207 public DateTime planted;
198 208
199 209 public void addTree(DateTime datetime) {
200 this._hasTree = true;
210 this.status = CellStatus.LivingTree;
201 211
202 212 this.planted = datetime;
213 }
203 214
204 }
205 215 public void removeTree() {
206 this._hasTree = false;
216 this.status = CellStatus.Clear;
217 }
207 218
219 public void markTreeDead() {
220 this.status = CellStatus.DeadTree;
208 221 }
209 222 }
210 223 }
@@ -707,15 +707,21
707 707
708 708 if (this.simulation.map.cells[i][j].hasTree)
709 709 { //until we actually simulate:
710 if ((i + j) % 8 == 0)
711 {
710 drawTileAt(i, j, 142, 2);
711 // if ((i + j) % 8 == 0)
712 // {
713 // drawTileAt(i, j, 141, 2);
714 // }
715 // else
716 // {
717 // drawTileAt(i, j, 142, 2);
718 // }
719 }
720 else if (this.simulation.map.cells[i][j].status == CellStatus.DeadTree) {
712 721 drawTileAt(i, j, 141, 2);
713 }
714 else
715 {
716 drawTileAt(i, j, 142, 2);
717 }
718 }
722 // System.Console.WriteLine(String.Format("Drew Dead Tree at {0},{1}", i, j));
723
724 }
719 725 }
720 726 }
721 727 #endregion draw_trees
@@ -239,7 +239,7
239 239 {
240 240 if (random.NextDouble() > NEIGHBOR_CROWDS_TREE_CHANCE)
241 241 {
242 cell.removeTree();
242 cell.markTreeDead();
243 243 crowded_out += 1;
244 244 }
245 245 }
You need to be logged in to leave comments. Login now