summaryrefslogtreecommitdiff
path: root/src/tool/mapcache.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-12-26 21:51:58 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-12-26 21:51:58 +0000
commitdfe4ede046db94e2e6e580d2efa13bb9a773ce15 (patch)
tree1ec283a09218b5437425b98ecfab67a207b2a305 /src/tool/mapcache.c
parent1e452a27de8de22d933f5b37c407aa3980948a66 (diff)
downloadhercules-dfe4ede046db94e2e6e580d2efa13bb9a773ce15.tar.gz
hercules-dfe4ede046db94e2e6e580d2efa13bb9a773ce15.tar.bz2
hercules-dfe4ede046db94e2e6e580d2efa13bb9a773ce15.tar.xz
hercules-dfe4ede046db94e2e6e580d2efa13bb9a773ce15.zip
Fixed the incorrect interpretation of the map-cell height information stored in .gat files; this was causing an overall of 20000 cells to be treated as water when officially they aren't.
A full mapcache rebuild is needed to apply this change. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11982 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/tool/mapcache.c')
-rw-r--r--src/tool/mapcache.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/tool/mapcache.c b/src/tool/mapcache.c
index b204cf7c7..c74484339 100644
--- a/src/tool/mapcache.c
+++ b/src/tool/mapcache.c
@@ -110,7 +110,7 @@ int read_map(char *name, struct map_data *m)
unsigned char *gat, *rsw;
int water_height;
size_t xy, off, num_cells;
- float height[4];
+ float height;
unsigned long type;
// Open map GAT
@@ -140,18 +140,16 @@ int read_map(char *name, struct map_data *m)
off = 14;
for (xy = 0; xy < num_cells; xy++)
{
- // Height of the corners
- height[0] = GetFloat( gat + off );
- height[1] = GetFloat( gat + off + 4 );
- height[2] = GetFloat( gat + off + 8 );
- height[3] = GetFloat( gat + off + 12 );
+ // Height of the bottom-left corner
+ height = GetFloat( gat + off );
// Type of cell
- type = GetULong( gat + off + 16 );
+ type = GetULong( gat + off + 16 );
off += 20;
- if (water_height != NO_WATER && type == 0 && (height[0] > water_height || height[1] > water_height || height[2] > water_height || height[3] > water_height))
- m->cells[xy] = 3; // Cell is 0 (walkable) but under water level, set to 3 (walkable water)
- else
- m->cells[xy] = (unsigned char)type;
+
+ if (type == 0 && water_height != NO_WATER && height > water_height)
+ type = 3; // Cell is 0 (walkable) but under water level, set to 3 (walkable water)
+
+ m->cells[xy] = (unsigned char)type;
}
free(gat);