Browse Source

add TODOs for places where "new" is used during per-frame code

Fixes #12.
master
Colin McMillen 4 years ago
parent
commit
7625339d4c
  1. 1
      Shared/History.cs
  2. 1
      Shared/Line.cs
  3. 2
      Shared/Player.cs

1
Shared/History.cs

@ -51,6 +51,7 @@ namespace SemiColinGames {
}
// This creates and populates a new array. It's O(n) and should probably only be used for tests.
// TODO: restrict visibility so that it can only be used by tests.
public T[] ToArray() {
T[] result = new T[items.Length];
for (int i = 0; i < items.Length; i++) {

1
Shared/Line.cs

@ -22,6 +22,7 @@ namespace SemiColinGames {
int errorXY; // Error value e_xy from the PDF.
// The size of the output is the size of the longer dimension, plus one.
int resultSize = Math.Max(dx, -dy) + 1;
// TODO: an array or list should be passed in by the caller.
var result = new Point[resultSize];
int i = 0;

2
Shared/Player.cs

@ -83,6 +83,8 @@ namespace SemiColinGames {
}
bool harmedByCollision = false;
// TODO: pass in movePoints to Line.Rasterize instead of having that function allocate a
// new array.
Point[] movePoints = Line.Rasterize(0, 0, (int) movement.X, (int) movement.Y);
for (int i = 1; i < movePoints.Length; i++) {
int dx = movePoints[i].X - movePoints[i - 1].X;

Loading…
Cancel
Save