From 611c2fae03c075f31a8e8fc2064c7f79ce65d618 Mon Sep 17 00:00:00 2001 From: songhao Date: Fri, 7 Sep 2018 11:19:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=BB=E7=BA=BF=E7=AE=97=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cpp/tiledmap.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cpp/tiledmap.cc b/cpp/tiledmap.cc index acf9daf..ab77e87 100644 --- a/cpp/tiledmap.cc +++ b/cpp/tiledmap.cc @@ -280,10 +280,15 @@ bool TiledMap::CalcCurrPos(std::vector& path_points, int old_pos_x, int old } StagePoint* sp_terminal = GetStageObject(path_points[path_points.size()-1]); - if (sp_terminal && old_pos_x == sp_terminal->x && old_pos_y == sp_terminal->y) { - curr_pos_x = old_pos_x; - curr_pos_y = old_pos_y; - return true; + if (sp_terminal) { + if (old_pos_x == sp_terminal->x && old_pos_y == sp_terminal->y) { + curr_pos_x = old_pos_x; + curr_pos_y = old_pos_y; + return true; + } + //报错放终点 + curr_pos_x = sp_terminal->x; + curr_pos_y = sp_terminal->y; } std::vector stage_path_list;