Description:
Small tweak for performance.
Did some easy changes that seem to make a small difference.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -723,9 +723,9 | |||||
|
723 |
|
723 | ||
|
724 | for (int i = 0; i < this.simulation.map.MapHeight; i++) |
|
724 | for (int i = 0; i < this.simulation.map.MapHeight; i++) |
|
725 | { |
|
725 | { |
|
726 |
for (int j = 0; j < this.simulation.map.MapWidth; j |
|
726 | for (int j = 0; j < this.simulation.map.MapWidth; j++) |
|
727 | { |
|
727 | { |
|
728 |
|
|
728 | drawTileAt(i, j, 1, 1, Color.White, batch); |
|
729 | this.tilesDrawn++; |
|
729 | this.tilesDrawn++; |
|
730 | } |
|
730 | } |
|
731 | } |
|
731 | } |
@@ -836,27 +836,32 | |||||
|
836 | stopWatch2 = new Stopwatch(); |
|
836 | stopWatch2 = new Stopwatch(); |
|
837 | stopWatch2.Start(); |
|
837 | stopWatch2.Start(); |
|
838 | #region draw_trees |
|
838 | #region draw_trees |
|
|
839 | //Pulling these out seems to make it marginally faster. | ||
|
|
840 | List<isometricparkfna.CellMap.Cell> row; | ||
|
|
841 | Cell curent_cell; | ||
|
839 | if (this.showTrees) { |
|
842 | if (this.showTrees) { |
|
840 | for (int i = 0; i < this.simulation.map.MapHeight; i++) |
|
843 | for (int i = 0; i < this.simulation.map.MapHeight; i++) |
|
841 | { |
|
844 | { |
|
|
845 | row = this.simulation.map.cells[i]; | ||
|
842 | for (int j = 0; j < this.simulation.map.MapWidth; j += 1) |
|
846 | for (int j = 0; j < this.simulation.map.MapWidth; j += 1) |
|
843 | { |
|
847 | { |
|
844 | if (this.simulation.map.cells[i][j].HasTree) |
|
848 | curent_cell = row[j]; |
|
|
849 | if (curent_cell.HasTree) | ||
|
845 | { //until we actually simulate: |
|
850 | { //until we actually simulate: |
|
846 |
if ( |
|
851 | if (curent_cell.Type == TreeType.GenericDeciduous) { |
|
847 | drawTileAt(i, j, 252, 2); // 142, , 262 |
|
852 | drawTileAt(i, j, 252, 2); // 142, , 262 |
|
848 | } |
|
853 | } |
|
849 |
else if ( |
|
854 | else if (curent_cell.Type == TreeType.Oak) { |
|
850 | drawTileAt(i, j, 142, 2); |
|
855 | drawTileAt(i, j, 142, 2); |
|
851 | } |
|
856 | } |
|
852 |
else if ( |
|
857 | else if (curent_cell.Type == TreeType.GenericShrub) { |
|
853 | drawTileAt(i, j, 210, 2); |
|
858 | drawTileAt(i, j, 210, 2); |
|
854 | } |
|
859 | } |
|
855 | else { |
|
860 | else { |
|
856 | drawTileAt(i, j, 122, 2); //122, 203, 221 |
|
861 | drawTileAt(i, j, 122, 2); //122, 203, 221 |
|
857 | } |
|
862 | } |
|
858 | } |
|
863 | } |
|
859 |
else if ( |
|
864 | else if (curent_cell.Status == CellStatus.DeadTree) { |
|
860 | drawTileAt(i, j, 141, 2); |
|
865 | drawTileAt(i, j, 141, 2); |
|
861 | } |
|
866 | } |
|
862 | } |
|
867 | } |
You need to be logged in to leave comments.
Login now