summaryrefslogtreecommitdiff
path: root/src/map/path.cpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-06-11 21:55:13 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-06-11 23:27:33 -0700
commit8b5370313dcc00a45ea5c3e8b4c497bc00fd8e13 (patch)
tree15e8a4841af992e17794f26fc7991ed40c35bd51 /src/map/path.cpp
parent8c6072df499ef9068346fbe8313b63dbba1e4e82 (diff)
downloadtmwa-8b5370313dcc00a45ea5c3e8b4c497bc00fd8e13.tar.gz
tmwa-8b5370313dcc00a45ea5c3e8b4c497bc00fd8e13.tar.bz2
tmwa-8b5370313dcc00a45ea5c3e8b4c497bc00fd8e13.tar.xz
tmwa-8b5370313dcc00a45ea5c3e8b4c497bc00fd8e13.zip
Allegedly remove all manual memory management
Diffstat (limited to 'src/map/path.cpp')
-rw-r--r--src/map/path.cpp17
1 files changed, 9 insertions, 8 deletions
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 <cassert>
+
#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;