From 8b5370313dcc00a45ea5c3e8b4c497bc00fd8e13 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Tue, 11 Jun 2013 21:55:13 -0700 Subject: Allegedly remove all manual memory management --- src/map/path.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/map/path.cpp') diff --git a/src/map/path.cpp b/src/map/path.cpp index 7a8eb37..b938e3b 100644 --- a/src/map/path.cpp +++ b/src/map/path.cpp @@ -1,9 +1,12 @@ +#include "path.hpp" + +#include + #include "../common/cxxstdio.hpp" #include "../common/random.hpp" #include "../common/nullpo.hpp" #include "battle.hpp" -#include "map.hpp" #include "../poison.hpp" @@ -182,7 +185,7 @@ int add_path(int *heap, struct tmp_path *tp, int x, int y, int dist, *------------------------------------------ */ static -bool can_place(struct map_data *m, int x, int y) +bool can_place(struct map_local *m, int x, int y) { nullpo_ret(m); @@ -194,7 +197,7 @@ bool can_place(struct map_data *m, int x, int y) *------------------------------------------ */ static -int can_move(struct map_data *m, int x0, int y0, int x1, int y1) +int can_move(struct map_local *m, int x0, int y0, int x1, int y1) { nullpo_ret(m); @@ -217,19 +220,17 @@ int can_move(struct map_data *m, int x0, int y0, int x1, int y1) * path探索 (x0,y0)->(x1,y1) *------------------------------------------ */ -int path_search(struct walkpath_data *wpd, int m, int x0, int y0, int x1, int y1, int flag) +int path_search(struct walkpath_data *wpd, map_local *m, int x0, int y0, int x1, int y1, int flag) { int heap[MAX_HEAP + 1]; struct tmp_path tp[MAX_WALKPATH * MAX_WALKPATH]; int i, rp, x, y; - struct map_data *md; int dx, dy; nullpo_ret(wpd); - if (!map[m].gat) - return -1; - md = &map[m]; + assert (m->gat); + map_local *md = m; if (x1 < 0 || x1 >= md->xs || y1 < 0 || y1 >= md->ys || bool(read_gatp(md, x1, y1) & MapCell::UNWALKABLE)) return -1; -- cgit v1.2.3-70-g09d2