|
@@ -1,24 +1,11 @@
|
|
|
#include "Cell.h"
|
|
|
-#include <assert.h>
|
|
|
+#include "unit.h"
|
|
|
#include <string>
|
|
|
-#include <string.h>
|
|
|
-//#include "unit.h"
|
|
|
#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*){}
|
|
@@ -161,7 +148,7 @@ std::vector <Cell*> Cell::actualPath(Cell* to) {
|
|
|
parent = TestParent;
|
|
|
}
|
|
|
};
|
|
|
- assert(parent != nullptr);
|
|
|
+ if(parent == nullptr) throw std::string("Don`t recalculated");
|
|
|
f(to->getleftUp(), to);
|
|
|
f(to->getleft(), to);
|
|
|
f(to->getleftDown(), to);
|
|
@@ -215,12 +202,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 +216,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 +274,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 +322,4 @@ Cell* Cell::getRealShootTarget(Cell* next){
|
|
|
if(next_row < row_main_diag)return getrightDown();
|
|
|
return getright();
|
|
|
}
|
|
|
-}
|
|
|
+}
|