This commit is contained in:
aozhiwei 2018-08-26 19:34:06 +08:00
parent 841fdde99e
commit 8e58095243

View File

@ -278,10 +278,10 @@ bool TiledMap::CalcCurrPos(std::vector<int>& path_points, int old_pos_x, int old
if (path_points.size() < 2) {
return false;
}
std::string path_point;
std::vector<std::string> stage_path_list;
{
std::string path_point;
bool path_start = true;
std::vector<GridCell*> grid_all_list;
for (auto& point : path_points) {
if (path_start) {
path_point = a8::XValue(point).GetString();
@ -293,7 +293,9 @@ bool TiledMap::CalcCurrPos(std::vector<int>& path_points, int old_pos_x, int old
path_point = point_str;
}
}
}
std::vector<GridCell*> grid_all_list;
{
bool exc_once = true;
for (auto& stage_path : stage_path_list) {
std::vector<GridCell*>* grid_list = nullptr;
@ -328,10 +330,12 @@ bool TiledMap::CalcCurrPos(std::vector<int>& path_points, int old_pos_x, int old
grid_all_list.insert(grid_all_list.end(),grid_sort_list.begin()+1,grid_sort_list.end());
}
}
}
if (grid_all_list.empty()) {
return false;
}
{
int grid_all_count = grid_all_list.size();
for (int i = 0; i < grid_all_count-1; ++i) {
GridCell* gc_first = grid_all_list[i];
@ -355,6 +359,7 @@ bool TiledMap::CalcCurrPos(std::vector<int>& path_points, int old_pos_x, int old
return true;
}
}
}
if (time_ms > 0) {
return true;
}