GeorgeKolog 6 лет назад
Родитель
Сommit
829dea3956
2 измененных файлов с 18 добавлено и 38 удалено
  1. 2 17
      include/units/unit.h
  2. 16 21
      source/Cell.cpp

+ 2 - 17
include/units/unit.h

@@ -1,11 +1,9 @@
 #pragma once
 
-#include "abstractfactory.h"
-
+#include "../include/abstractfactory.h"
 #include <QObject>
 #include <QString>
 #include <QImage>
-
 #include <iostream>
 #include <vector>
 
@@ -14,19 +12,6 @@ public:
     int a;
 };
 
-class Cell {
-	//waiting for a realisation
-public:
-	//must be in cell.h
-	bool isEmpty() { 
-		return true;
-	}
-    std::vector <Cell*> actualPath(Cell*) { //the shortest existing path from (*this) to (*destination)
-		std::vector <Cell*> path;
-		return path;
-	}
-};
-
 class Unit : public QObject {
     Q_OBJECT
 
@@ -88,7 +73,7 @@ public:
 
     virtual double reduceIncomingDamage(std::string damageType, int value);
 
-    virtual	bool canAttackForDistance(int ) {return false;}
+    virtual	bool canAttackForDistance(std::string, int) {return false;}
 
     virtual bool canAttackToCell(Cell* ) {return false;}
 

+ 16 - 21
source/Cell.cpp

@@ -1,24 +1,21 @@
-#include "Cell.h"
+#include "../include/Cell.h"
 #include <assert.h>
 #include <string>
 #include <string.h>
-//#include "unit.h"
+/*
+ * ????? ??????? ??? ???? ? ?????????? ?????????? ????
+ */
+//#include "../include/units/unit.h"
+class Unit{
+public:
+    bool canMoveForDistance(int);
+    bool canAttackForDistance(std::string, int);
+};
 #include <queue>
 #include <vector>
 #include <map>
 #include <iostream>
 
-class Unit{
-private:
-public:
-    bool CanMoveForDistance(int distance){
-        return true;
-    }
-    bool CanAttackForDistance(std::string AttackType, int distance){
-        return true;
-    }
-};
-
 class EffectsForCell{
 public:
 	void OperateOnCell(Cell*){}
@@ -215,12 +212,12 @@ void Cell::clearTable_() {
 void Cell::recalcAttackable_(Cell * Now,bool isReached){
     if(Now == nullptr)return;
     if (!isEmpty() && !Now->isEmpty() &&
-        getCharacter()->CanAttackForDistance("Melee", Now->getdistance_barrier())
+        getCharacter()->canAttackForDistance("Melee", Now->getdistance_barrier())
             ) {
         Now->setisMeleeAttackAble(isReached);
     }
     if (!isEmpty() && !Now->isEmpty() &&
-        getCharacter()->CanAttackForDistance("Range", Now->getdistance_barrier())
+        getCharacter()->canAttackForDistance("Range", Now->getdistance_barrier())
             ) {
         Now->setisRangeAttackAble(true);
     }
@@ -229,7 +226,7 @@ void Cell::recalcAttackable_(Cell * Now,bool isReached){
 void Cell::recalcMoveable_(Cell * Now, bool isReached){
     if(Now == nullptr || Now->isEmpty() || isEmpty())return;
     if(!isEmpty() && Now->isEmpty() &&
-	   getCharacter()->CanMoveForDistance(Now->getdistance_barrier())){
+	   getCharacter()->canMoveForDistance(Now->getdistance_barrier())){
     	Now->setisMoveAble(isReached);
     }
 }
@@ -287,10 +284,6 @@ void Cell::updateUnMovealeCells_(std::queue<Cell*> & Q) {
 	}
 }
 
-void Cell::print() {
-	std::cout << "(" << col_ << ", " << row_ << ")";
-}
-
 Cell* Cell::getRealShootTarget(Cell* next){
 	if(next == this){
 		return next;
@@ -339,4 +332,6 @@ Cell* Cell::getRealShootTarget(Cell* next){
 		if(next_row < row_main_diag)return getrightDown();
 		return getright();
 	}
-}
+}
+
+int main(){}