Skip to content
Snippets Groups Projects
Commit 39222d86 authored by Ian Prins's avatar Ian Prins
Browse files

return refs, allow coord setting

parent c41a9ae7
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,9 @@
class Mob {
public:
Mob(std::string, Coord);
Coord getCoord();
Coord& getCoord();
void setCoord(Coord);
int& operator[](int);
std::string getName();
private:
std::string name;
......
......@@ -7,10 +7,18 @@ Mob::Mob(std::string name, Coord coord)
, coord(coord)
{}
Coord Mob::getCoord() {
Coord& Mob::getCoord() {
return coord;
}
void Mob::setCoord(Coord newPos) {
coord = newPos;
}
int& Mob::operator[](int dimension) {
return coord[dimension];
}
std::string Mob::getName() {
return name;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment