--- a/pmc/cube.cc
+++ b/pmc/cube.cc
@@ -22,10 +22,11 @@
height = 25;
}
-Cube::Cube (Surface * s, Vector p1, Vector p2, Vector p3, Vector p4, int h)
+Cube::Cube (Surface * s, Vector& p1, Vector& p2, Vector& p3, Vector& p4, int h)
{
height = h;
surface = s;
+ Vector location(h/2, h/2);
P[0] = new Vector (p1);
P[1] = new Vector (p2);
@@ -34,13 +35,13 @@
for (int i = 0; i < 4; i++) {
P[4 + i] = new Vector (*P[i]);
- *P[4 + i] = *P[i] + Vector (h / 2, h / 2);
+ *P[4 + i] = *P[i] + location;
}
}
Cube::~Cube ()
{
- for (int i = 0; i < 6; i++) {
+ for (int i = 0; i < 8; i++) {
#ifdef DEBUG
fprintf (stderr, "Removing P[%d]: ", i);
#endif