summaryrefslogtreecommitdiff
path: root/src/map/path.c
diff options
context:
space:
mode:
author(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-01-26 14:28:19 +0000
committer(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-01-26 14:28:19 +0000
commit7923c32b8ebfbebd09dc0d783e93fef51a4ec38b (patch)
tree9ab81fa169eb48e71e208f080e5f776f066cad51 /src/map/path.c
parent8ca00fc7e0e1457b1cb1537e2caeefa150344360 (diff)
downloadhercules-7923c32b8ebfbebd09dc0d783e93fef51a4ec38b.tar.gz
hercules-7923c32b8ebfbebd09dc0d783e93fef51a4ec38b.tar.bz2
hercules-7923c32b8ebfbebd09dc0d783e93fef51a4ec38b.tar.xz
hercules-7923c32b8ebfbebd09dc0d783e93fef51a4ec38b.zip
* Fixed a bug in gettick cache when compiling in Windows
- Changed "read_map_from_bitmap" to "read_map_from_cache" in map_athena, "map_bitmap_path" to "map_cache_file" - Fixed item effects not showing when only one was used - Fixed a bug in Safety Wall - Allow only either Storm Gust or Lord of Vermillion to cause damage if stacked together - Added path_search_long, map_find_skill_unit_oncell git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@998 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/path.c')
-rw-r--r--src/map/path.c55
1 files changed, 54 insertions, 1 deletions
diff --git a/src/map/path.c b/src/map/path.c
index 9fb0ab1b7..dae7fc59a 100644
--- a/src/map/path.c
+++ b/src/map/path.c
@@ -172,7 +172,7 @@ static int can_place(struct map_data *m,int x,int y,int flag)
if(map_getcellp(m,x,y,CELL_CHKPASS))
return 1;
- else if((flag&0x10000)&&map_getcellp(m,x,y,CELL_CHKHIGH))
+ else if((flag&0x10000)&&map_getcellp(m,x,y,CELL_CHKGROUND))
return 1;
return 0;
}
@@ -242,6 +242,59 @@ int path_blownpos(int m,int x0,int y0,int dx,int dy,int count)
}
/*==========================================
+ * ?ʦɪ
+ *------------------------------------------
+ */
+#define swap(x,y) { int t; t = x; x = y; y = t; }
+int path_search_long(int m,int x0,int y0,int x1,int y1)
+{
+ int dx, dy;
+ int wx = 0, wy = 0;
+ int weight;
+ struct map_data *md;
+
+ if (!map[m].gat)
+ return 0;
+ md = &map[m];
+
+ dx = (x1 - x0);
+ if (dx < 0) {
+ swap(x0, x1);
+ swap(y0, y1);
+ dx = -dx;
+ }
+ dy = (y1 - y0);
+
+ if (map_getcellp(md,x1,y1,CELL_CHKWALL))
+ return 0;
+
+ if (dx > abs(dy))
+ weight = dx;
+ else
+ weight = abs(y1 - y0);
+
+ while (x0 != x1 && y0 != y1) {
+ if (map_getcellp(md,x0,y0,CELL_CHKWALL))
+ return 0;
+ wx += dx;
+ wy += dy;
+ if (wx >= weight) {
+ wx -= weight;
+ x0 ++;
+ }
+ if (wy >= weight) {
+ wy -= weight;
+ y0 ++;
+ } else if (wy < 0) {
+ wy += weight;
+ y0 --;
+ }
+ }
+
+ return 1;
+}
+
+/*==========================================
* pathT (x0,y0)->(x1,y1)
*------------------------------------------
*/