aboutsummaryrefslogtreecommitdiff
path: root/src/tools/map_extractor
diff options
context:
space:
mode:
authorSubv <s.v.h21@hotmail.com>2012-08-22 18:00:58 -0500
committerSubv <s.v.h21@hotmail.com>2012-08-22 18:00:58 -0500
commit4c765aad3ddb0e8a890ee163cf3162d14c396d7e (patch)
tree6f7bd29d72cba61c83a79665fade90b93df5783a /src/tools/map_extractor
parentc3f75cdf1d8c686a3061ef6c8b63a92bae5954c8 (diff)
Core/Maps: Reduce the output map file size in the maps extractor for maps that do not have any hole information
Core/Mmaps: Fixed swimming creatures stuck in water. (Thanks Vlad and @Chevron ) Note: Re-extract maps
Diffstat (limited to 'src/tools/map_extractor')
-rw-r--r--src/tools/map_extractor/System.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp
index e34bc4221e7..ad9a663ac27 100644
--- a/src/tools/map_extractor/System.cpp
+++ b/src/tools/map_extractor/System.cpp
@@ -276,7 +276,7 @@ void ReadLiquidTypeTableDBC()
// Map file format data
static char const* MAP_MAGIC = "MAPS";
-static char const* MAP_VERSION_MAGIC = "v1.2";
+static char const* MAP_VERSION_MAGIC = "v1.3";
static char const* MAP_AREA_MAGIC = "AREA";
static char const* MAP_HEIGHT_MAGIC = "MHGT";
static char const* MAP_LIQUID_MAGIC = "MLIQ";
@@ -836,8 +836,8 @@ bool ConvertADT(char *filename, char *filename2, int /*cell_y*/, int /*cell_x*/,
else
map.holesOffset = map.heightMapOffset + map.heightMapSize;
- map.holesSize = sizeof(holes);
memset(holes, 0, map.holesSize);
+ bool hasHoles = false;
for (int i = 0; i < ADT_CELLS_PER_GRID; ++i)
{
@@ -847,12 +847,19 @@ bool ConvertADT(char *filename, char *filename2, int /*cell_y*/, int /*cell_x*/,
if (!cell)
continue;
holes[i][j] = cell->holes;
+ if (!hasHoles && cell->holes != 0)
+ hasHoles = true;
}
}
+
+ if (hasHoles)
+ map.holesSize = sizeof(holes);
+ else
+ map.holesSize = 0;
// Ok all data prepared - store it
- FILE *output=fopen(filename2, "wb");
- if(!output)
+ FILE* output = fopen(filename2, "wb");
+ if (!output)
{
printf("Can't create the output file '%s'\n", filename2);
return false;
@@ -899,8 +906,10 @@ bool ConvertADT(char *filename, char *filename2, int /*cell_y*/, int /*cell_x*/,
fwrite(&liquid_height[y+liquidHeader.offsetY][liquidHeader.offsetX], sizeof(float), liquidHeader.width, output);
}
}
+
// store hole data
- fwrite(holes, map.holesSize, 1, output);
+ if (hasHoles)
+ fwrite(holes, map.holesSize, 1, output);
fclose(output);