From b17b9021ecf9b16c265d0a6b60faa761b34eae35 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Tue, 12 Feb 2013 20:18:58 -0800 Subject: Replace mt_rand with Also add some utility methods and classes. --- src/map/path.cpp | 53 +---------------------------------------------------- 1 file changed, 1 insertion(+), 52 deletions(-) (limited to 'src/map/path.cpp') diff --git a/src/map/path.cpp b/src/map/path.cpp index 1a4385b..9c6ea28 100644 --- a/src/map/path.cpp +++ b/src/map/path.cpp @@ -1,5 +1,5 @@ #include "../common/cxxstdio.hpp" -#include "../common/mt_rand.hpp" +#include "../common/random.hpp" #include "../common/nullpo.hpp" #include "battle.hpp" @@ -221,57 +221,6 @@ int can_move(struct map_data *m, int x0, int y0, int x1, int y1, int flag) return 1; } -/*========================================== - * (x0,y0)から(dx,dy)方向へcountセル分 - * 吹き飛ばしたあとの座標を所得 - *------------------------------------------ - */ -int path_blownpos(int m, int x0, int y0, int dx, int dy, int count) -{ - struct map_data *md; - - if (!map[m].gat) - return -1; - md = &map[m]; - - if (count > 15) - { // 最大10マスに制限 - if (battle_config.error_log) - PRINTF("path_blownpos: count too many %d !\n", count); - count = 15; - } - if (dx > 1 || dx < -1 || dy > 1 || dy < -1) - { - if (battle_config.error_log) - PRINTF("path_blownpos: illeagal dx=%d or dy=%d !\n", dx, dy); - dx = (dx >= 0) ? 1 : ((dx < 0) ? -1 : 0); - dy = (dy >= 0) ? 1 : ((dy < 0) ? -1 : 0); - } - - while ((count--) > 0 && (dx != 0 || dy != 0)) - { - if (!can_move(md, x0, y0, x0 + dx, y0 + dy, 0)) - { - int fx = (dx != 0 && can_move(md, x0, y0, x0 + dx, y0, 0)); - int fy = (dy != 0 && can_move(md, x0, y0, x0, y0 + dy, 0)); - if (fx && fy) - { - if (MRAND(2)) - dx = 0; - else - dy = 0; - } - if (!fx) - dx = 0; - if (!fy) - dy = 0; - } - x0 += dx; - y0 += dy; - } - return (x0 << 16) | y0; -} - /*========================================== * path探索 (x0,y0)->(x1,y1) *------------------------------------------ -- cgit v1.2.3-60-g2f50