Browse Source

Switched location to Cell*, codestyle corrections

noath 7 years ago
parent
commit
36e0a3eb9d
2 changed files with 11 additions and 8 deletions
  1. 3 3
      unit.cpp
  2. 8 5
      unit.h

+ 3 - 3
unit.cpp

@@ -56,11 +56,11 @@ void Unit::setAttackRange(double value) {
 	attack_range_ = value;
 }
 
-std::pair<int, int> Unit::getLocation() {
+Cell* Unit::getLocation() {
 	return location_;
 }
-void Unit::setLocation(double x, double y) {
-	location_ = std::make_pair(x, y);
+void Unit::setLocation(Cell* to) {
+	location_ = to;
 }
 
 double Unit::getMovementSpeed() {

+ 8 - 5
unit.h

@@ -5,6 +5,9 @@
 class Spell {
 	//empty for allow to compile
 };
+class Cell {
+	//waiting a realisation
+};
 
 class Unit {
 
@@ -21,7 +24,7 @@ private:
 	double initiative_;
 
 	//movement
-	std::pair <int, int> location_; //x - first, y - second
+	Cell* location_; //x - first, y - second
 	double movement_speed_;
 
 	//attack action
@@ -63,14 +66,14 @@ public:
 	double getAttackRange();
 	void setAttackRange(double value);
 
-	std::pair<int, int> getLocation();
-	void setLocation(double x, double y);
+	Cell* getLocation();
+	void setLocation(Cell* to);
 
 	double getMovementSpeed();
 	void setMovementSpeed(double value);
 
-	double getInitiative_();
-	void setInitiative_(double value);
+	double getInitiative();
+	void setInitiative(double value);
 
 	double getDamagePerHit();
 	void setDamagePerHit(double value);