Fixed bug in sweep and updated tests

This commit is contained in:
valtermiari 2023-03-17 11:45:32 +01:00
parent ce714db3f1
commit 78ccade17d
6 changed files with 56 additions and 32 deletions

View file

@ -15,36 +15,37 @@ class Player {
private:
string name;
Point position;
Point size;
Point direction;
string *name;
Point *position;
Point *size;
Point *direction;
public:
Player() {}
Player(string n, Point pos, Point s, Point dir)
/* Player(string n, Point pos, Point s, Point dir)
: name(n), position(pos.x, pos.y), size(s.x, s.y), direction(dir.x, dir.y)
{}
{} */
void move() {
position.x += direction.x;
position.y += direction.y;
position->x += direction->x;
position->y += direction->y;
}
void set_speed(int dx, int dy) {
direction.x = dx;
direction.y = dy;
direction->x = dx;
direction->y = dy;
}
// This is probably neccessary to initialize an object with our GC
// Since allocation and construction cannot be done at the same time
void init(string n, Point pos, Point s, Point dir) {
void init(string *n, Point *pos, Point *s, Point *dir) {
name = n;
position = pos;
size = s;
direction = dir;
}
};